Backed out changeset 2ba94924e6d7 (bug 1339144) for xpcshell failures a=backout

MozReview-Commit-ID: BeLYZwHULEn
This commit is contained in:
Wes Kocher 2017-02-16 17:12:51 -08:00
Родитель 1c89a88adf
Коммит 4355df962e
4 изменённых файлов: 71 добавлений и 37 удалений

Просмотреть файл

@ -26,6 +26,7 @@ const {CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm", {})
// use to select our configuration.
if (gTestPath.includes("test-oop-extensions")) {
SpecialPowers.pushPrefEnv({set: [
["dom.ipc.processCount.extension", 1],
["extensions.webextensions.remote", true],
]});
// We don't want to reset this at the end of the test, so that we don't have

Просмотреть файл

@ -2916,9 +2916,6 @@ pref("dom.ipc.processCount", 2);
pref("dom.ipc.processCount", 1);
#endif
// WebExtensions only support a single extension process.
pref("dom.ipc.processCount.extension", 1);
// Disable support for SVG
pref("svg.disabled", false);

Просмотреть файл

@ -723,32 +723,35 @@ class HiddenExtensionPage {
* @returns {Promise<XULElement>}
* a Promise which resolves to the newly created browser XUL element.
*/
async createBrowserElement() {
createBrowserElement() {
if (this.browser) {
throw new Error("createBrowserElement called twice");
}
let chromeDoc = await this.createWindowlessBrowser();
const browser = this.browser = chromeDoc.createElement("browser");
browser.setAttribute("type", "content");
browser.setAttribute("disableglobalhistory", "true");
browser.setAttribute("webextension-view-type", this.viewType);
let awaitFrameLoader = Promise.resolve();
let waitForParentDocument;
if (this.extension.remote) {
browser.setAttribute("remote", "true");
browser.setAttribute("remoteType", E10SUtils.EXTENSION_REMOTE_TYPE);
awaitFrameLoader = promiseEvent(browser, "XULFrameLoaderCreated");
waitForParentDocument = this.createWindowedBrowser();
} else {
waitForParentDocument = this.createWindowlessBrowser();
}
chromeDoc.documentElement.appendChild(browser);
await awaitFrameLoader;
return waitForParentDocument.then(chromeDoc => {
const browser = this.browser = chromeDoc.createElement("browser");
browser.setAttribute("type", "content");
browser.setAttribute("disableglobalhistory", "true");
browser.setAttribute("webextension-view-type", this.viewType);
browser.docShellIsActive = false;
let awaitFrameLoader = Promise.resolve();
return browser;
if (this.extension.remote) {
browser.setAttribute("remote", "true");
browser.setAttribute("remoteType", E10SUtils.EXTENSION_REMOTE_TYPE);
awaitFrameLoader = promiseEvent(browser, "XULFrameLoaderCreated");
}
chromeDoc.documentElement.appendChild(browser);
return awaitFrameLoader.then(() => browser);
});
}
/**
@ -765,26 +768,58 @@ class HiddenExtensionPage {
* a promise which resolves to the newly created XULDocument.
*/
createWindowlessBrowser() {
// The invisible page is currently wrapped in a XUL window to fix an issue
// with using the canvas API from a background page (See Bug 1274775).
let windowlessBrowser = Services.appShell.createWindowlessBrowser(true);
this.windowlessBrowser = windowlessBrowser;
return Task.spawn(function* () {
// The invisible page is currently wrapped in a XUL window to fix an issue
// with using the canvas API from a background page (See Bug 1274775).
let windowlessBrowser = Services.appShell.createWindowlessBrowser(true);
this.windowlessBrowser = windowlessBrowser;
// The windowless browser is a thin wrapper around a docShell that keeps
// its related resources alive. It implements nsIWebNavigation and
// forwards its methods to the underlying docShell, but cannot act as a
// docShell itself. Calling `getInterface(nsIDocShell)` gives us the
// underlying docShell, and `QueryInterface(nsIWebNavigation)` gives us
// access to the webNav methods that are already available on the
// windowless browser, but contrary to appearances, they are not the same
// object.
let chromeShell = windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsIWebNavigation);
// The windowless browser is a thin wrapper around a docShell that keeps
// its related resources alive. It implements nsIWebNavigation and
// forwards its methods to the underlying docShell, but cannot act as a
// docShell itself. Calling `getInterface(nsIDocShell)` gives us the
// underlying docShell, and `QueryInterface(nsIWebNavigation)` gives us
// access to the webNav methods that are already available on the
// windowless browser, but contrary to appearances, they are not the same
// object.
let chromeShell = windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsIWebNavigation);
yield this.initParentWindow(chromeShell);
return this.initParentWindow(chromeShell).then(() => {
return promiseDocumentLoaded(windowlessBrowser.document);
});
}.bind(this));
}
/**
* Private helper that create a XULDocument in a visible dialog window.
*
* Using this helper, the extension page is loaded into a visible dialog window.
* Only to be used for debugging, and in temporary, test-only use for
* out-of-process extensions.
*
* @returns {Promise<XULDocument>}
* a promise which resolves to the newly created XULDocument.
*/
createWindowedBrowser() {
return Task.spawn(function* () {
let window = Services.ww.openWindow(null, "about:blank", "_blank",
"chrome,alwaysLowered,dialog", null);
this.parentWindow = window;
let chromeShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsIWebNavigation);
yield this.initParentWindow(chromeShell);
window.minimize();
return promiseDocumentLoaded(window.document);
}.bind(this));
}
/**

Просмотреть файл

@ -10,6 +10,7 @@ var {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstant
// use to select our configuration.
if (location.pathname.includes("test-oop-extensions")) {
SpecialPowers.pushPrefEnv({set: [
["dom.ipc.processCount.extension", 1],
["extensions.webextensions.remote", true],
]});
// We don't want to reset this at the end of the test, so that we don't have