Backed out 7 changesets (bug 1047603) for mn-e10s and bc1-e10s bustage

Backed out changeset 38c6689adcbb (bug 1047603)
Backed out changeset 931b3b52e8e8 (bug 1047603)
Backed out changeset 9346f1b17ff2 (bug 1047603)
Backed out changeset 02dbbf0b017f (bug 1047603)
Backed out changeset a4ec7ded1155 (bug 1047603)
Backed out changeset dfe6ac341eb3 (bug 1047603)
Backed out changeset d846a8ebe879 (bug 1047603)
This commit is contained in:
Wes Kocher 2015-02-04 15:05:19 -08:00
parent 736a48c49b
commit 1b64ba233f
14 changed files with 56 additions and 305 deletions

View File

@ -874,22 +874,7 @@ 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 }) {
// We should only start the redirection if the browser window has finished
// starting up. Otherwise, we should wait until the startup is done.
if (gBrowserInit.delayedStartupFinished) {
LoadInOtherProcess(browser, data.loadOptions, data.historyIndex);
} else {
let delayedStartupFinished = (subject, topic) => {
if (topic == "browser-delayed-startup-finished" &&
subject == window) {
Services.obs.removeObserver(delayedStartupFinished, topic);
LoadInOtherProcess(browser, data.loadOptions, data.historyIndex);
}
};
Services.obs.addObserver(delayedStartupFinished,
"browser-delayed-startup-finished",
false);
}
LoadInOtherProcess(browser, data.loadOptions, data.historyIndex);
}
var gBrowserInit = {
@ -918,8 +903,6 @@ var gBrowserInit = {
mm.loadFrameScript("chrome://browser/content/content.js", true);
mm.loadFrameScript("chrome://browser/content/content-UITour.js", true);
window.messageManager.addMessageListener("Browser:LoadURI", RedirectLoad);
// initialize observers and listeners
// and give C++ access to gBrowser
XULBrowserWindow.init();
@ -937,6 +920,8 @@ var gBrowserInit = {
Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService)
.addSystemEventListener(gBrowser, "click", contentAreaClick, true);
} else {
gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true);
}
// hook up UI through progress listener
@ -1193,29 +1178,13 @@ var gBrowserInit = {
else if (uriToLoad instanceof XULElement) {
// swap the given tab with the default about:blank tab and then close
// the original tab in the other window.
let tabToOpen = uriToLoad;
// Stop the about:blank load
gBrowser.stop();
// make sure it has a docshell
gBrowser.docShell;
// If the browser that we're swapping in was remote, then we'd better
// be able to support remote browsers, and then make our selectedTab
// remote.
try {
if (tabToOpen.linkedBrowser.isRemoteBrowser) {
if (!gMultiProcessBrowser) {
throw new Error("Cannot drag a remote browser into a window " +
"without the remote tabs load context.");
}
gBrowser.updateBrowserRemoteness(gBrowser.selectedBrowser, true);
}
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, tabToOpen);
} catch(e) {
Cu.reportError(e);
}
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad);
}
// window.arguments[2]: referrer (nsIURI)
// [3]: postData (nsIInputStream)
@ -1244,6 +1213,7 @@ var gBrowserInit = {
Services.obs.addObserver(gXPInstallObserver, "addon-install-failed", false);
Services.obs.addObserver(gXPInstallObserver, "addon-install-complete", false);
window.messageManager.addMessageListener("Browser:URIFixup", gKeywordURIFixup);
window.messageManager.addMessageListener("Browser:LoadURI", RedirectLoad);
BrowserOffline.init();
OfflineApps.init();
@ -4109,13 +4079,6 @@ var XULBrowserWindow = {
// unsupported
},
forceInitialBrowserRemote: function() {
let initBrowser =
document.getAnonymousElementByAttribute(gBrowser, "anonid", "initialBrowser");
gBrowser.updateBrowserRemoteness(initBrowser, true);
return initBrowser.frameLoader.tabParent;
},
setDefaultStatus: function (status) {
this.defaultStatus = status;
this.updateStatusField();
@ -4771,7 +4734,7 @@ function nsBrowserAccess() { }
nsBrowserAccess.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow, Ci.nsISupports]),
_openURIInNewTab: function(aURI, aReferrer, aIsPrivate, aIsExternal, aForceNotRemote=false) {
_openURIInNewTab: function(aURI, aReferrer, aIsPrivate, aIsExternal) {
let win, needToFocusWin;
// try the current window. if we're in a popup, fall back on the most recent browser window
@ -4798,8 +4761,7 @@ nsBrowserAccess.prototype = {
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
referrerURI: aReferrer,
fromExternal: aIsExternal,
inBackground: loadInBackground,
forceNotRemote: aForceNotRemote});
inBackground: loadInBackground});
let browser = win.gBrowser.getBrowserForTab(tab);
if (needToFocusWin || (!loadInBackground && aIsExternal))
@ -4809,23 +4771,9 @@ nsBrowserAccess.prototype = {
},
openURI: function (aURI, aOpener, aWhere, aContext) {
// This function should only ever be called if we're opening a URI
// from a non-remote browser window (via nsContentTreeOwner).
if (aOpener && Cu.isCrossProcessWrapper(aOpener)) {
Cu.reportError("nsBrowserAccess.openURI was passed a CPOW for aOpener. " +
"openURI should only ever be called from non-remote browsers.");
throw Cr.NS_ERROR_FAILURE;
}
var newWindow = null;
var isExternal = (aContext == Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
if (aOpener && isExternal) {
Cu.reportError("nsBrowserAccess.openURI did not expect an opener to be " +
"passed if the context is OPEN_EXTERNAL.");
throw Cr.NS_ERROR_FAILURE;
}
if (isExternal && aURI && aURI.schemeIs("chrome")) {
dump("use --chrome command-line option to load external chrome urls\n");
return null;
@ -4854,14 +4802,7 @@ nsBrowserAccess.prototype = {
break;
case Ci.nsIBrowserDOMWindow.OPEN_NEWTAB :
let referrer = aOpener ? makeURI(aOpener.location.href) : null;
// If we have an opener, that means that the caller is expecting access
// to the nsIDOMWindow of the opened tab right away. For e10s windows,
// this means forcing the newly opened browser to be non-remote so that
// we can hand back the nsIDOMWindow. The XULBrowserWindow.shouldLoadURI
// will do the job of shuttling off the newly opened browser to run in
// the right process once it starts loading a URI.
let forceNotRemote = !!aOpener;
let browser = this._openURIInNewTab(aURI, referrer, isPrivate, isExternal, forceNotRemote);
let browser = this._openURIInNewTab(aURI, referrer, isPrivate, isExternal);
if (browser)
newWindow = browser.contentWindow;
break;

View File

@ -1366,7 +1366,6 @@
var aRelatedToCurrent;
var aAllowMixedContent;
var aSkipAnimation;
var aForceNotRemote;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@ -1380,7 +1379,6 @@
aRelatedToCurrent = params.relatedToCurrent;
aAllowMixedContent = params.allowMixedContent;
aSkipAnimation = params.skipAnimation;
aForceNotRemote = params.forceNotRemote;
}
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
@ -1395,8 +1393,7 @@
fromExternal: aFromExternal,
relatedToCurrent: aRelatedToCurrent,
skipAnimation: aSkipAnimation,
allowMixedContent: aAllowMixedContent,
forceNotRemote: aForceNotRemote });
allowMixedContent: aAllowMixedContent });
if (!bgLoad)
this.selectedTab = tab;
@ -1666,7 +1663,6 @@
var aRelatedToCurrent;
var aSkipAnimation;
var aAllowMixedContent;
var aForceNotRemote;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@ -1680,7 +1676,6 @@
aRelatedToCurrent = params.relatedToCurrent;
aSkipAnimation = params.skipAnimation;
aAllowMixedContent = params.allowMixedContent;
aForceNotRemote = params.forceNotRemote;
}
// if we're adding tabs, we're past interrupt mode, ditch the owner
@ -1695,9 +1690,7 @@
t.setAttribute("onerror", "this.removeAttribute('image');");
t.className = "tabbrowser-tab";
let remote = (gMultiProcessBrowser &&
!aForceNotRemote &&
E10SUtils.shouldBrowserBeRemote(aURI));
let remote = gMultiProcessBrowser && E10SUtils.shouldBrowserBeRemote(aURI);
if (remote)
t.setAttribute("remote", "true");

View File

@ -212,6 +212,7 @@ skip-if = e10s
[browser_bug561636.js]
skip-if = e10s # Bug 1093677 - automated form submission from the test doesn't seem to quite work yet
[browser_bug562649.js]
skip-if = e10s # Bug 940195 - XULBrowserWindow.isBusy is false as a remote tab starts loading
[browser_bug563588.js]
[browser_bug565575.js]
skip-if = e10s
@ -277,7 +278,6 @@ skip-if = e10s
[browser_bug832435.js]
[browser_bug839103.js]
[browser_bug880101.js]
skip-if = e10s # Bug 1126316 - New e10s windows erroneously fire initial about:blank location through nsIWebProgressListener
[browser_bug882977.js]
[browser_bug902156.js]
[browser_bug906190.js]
@ -427,8 +427,6 @@ skip-if = e10s
[browser_tabs_isActive.js]
skip-if = e10s # Bug 1100664 - test relies on linkedBrowser.docShell
[browser_tabs_owner.js]
[browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js]
skip-if = !e10s && os == "linux" # Bug 994541 - Need OMTC enabled by default on Linux, or else we get blocked by an alert dialog when opening e10s window.
[browser_trackingUI.js]
support-files =
trackingPage.html

View File

@ -5,6 +5,7 @@ function test() {
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
ok(XULBrowserWindow.isBusy, "window is busy loading a page");
is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI");
is(gURLBar.value, URI, "location bar value matches test URI");

View File

@ -1,124 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const OPEN_LOCATION_PREF = "browser.link.open_newwindow";
const NON_REMOTE_PAGE = "about:welcomeback";
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
function frame_script() {
content.document.body.innerHTML = `
<a href="about:home" target="_blank" id="testAnchor">Open a window</a>
`;
let element = content.document.getElementById("testAnchor");
element.click();
}
/**
* Takes some browser in some window, and forces that browser
* to become non-remote, and then navigates it to a page that
* we're not supposed to be displaying remotely. Returns a
* Promise that resolves when the browser is no longer remote.
*/
function prepareNonRemoteBrowser(aWindow, browser) {
browser.loadURI(NON_REMOTE_PAGE);
return waitForDocLoadComplete(browser);
}
registerCleanupFunction(() => {
Services.prefs.clearUserPref(OPEN_LOCATION_PREF);
});
/**
* Test that if we open a new tab from a link in a non-remote
* browser in an e10s window, that the new tab will load properly.
*/
add_task(function* test_new_tab() {
let normalWindow = yield promiseOpenAndLoadWindow({
remote: true
}, true);
let privateWindow = yield promiseOpenAndLoadWindow({
remote: true,
private: true,
}, true);
for (let testWindow of [normalWindow, privateWindow]) {
yield promiseWaitForFocus(testWindow);
let testBrowser = testWindow.gBrowser.selectedBrowser;
info("Preparing non-remote browser");
yield prepareNonRemoteBrowser(testWindow, testBrowser);
info("Non-remote browser prepared - sending frame script");
// Get our framescript ready
let mm = testBrowser.messageManager;
mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", true);
let tabOpenEvent = yield waitForNewTabEvent(testWindow.gBrowser);
let newTab = tabOpenEvent.target;
yield promiseTabLoadEvent(newTab);
// Our framescript opens to about:home which means that the
// tab should eventually become remote.
ok(newTab.linkedBrowser.isRemoteBrowser,
"The opened browser never became remote.");
testWindow.gBrowser.removeTab(newTab);
}
normalWindow.close();
privateWindow.close();
});
/**
* Test that if we open a new window from a link in a non-remote
* browser in an e10s window, that the new window is not an e10s
* window. Also tests with a private browsing window.
*/
add_task(function* test_new_window() {
let normalWindow = yield promiseOpenAndLoadWindow({
remote: true
}, true);
let privateWindow = yield promiseOpenAndLoadWindow({
remote: true,
private: true,
}, true);
// Fiddle with the prefs so that we open target="_blank" links
// in new windows instead of new tabs.
Services.prefs.setIntPref(OPEN_LOCATION_PREF,
Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW);
for (let testWindow of [normalWindow, privateWindow]) {
yield promiseWaitForFocus(testWindow);
let testBrowser = testWindow.gBrowser.selectedBrowser;
yield prepareNonRemoteBrowser(testWindow, testBrowser);
// Get our framescript ready
let mm = testBrowser.messageManager;
mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", true);
// Click on the link in the browser, and wait for the new window.
let {subject: newWindow} =
yield promiseTopicObserved("browser-delayed-startup-finished");
is(PrivateBrowsingUtils.isWindowPrivate(testWindow),
PrivateBrowsingUtils.isWindowPrivate(newWindow),
"Private browsing state of new window does not match the original!");
let newTab = newWindow.gBrowser.selectedTab;
yield promiseTabLoadEvent(newTab);
// Our framescript opens to about:home which means that the
// tab should eventually become remote.
ok(newTab.linkedBrowser.isRemoteBrowser,
"The opened browser never became remote.");
newWindow.close();
}
normalWindow.close();
privateWindow.close();
});

View File

@ -123,23 +123,6 @@ function promiseWaitForEvent(object, eventName, capturing = false, chrome = fals
});
}
/**
* Allows setting focus on a window, and waiting for that window to achieve
* focus.
*
* @param aWindow
* The window to focus and wait for.
*
* @return {Promise}
* @resolves When the window is focused.
* @rejects Never.
*/
function promiseWaitForFocus(aWindow) {
return new Promise((resolve) => {
waitForFocus(resolve, aWindow);
});
}
function getTestPlugin(aName) {
var pluginName = aName || "Test Plug-in";
var ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
@ -628,21 +611,6 @@ function promiseTabLoadEvent(tab, url, eventType="load")
return deferred.promise;
}
/**
* Returns a Promise that resolves once a new tab has been opened in
* a xul:tabbrowser.
*
* @param aTabBrowser
* The xul:tabbrowser to monitor for a new tab.
* @return {Promise}
* Resolved when the new tab has been opened.
* @resolves to the TabOpen event that was fired.
* @rejects Never.
*/
function waitForNewTabEvent(aTabBrowser) {
return promiseWaitForEvent(aTabBrowser.tabContainer, "TabOpen");
}
function assertWebRTCIndicatorStatus(expected) {
let ui = Cu.import("resource:///modules/webrtcUI.jsm", {}).webrtcUI;
let expectedState = expected ? "visible" : "hidden";
@ -816,26 +784,3 @@ function promiseAutocompleteResultPopup(inputText, win = window) {
return promiseSearchComplete(win);
}
/**
* Allows waiting for an observer notification once.
*
* @param aTopic
* Notification topic to observe.
*
* @return {Promise}
* @resolves An object with subject and data properties from the observed
* notification.
* @rejects Never.
*/
function promiseTopicObserved(aTopic)
{
return new Promise((resolve) => {
Services.obs.addObserver(
function PTO_observe(aSubject, aTopic, aData) {
Services.obs.removeObserver(PTO_observe, aTopic);
resolve({subject: aSubject, data: aData});
}, aTopic, false);
});
}

View File

@ -39,24 +39,11 @@ function test() {
let url = "http://example.com/?window=" + windowsToOpen.length;
provideWindow(function onTestURLLoaded(win) {
let tabReady = () => {
promiseWindowClosed(win).then(() => {
openWindowRec(windowsToOpen, expectedResults, recCallback);
});
};
if (win.gMultiProcessBrowser) {
// For e10s windows, the initial browser starts out non-remote and then
// gets transitioned to remote once a document is requested. The
// history of a browser when transitioned from one remote state to
// another gets restored to the new browser. We need to wait for this
// restoration to occur when we load our test URL, otherwise closed
// window serialization does not work.
let tab = win.gBrowser.selectedTab;
promiseTabRestored(tab).then(tabReady);
} else {
tabReady();
}
win.close();
// Give it time to close
executeSoon(function() {
openWindowRec(windowsToOpen, expectedResults, recCallback);
});
}, url, settings);
}

View File

@ -13754,6 +13754,19 @@ nsDocShell::GetOpener()
return opener;
}
void
nsDocShell::SetOpenedRemote(nsITabParent* aOpenedRemote)
{
mOpenedRemote = do_GetWeakReference(aOpenedRemote);
}
nsITabParent*
nsDocShell::GetOpenedRemote()
{
nsCOMPtr<nsITabParent> openedRemote(do_QueryReferent(mOpenedRemote));
return openedRemote;
}
URLSearchParams*
nsDocShell::GetURLSearchParams()
{

View File

@ -963,6 +963,7 @@ private:
nsTObserverArray<nsWeakPtr> mScrollObservers;
nsCString mOriginalUriString;
nsWeakPtr mOpener;
nsWeakPtr mOpenedRemote;
// A depth count of how many times NotifyRunToCompletionStart
// has been called without a matching NotifyRunToCompletionStop.

View File

@ -54,7 +54,7 @@ interface nsITabParent;
typedef unsigned long nsLoadFlags;
[scriptable, builtinclass, uuid(e1ad6cc6-f10a-4882-b5f8-31e70c5ddadf)]
[scriptable, builtinclass, uuid(888fcf04-a69b-11e4-8d33-6fbb72d2eb03)]
interface nsIDocShell : nsIDocShellTreeItem
{
/**
@ -1025,6 +1025,13 @@ interface nsIDocShell : nsIDocShellTreeItem
[noscript,notxpcom,nostdcall] void setOpener(in nsITabParent aOpener);
[noscript,notxpcom,nostdcall] nsITabParent getOpener();
/**
* See the documentation for setOpener and getOpener about why we
* don't use attribute here instead.
*/
[noscript,notxpcom,nostdcall] void setOpenedRemote(in nsITabParent aOpenedRemote);
[noscript,notxpcom,nostdcall] nsITabParent getOpenedRemote();
// URLSearchParams for the window.location is owned by the docShell.
[noscript,notxpcom] URLSearchParams getURLSearchParams();

View File

@ -2188,6 +2188,7 @@ nsFrameLoader::TryRemoteBrowser()
eCaseMatters)) {
unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
}
parentDocShell->SetOpenedRemote(mRemoteBrowser);
}
return true;
}

View File

@ -647,22 +647,11 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
nsCOMPtr<nsPIDOMWindow> pwindow = do_QueryInterface(window);
NS_ENSURE_TRUE(pwindow, false);
nsCOMPtr<nsIDocShell> windowDocShell = pwindow->GetDocShell();
NS_ENSURE_TRUE(windowDocShell, false);
nsRefPtr<nsIDocShell> newDocShell = pwindow->GetDocShell();
NS_ENSURE_TRUE(newDocShell, false);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
windowDocShell->GetTreeOwner(getter_AddRefs(treeOwner));
nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(treeOwner);
NS_ENSURE_TRUE(xulWin, false);
nsCOMPtr<nsIXULBrowserWindow> xulBrowserWin;
xulWin->GetXULBrowserWindow(getter_AddRefs(xulBrowserWin));
NS_ENSURE_TRUE(xulBrowserWin, false);
nsCOMPtr<nsITabParent> newRemoteTab;
rv = xulBrowserWin->ForceInitialBrowserRemote(getter_AddRefs(newRemoteTab));
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr<nsITabParent> newRemoteTab = newDocShell->GetOpenedRemote();
NS_ENSURE_TRUE(newRemoteTab, false);
MOZ_ASSERT(static_cast<TabParent*>(newRemoteTab.get()) == newTab);

View File

@ -12,14 +12,13 @@ interface nsIRequest;
interface nsIDOMElement;
interface nsIInputStream;
interface nsIDocShell;
interface nsITabParent;
/**
* The nsIXULBrowserWindow supplies the methods that may be called from the
* internals of the browser area to tell the containing xul window to update
* its ui.
*/
[scriptable, uuid(db89f748-9736-40b2-a172-3928aa1194b2)]
[scriptable, uuid(162d3378-a7d5-410c-8635-fe80e32020fc)]
interface nsIXULBrowserWindow : nsISupports
{
/**
@ -41,14 +40,6 @@ interface nsIXULBrowserWindow : nsISupports
in nsIDOMNode linkNode,
in boolean isAppTab);
/**
* Find the initial browser of the window and set its remote attribute.
* This can be used to ensure that there is a remote browser in a new
* window when it first spawns.
*
*/
nsITabParent forceInitialBrowserRemote();
/**
* Determines whether a load should continue.
*

View File

@ -34,7 +34,6 @@
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIIOService.h"
#include "nsILoadContext.h"
#include "nsIObserverService.h"
#include "nsIWindowMediator.h"
#include "nsIScreenManager.h"
@ -1799,9 +1798,18 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(int32_t aChromeFlags,
if (!NS_ProcessNextEvent(thread))
break;
}
}
}
NS_ENSURE_STATE(xulWin->mPrimaryContentShell);
// If aOpeningTab is not null, it means that we're creating a new window
// with a remote browser, which doesn't have a primary docshell. In that
// case, we check for the chrome window docshell and make sure that a new
// remote tab was opened and stashed in that docshell.
if (aOpeningTab) {
NS_ENSURE_STATE(xulWin->mDocShell);
NS_ENSURE_STATE(xulWin->mDocShell->GetOpenedRemote());
} else {
NS_ENSURE_STATE(xulWin->mPrimaryContentShell);
}
*_retval = newWindow;
NS_ADDREF(*_retval);