Backed out changeset c122b0183c7c (bug 1339144) for xpcshell failures

--HG--
extra : rebase_source : c207c08be92de010922c4e9d1559673f313558e9
This commit is contained in:
Iris Hsiao 2017-02-17 10:40:20 +08:00
Родитель fff91cf0bf
Коммит 94c8bb425f
7 изменённых файлов: 73 добавлений и 40 удалений

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

@ -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

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

@ -2923,9 +2923,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);

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

@ -724,32 +724,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);
});
}
/**
@ -766,26 +769,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));
}
/**

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

@ -159,7 +159,7 @@ class FilteringMessageManager {
* passes the result to our message callback.
*/
receiveMessage({data, target}) {
let handlers = Array.from(this.getHandlers(data.messageName, data.sender || null, data.recipient));
let handlers = Array.from(this.getHandlers(data.messageName, data.sender, data.recipient));
data.target = target;
this.callback(handlers, data);

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

@ -966,7 +966,7 @@ class StringType extends Type {
format = FORMATS[schema.format];
}
return new this(schema,
schema.id || undefined,
schema.id,
enumeration,
schema.minLength || 0,
schema.maxLength || Infinity,

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

@ -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

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

@ -47,7 +47,6 @@ skip-if = release_or_beta
[test_ext_manifest_incognito.js]
[test_ext_manifest_minimum_chrome_version.js]
[test_ext_onmessage_removelistener.js]
skip-if = true # This test no longer tests what it is meant to test.
[test_ext_runtime_connect_no_receiver.js]
[test_ext_runtime_getBrowserInfo.js]
[test_ext_runtime_getPlatformInfo.js]