1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* eslint-env mozilla/frame-script */
6 /* global api, CopyPasteAssistent */
11 // dump("BrowserElementChild - " + msg + "\n");
14 var BrowserElementIsReady;
16 debug(`Might load BE scripts: BEIR: ${BrowserElementIsReady}`);
17 if (!BrowserElementIsReady) {
18 debug("Loading BE scripts");
19 if (!("BrowserElementIsPreloaded" in this)) {
20 Services.scriptloader.loadSubScript(
21 "chrome://global/content/BrowserElementChildPreload.js",
26 function onDestroy() {
27 removeMessageListener("browser-element-api:destroy", onDestroy);
33 BrowserElementIsReady = false;
35 addMessageListener("browser-element-api:destroy", onDestroy);
37 BrowserElementIsReady = true;
39 debug("BE already loaded, abort");
42 sendAsyncMessage("browser-element-api:call", { msg_name: "hello" });