diff --git a/src/browser/base/content/zen-assets.jar.inc.mn b/src/browser/base/content/zen-assets.jar.inc.mn index fc3908376..d8ee81f6e 100644 --- a/src/browser/base/content/zen-assets.jar.inc.mn +++ b/src/browser/base/content/zen-assets.jar.inc.mn @@ -7,7 +7,6 @@ content/browser/ZenPreloadedScripts.js (../../zen/common/ZenPreloadedScripts.js) content/browser/zen-sets.js (../../zen/common/zen-sets.js) content/browser/ZenUIManager.mjs (../../zen/common/ZenUIManager.mjs) - content/browser/zen-components/ZenActorsManager.mjs (../../zen/common/ZenActorsManager.mjs) content/browser/zen-components/ZenCommonUtils.mjs (../../zen/common/ZenCommonUtils.mjs) content/browser/zen-components/ZenSessionStore.mjs (../../zen/common/ZenSessionStore.mjs) content/browser/zen-components/ZenEmojisData.min.mjs (../../zen/common/emojis/ZenEmojisData.min.mjs) diff --git a/src/browser/base/content/zen-preloaded.inc.xhtml b/src/browser/base/content/zen-preloaded.inc.xhtml index 4d4f56661..83e73ef9d 100644 --- a/src/browser/base/content/zen-preloaded.inc.xhtml +++ b/src/browser/base/content/zen-preloaded.inc.xhtml @@ -13,5 +13,4 @@ - diff --git a/src/zen/ZenComponents.manifest b/src/zen/ZenComponents.manifest new file mode 100644 index 000000000..74c0232b8 --- /dev/null +++ b/src/zen/ZenComponents.manifest @@ -0,0 +1,15 @@ +# 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/. + +# nsBrowserGlue.js + +# This component must restrict its registration for the app-startup category +# to the specific list of apps that use it so it doesn't get loaded in xpcshell. +# Thus we restrict it to these apps: +# +# browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + +category app-startup nsBrowserGlue @mozilla.org/browser/browserglue;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} + +#include common/Components.manifest diff --git a/src/zen/common/Components.manifest b/src/zen/common/Components.manifest new file mode 100644 index 000000000..ee1759fff --- /dev/null +++ b/src/zen/common/Components.manifest @@ -0,0 +1,5 @@ +# 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/. + +category browser-before-ui-startup resource:///modules/ZenActorsManager.sys.mjs gZenActorsManager.init diff --git a/src/zen/common/ZenActorsManager.mjs b/src/zen/common/ZenActorsManager.mjs deleted file mode 100644 index af43cf303..000000000 --- a/src/zen/common/ZenActorsManager.mjs +++ /dev/null @@ -1,34 +0,0 @@ -// 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/. -// Utility to register JSWindowActors - -window.gZenActorsManager = { - _actors: new Set(), - _lazy: {}, - - init() { - ChromeUtils.defineESModuleGetters(this._lazy, { - ActorManagerParent: 'resource://gre/modules/ActorManagerParent.sys.mjs', - }); - }, - - addJSWindowActor(name, data) { - if (!this._lazy.ActorManagerParent) { - this.init(); - } - if (this._actors.has(name)) { - // Actor already registered, nothing to do - return; - } - - const decl = {}; - decl[name] = data; - try { - this._lazy.ActorManagerParent.addJSWindowActors(decl); - this._actors.add(name); - } catch (e) { - console.warn(`Failed to register JSWindowActor: ${e}`); - } - }, -}; diff --git a/src/zen/common/ZenActorsManager.sys.mjs b/src/zen/common/ZenActorsManager.sys.mjs new file mode 100644 index 000000000..817cfef79 --- /dev/null +++ b/src/zen/common/ZenActorsManager.sys.mjs @@ -0,0 +1,61 @@ +// 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/. +// Utility to register JSWindowActors + +import { ActorManagerParent } from 'resource://gre/modules/ActorManagerParent.sys.mjs'; + +/** + * Fission-compatible JSProcess implementations. + * Each actor options object takes the form of a ProcessActorOptions dictionary. + * Detailed documentation of these options is in dom/docs/ipc/jsactors.rst, + * available at https://firefox-source-docs.mozilla.org/dom/ipc/jsactors.html + */ +let JSPROCESSACTORS = {}; + +/** + * Fission-compatible JSWindowActor implementations. + * Detailed documentation of these options is in dom/docs/ipc/jsactors.rst, + * available at https://firefox-source-docs.mozilla.org/dom/ipc/jsactors.html + */ +let JSWINDOWACTORS = { + ZenModsMarketplace: { + parent: { + esModuleURI: 'resource:///actors/ZenModsMarketplaceParent.sys.mjs', + }, + child: { + esModuleURI: 'resource:///actors/ZenModsMarketplaceChild.sys.mjs', + events: { + DOMContentLoaded: {}, + }, + }, + matches: [ + ...Services.prefs.getStringPref('zen.injections.match-urls').split(','), + 'about:preferences', + ], + }, + ZenGlance: { + parent: { + esModuleURI: 'resource:///actors/ZenGlanceParent.sys.mjs', + }, + child: { + esModuleURI: 'resource:///actors/ZenGlanceChild.sys.mjs', + events: { + DOMContentLoaded: {}, + keydown: { + capture: true, + }, + }, + }, + allFrames: true, + matches: ['*://*/*'], + enablePreference: 'zen.glance.enabled', + }, +}; + +export let gZenActorsManager = { + init() { + ActorManagerParent.addJSProcessActors(JSPROCESSACTORS); + ActorManagerParent.addJSWindowActors(JSWINDOWACTORS); + }, +}; diff --git a/src/zen/common/moz.build b/src/zen/common/moz.build index 2de29514c..fa6ec309c 100644 --- a/src/zen/common/moz.build +++ b/src/zen/common/moz.build @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_JS_MODULES += [ + "ZenActorsManager.sys.mjs", "ZenCustomizableUI.sys.mjs", "ZenUIMigration.sys.mjs", ] diff --git a/src/zen/glance/ZenGlanceManager.mjs b/src/zen/glance/ZenGlanceManager.mjs index 3720448fa..a8fc9fcc6 100644 --- a/src/zen/glance/ZenGlanceManager.mjs +++ b/src/zen/glance/ZenGlanceManager.mjs @@ -1716,29 +1716,4 @@ } window.gZenGlanceManager = new nsZenGlanceManager(); - - /** - * Register window actors for glance functionality - */ - function registerWindowActors() { - gZenActorsManager.addJSWindowActor('ZenGlance', { - parent: { - esModuleURI: 'resource:///actors/ZenGlanceParent.sys.mjs', - }, - child: { - esModuleURI: 'resource:///actors/ZenGlanceChild.sys.mjs', - events: { - DOMContentLoaded: {}, - keydown: { - capture: true, - }, - }, - }, - allFrames: true, - matches: ['*://*/*'], - enablePreference: 'zen.glance.enabled', - }); - } - - registerWindowActors(); } diff --git a/src/zen/mods/ZenMods.mjs b/src/zen/mods/ZenMods.mjs index bf5461d2f..762a2c826 100644 --- a/src/zen/mods/ZenMods.mjs +++ b/src/zen/mods/ZenMods.mjs @@ -667,20 +667,4 @@ } window.gZenMods = new nsZenMods(); - - gZenActorsManager.addJSWindowActor('ZenModsMarketplace', { - parent: { - esModuleURI: 'resource:///actors/ZenModsMarketplaceParent.sys.mjs', - }, - child: { - esModuleURI: 'resource:///actors/ZenModsMarketplaceChild.sys.mjs', - events: { - DOMContentLoaded: {}, - }, - }, - matches: [ - ...Services.prefs.getStringPref('zen.injections.match-urls').split(','), - 'about:preferences', - ], - }); } diff --git a/src/zen/moz.build b/src/zen/moz.build index 56782122f..21915a69a 100644 --- a/src/zen/moz.build +++ b/src/zen/moz.build @@ -2,6 +2,10 @@ # 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/. +EXTRA_PP_COMPONENTS += [ + "ZenComponents.manifest", +] + DIRS += [ "common", "glance", diff --git a/src/zen/zen.globals.js b/src/zen/zen.globals.js index ce22cd4a8..93f2484d1 100644 --- a/src/zen/zen.globals.js +++ b/src/zen/zen.globals.js @@ -45,7 +45,6 @@ export default [ 'Cu', 'Cc', - 'gZenActorsManager', 'JSWindowActorParent', 'JSWindowActorChild',