Bug 1608844 - WebExtensions do not run in FxRPC content processes r=zombie

This change introduces a content script, fxr-content.js, that runs in content processes associated with an FxR PC window. This new script notifies observers of "tab-content-frameloader-created", which allows for WebExtensions content script to be injected into the content process.

Differential Revision: https://phabricator.services.mozilla.com/D59887

--HG--
extra : moz-landing-system : lando
This commit is contained in:
thomasmo 2020-01-15 15:14:15 +00:00
parent 338a38518d
commit b841095b22
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,14 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* This content script is for code associated with an FxR PC window that
* must run in a content process. */
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
// Send this notification from the content process so that the
// ExtensionPolicyService can register this content frame and be ready to load
// content scripts
Services.obs.notifyObservers(this, "tab-content-frameloader-created");

View File

@ -141,6 +141,13 @@ function setupBrowser() {
// WebExtensions, since this FxR UI doesn't participate in typical
// startup activities
Services.obs.notifyObservers(window, "extensions-late-startup");
// Load this script in the content process to start and allow scripts for
// WebExtensions that run in the content process
browser.messageManager.loadFrameScript(
"chrome://fxr/content/fxr-content.js",
true // allowDelayedLoad
);
}
}

View File

@ -11,6 +11,7 @@ browser.jar:
content/browser/fxr/fxrui.css (content/fxrui.css)
content/browser/fxr/fxrui_blue.css (content/fxrui_blue.css)
content/browser/fxr/fxrui.js (content/fxrui.js)
content/browser/fxr/fxr-content.js (content/fxr-content.js)
content/browser/fxr/fxr-fullScreen.js (content/fxr-fullScreen.js)
content/browser/fxr/permissions.js (content/permissions.js)
content/browser/fxr/prefs.html (content/prefs.html)