Skip to content

Commit

Permalink
Backed out changeset adf5ed713e0d (bug 1376895)
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Aug 16, 2017
1 parent 9d3cf96 commit a478b0e
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 140 deletions.
16 changes: 1 addition & 15 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1088,14 +1088,6 @@ function _loadURIWithFlags(browser, uri, params) {
}

let mustChangeProcess = requiredRemoteType != currentRemoteType;
let newFrameloader = false;
if (browser.getAttribute("isPreloadBrowser") == "true" && uri != "about:newtab") {
// Leaving about:newtab from a used to be preloaded browser should run the process
// selecting algorithm again.
mustChangeProcess = true;
newFrameloader = true;
browser.removeAttribute("isPreloadBrowser");
}

// !requiredRemoteType means we're loading in the parent/this process.
if (!requiredRemoteType) {
Expand Down Expand Up @@ -1130,8 +1122,7 @@ function _loadURIWithFlags(browser, uri, params) {
referrer: referrer ? referrer.spec : null,
referrerPolicy,
remoteType: requiredRemoteType,
postData,
newFrameloader,
postData
}

if (params.userContextId) {
Expand Down Expand Up @@ -1176,11 +1167,6 @@ function LoadInOtherProcess(browser, loadOptions, historyIndex = -1) {
// Called when a docshell has attempted to load a page in an incorrect process.
// This function is responsible for loading the page in the correct process.
function RedirectLoad({ target: browser, data }) {
if (browser.getAttribute("isPreloadBrowser") == "true") {
browser.removeAttribute("isPreloadBrowser");
data.loadOptions.newFrameloader = true;
}

if (data.loadOptions.reloadInFreshProcess) {
// Convert the fresh process load option into a large allocation remote type
// to use common processing from this point.
Expand Down
4 changes: 0 additions & 4 deletions browser/base/content/tabbrowser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2118,10 +2118,6 @@
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
}
if (aParams.isPreloadBrowser) {
b.setAttribute("isPreloadBrowser", "true");
}
if (this.hasAttribute("selectmenulist"))
b.setAttribute("selectmenulist", this.getAttribute("selectmenulist"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
add_task(async function() {
let input = "i-definitely-dont-exist.example.com";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:newtab", false);
// NB: CPOW usage because new tab pages can be preloaded, in which case no
// load events fire.
await BrowserTestUtils.waitForCondition(() => !tab.linkedBrowser.contentDocument.hidden)
Expand All @@ -29,7 +29,7 @@ add_task(async function() {
add_task(async function() {
let input = "To be or not to be-that is the question";
await SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]});
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank", false);
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:newtab", false);
// NB: CPOW usage because new tab pages can be preloaded, in which case no
// load events fire.
await BrowserTestUtils.waitForCondition(() => !tab.linkedBrowser.contentDocument.hidden)
Expand Down
8 changes: 0 additions & 8 deletions browser/modules/E10SUtils.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,6 @@ this.E10SUtils = {
this.getRemoteTypeForURIObject(aURI, true, remoteType, webNav.currentURI);
}

if (sessionHistory.count == 1 && webNav.currentURI.spec == "about:newtab") {
// This is possibly a preloaded browser and we're about to navigate away for
// the first time. On the child side there is no way to tell for sure if that
// is the case, so let's redirect this request to the parent to decide if a new
// process is needed.
return false;
}

// If the URI can be loaded in the current process then continue
return this.shouldLoadURIInThisProcess(aURI);
},
Expand Down
1 change: 0 additions & 1 deletion dom/base/nsGkAtomList.h
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,6 @@ GK_ATOM(DisplayPortMargins, "_displayportmargins")
GK_ATOM(DisplayPortBase, "_displayportbase")
GK_ATOM(AsyncScrollLayerCreationFailed, "_asyncscrolllayercreationfailed")
GK_ATOM(forcemessagemanager, "forcemessagemanager")
GK_ATOM(isPreloadBrowser, "isPreloadBrowser")

// Names for system metrics
GK_ATOM(color_picker_available, "color-picker-available")
Expand Down
2 changes: 0 additions & 2 deletions dom/base/test/browser.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[DEFAULT]
support-files =
audio.ogg
dummy.html
empty.html
file_audioLoop.html
file_audioLoopInIframe.html
Expand Down Expand Up @@ -36,7 +35,6 @@ tags = mcb
[browser_force_process_selector.js]
skip-if = !e10s # this only makes sense with e10s-multi
[browser_messagemanager_loadprocessscript.js]
[browser_aboutnewtab_process_selection.js]
[browser_messagemanager_targetframeloader.js]
[browser_messagemanager_unload.js]
[browser_pagehide_on_tab_close.js]
Expand Down
76 changes: 0 additions & 76 deletions dom/base/test/browser_aboutnewtab_process_selection.js

This file was deleted.

9 changes: 0 additions & 9 deletions dom/base/test/dummy.html

This file was deleted.

23 changes: 4 additions & 19 deletions dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,11 +762,11 @@ ContentParent::MinTabSelect(const nsTArray<ContentParent*>& aContentParents,
/*static*/ already_AddRefed<ContentParent>
ContentParent::GetNewOrUsedBrowserProcess(const nsAString& aRemoteType,
ProcessPriority aPriority,
ContentParent* aOpener,
bool aPreferUsed)
ContentParent* aOpener)
{
nsTArray<ContentParent*>& contentParents = GetOrCreatePool(aRemoteType);
uint32_t maxContentParents = GetMaxProcessCount(aRemoteType);

if (aRemoteType.EqualsLiteral(LARGE_ALLOCATION_REMOTE_TYPE)) {
// We never want to re-use Large-Allocation processes.
if (contentParents.Length() >= maxContentParents) {
Expand All @@ -775,18 +775,11 @@ ContentParent::GetNewOrUsedBrowserProcess(const nsAString& aRemoteType,
aOpener);
}
} else {
uint32_t numberOfParents = contentParents.Length();
nsTArray<nsIContentProcessInfo*> infos(numberOfParents);
nsTArray<nsIContentProcessInfo*> infos(contentParents.Length());
for (auto* cp : contentParents) {
infos.AppendElement(cp->mScriptableHelper);
}

if (aPreferUsed && numberOfParents) {
// For the preloaded browser we don't want to create a new process but reuse an
// existing one.
maxContentParents = numberOfParents;
}

nsCOMPtr<nsIContentProcessProvider> cpp =
do_GetService("@mozilla.org/ipc/processselector;1");
nsIContentProcessInfo* openerInfo = aOpener ? aOpener->mScriptableHelper.get() : nullptr;
Expand Down Expand Up @@ -1138,13 +1131,6 @@ ContentParent::CreateBrowser(const TabContext& aContext,
remoteType.AssignLiteral(DEFAULT_REMOTE_TYPE);
}

bool isPreloadBrowser = false;
nsAutoString isPreloadBrowserStr;
if (aFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::isPreloadBrowser,
isPreloadBrowserStr)) {
isPreloadBrowser = isPreloadBrowserStr.EqualsLiteral("true");
}

RefPtr<nsIContentParent> constructorSender;
if (isInContentProcess) {
MOZ_ASSERT(aContext.IsMozBrowserElement() || aContext.IsJSPlugin());
Expand All @@ -1160,8 +1146,7 @@ ContentParent::CreateBrowser(const TabContext& aContext,
initialPriority);
} else {
constructorSender =
GetNewOrUsedBrowserProcess(remoteType, initialPriority,
nullptr, isPreloadBrowser);
GetNewOrUsedBrowserProcess(remoteType, initialPriority, nullptr);
}
if (!constructorSender) {
return nullptr;
Expand Down
3 changes: 1 addition & 2 deletions dom/ipc/ContentParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ class ContentParent final : public PContentParent
GetNewOrUsedBrowserProcess(const nsAString& aRemoteType = NS_LITERAL_STRING(NO_REMOTE_TYPE),
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
ContentParent* aOpener = nullptr,
bool aPreferUsed = false);
ContentParent* aOpener = nullptr);

/**
* Get or create a content process for a JS plugin. aPluginID is the id of the JS plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
var blankTarget = document.getElementById("blankTarget");
blankTarget.click();

var os = SpecialPowers.Cc["@mozilla.org/observer-service;1"].
getService(SpecialPowers.Components.interfaces.nsIObserverService);
var observer = {
observe: function(subject, topic, data) {
if(topic == "content-document-global-created" && data =="http://example.com") {
parent.parent.postMessage({"test": "blankTarget", "msg": "opened an http link with target=_blank from a secure page"}, "http://mochi.test:8888");
SpecialPowers.removeAsyncObserver(observer, "content-document-global-created");
os.removeObserver(observer, "content-document-global-created");
}
}
}
SpecialPowers.addAsyncObserver(observer, "content-document-global-created");
os.addObserver(observer, "content-document-global-created");

</script>
</body>
Expand Down

0 comments on commit a478b0e

Please sign in to comment.