summaryrefslogtreecommitdiffstats
path: root/addon-sdk/source/lib/framescript/content.jsm
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-09 06:46:43 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-09 06:46:43 -0500
commitac46df8daea09899ce30dc8fd70986e258c746bf (patch)
tree2750d3125fc253fd5b0671e4bd268eff1fd97296 /addon-sdk/source/lib/framescript/content.jsm
parent8cecf8d5208f3945b35f879bba3015bb1a11bec6 (diff)
downloadUXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.gz
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.lz
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.tar.xz
UXP-ac46df8daea09899ce30dc8fd70986e258c746bf.zip
Move Add-on SDK source to toolkit/jetpack
Diffstat (limited to 'addon-sdk/source/lib/framescript/content.jsm')
-rw-r--r--addon-sdk/source/lib/framescript/content.jsm94
1 files changed, 0 insertions, 94 deletions
diff --git a/addon-sdk/source/lib/framescript/content.jsm b/addon-sdk/source/lib/framescript/content.jsm
deleted file mode 100644
index eaee26be3..000000000
--- a/addon-sdk/source/lib/framescript/content.jsm
+++ /dev/null
@@ -1,94 +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/. */
-"use strict";
-
-const { utils: Cu, classes: Cc, interfaces: Ci } = Components;
-const { Services } = Cu.import('resource://gre/modules/Services.jsm');
-
-const cpmm = Cc['@mozilla.org/childprocessmessagemanager;1'].
- getService(Ci.nsISyncMessageSender);
-
-this.EXPORTED_SYMBOLS = ["registerContentFrame"];
-
-// This may be an overriden version of the SDK so use the PATH as a key for the
-// initial messages before we have a loaderID.
-const PATH = __URI__.replace('framescript/content.jsm', '');
-
-const { Loader } = Cu.import(PATH + 'toolkit/loader.js', {});
-
-// one Loader instance per addon (per @loader/options to be precise)
-var addons = new Map();
-
-// Tell the parent that a new process is ready
-cpmm.sendAsyncMessage('sdk/remote/process/start', {
- modulePath: PATH
-});
-
-// Load a child process module loader with the given loader options
-cpmm.addMessageListener('sdk/remote/process/load', ({ data: { modulePath, loaderID, options, reason } }) => {
- if (modulePath != PATH)
- return;
-
- // During startup races can mean we get a second load message
- if (addons.has(loaderID))
- return;
-
- options.waiveInterposition = true;
-
- let loader = Loader.Loader(options);
- let addon = {
- loader,
- require: Loader.Require(loader, { id: 'LoaderHelper' }),
- }
- addons.set(loaderID, addon);
-
- cpmm.sendAsyncMessage('sdk/remote/process/attach', {
- loaderID,
- processID: Services.appinfo.processID,
- isRemote: Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
- });
-
- addon.child = addon.require('sdk/remote/child');
-
- for (let contentFrame of frames.values())
- addon.child.registerContentFrame(contentFrame);
-});
-
-// Unload a child process loader
-cpmm.addMessageListener('sdk/remote/process/unload', ({ data: { loaderID, reason } }) => {
- if (!addons.has(loaderID))
- return;
-
- let addon = addons.get(loaderID);
- Loader.unload(addon.loader, reason);
-
- // We want to drop the reference to the loader but never allow creating a new
- // loader with the same ID
- addons.set(loaderID, {});
-})
-
-
-var frames = new Set();
-
-this.registerContentFrame = contentFrame => {
- contentFrame.addEventListener("unload", () => {
- unregisterContentFrame(contentFrame);
- }, false);
-
- frames.add(contentFrame);
-
- for (let addon of addons.values()) {
- if ("child" in addon)
- addon.child.registerContentFrame(contentFrame);
- }
-};
-
-function unregisterContentFrame(contentFrame) {
- frames.delete(contentFrame);
-
- for (let addon of addons.values()) {
- if ("child" in addon)
- addon.child.unregisterContentFrame(contentFrame);
- }
-}