зеркало из https://github.com/mozilla/gecko-dev.git
merge mozilla-central to autoland. r=merge a=merge
This commit is contained in:
Коммит
cfea98eabf
|
@ -64,6 +64,8 @@ browser/components/sessionstore/test/unit/data/sessionstore_invalid.js
|
|||
browser/components/tabview/**
|
||||
# generated & special files in cld2
|
||||
browser/components/translation/cld2/**
|
||||
# Screenshots is imported as a system add-on and has its own lint rules currently.
|
||||
browser/extensions/screenshots/**
|
||||
browser/extensions/pdfjs/content/build**
|
||||
browser/extensions/pdfjs/content/web**
|
||||
# generated or library files in pocket
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
TAGS
|
||||
tags
|
||||
ID
|
||||
!/browser/extensions/screenshots/webextension/_locales/id/
|
||||
.DS_Store*
|
||||
*.pdb
|
||||
*.egg-info
|
||||
|
|
|
@ -135,8 +135,8 @@ this.AccessFu = { // jshint ignore:line
|
|||
]);
|
||||
}
|
||||
|
||||
Services.obs.addObserver(this, 'remote-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
|
||||
Services.obs.addObserver(this, 'remote-browser-shown');
|
||||
Services.obs.addObserver(this, 'inprocess-browser-shown');
|
||||
Utils.win.addEventListener('TabOpen', this);
|
||||
Utils.win.addEventListener('TabClose', this);
|
||||
Utils.win.addEventListener('TabSelect', this);
|
||||
|
|
|
@ -599,7 +599,7 @@ const AccessibilityEventObserver = {
|
|||
if (this.started || this.listenerCount === 0) {
|
||||
return;
|
||||
}
|
||||
Services.obs.addObserver(this, 'accessible-event', false);
|
||||
Services.obs.addObserver(this, 'accessible-event');
|
||||
this.started = true;
|
||||
},
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ function waitForEvent(eventType, expectedIdOrAcc) {
|
|||
}
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(eventObserver, 'accessible-event', false);
|
||||
Services.obs.addObserver(eventObserver, 'accessible-event');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ function a11yInitOrShutdownPromise() {
|
|||
Services.obs.removeObserver(observe, 'a11y-init-or-shutdown');
|
||||
resolve(data);
|
||||
};
|
||||
Services.obs.addObserver(observe, 'a11y-init-or-shutdown', false);
|
||||
Services.obs.addObserver(observe, 'a11y-init-or-shutdown');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ function waitForEvent(eventType, expectedId) {
|
|||
}
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(eventObserver, 'accessible-event', false);
|
||||
Services.obs.addObserver(eventObserver, 'accessible-event');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -149,5 +149,5 @@ function whenDelayedStartupFinished(aWindow, aCallback) {
|
|||
Services.obs.removeObserver(observer, aTopic);
|
||||
setTimeout(aCallback, 0);
|
||||
}
|
||||
}, "browser-delayed-startup-finished", false);
|
||||
}, "browser-delayed-startup-finished");
|
||||
}
|
||||
|
|
|
@ -2120,7 +2120,7 @@ function listenA11yEvents(aStartToListen)
|
|||
if (aStartToListen) {
|
||||
// Add observer when adding the first applicant only.
|
||||
if (!(gA11yEventApplicantsCount++))
|
||||
Services.obs.addObserver(gA11yEventObserver, "accessible-event", false);
|
||||
Services.obs.addObserver(gA11yEventObserver, "accessible-event");
|
||||
} else {
|
||||
// Remove observer when there are no more applicants only.
|
||||
// '< 0' case should not happen, but just in case: removeObserver() will throw.
|
||||
|
|
|
@ -70,7 +70,7 @@ var AccessFuTest = {
|
|||
isDeeply(data.details, aWaitForData, "Data is correct");
|
||||
aListener.apply(listener);
|
||||
};
|
||||
Services.obs.addObserver(listener, 'accessibility-output', false);
|
||||
Services.obs.addObserver(listener, 'accessibility-output');
|
||||
return listener;
|
||||
},
|
||||
|
||||
|
|
|
@ -111,10 +111,10 @@ const observer = {
|
|||
}
|
||||
};
|
||||
|
||||
observerService.addObserver(observer, "content-document-interactive", false);
|
||||
observerService.addObserver(observer, "content-document-loaded", false);
|
||||
observerService.addObserver(observer, "chrome-document-interactive", false);
|
||||
observerService.addObserver(observer, "chrome-document-loaded", false);
|
||||
observerService.addObserver(observer, "content-document-interactive");
|
||||
observerService.addObserver(observer, "content-document-loaded");
|
||||
observerService.addObserver(observer, "chrome-document-interactive");
|
||||
observerService.addObserver(observer, "chrome-document-loaded");
|
||||
addEventListener("unload", observer, false);
|
||||
|
||||
})(this);
|
||||
|
|
|
@ -135,7 +135,8 @@ Bootstrap.prototype = {
|
|||
const prefsURI = `${baseURI}defaults/preferences/prefs.js`;
|
||||
|
||||
// Init the 'sdk/webextension' module from the bootstrap addon parameter.
|
||||
require("sdk/webextension").initFromBootstrapAddonParam(addon);
|
||||
if (addon.webExtension)
|
||||
require("sdk/webextension").initFromBootstrapAddonParam(addon);
|
||||
|
||||
const { startup } = require("sdk/addon/runner");
|
||||
startup(reason, {loader, main, prefsURI});
|
||||
|
|
|
@ -10,14 +10,10 @@ const { Cc, Ci, Cu } = require('chrome');
|
|||
const { rootURI, metadata, isNative } = require('@loader/options');
|
||||
const { id, loadReason } = require('../self');
|
||||
const { descriptor, Sandbox, evaluate, main, resolveURI } = require('toolkit/loader');
|
||||
const { once } = require('../system/events');
|
||||
const { exit, env, staticArgs } = require('../system');
|
||||
const { when: unload } = require('../system/unload');
|
||||
const globals = require('../system/globals');
|
||||
const xulApp = require('../system/xul-app');
|
||||
const { get } = require('../preferences/service');
|
||||
const appShellService = Cc['@mozilla.org/appshell/appShellService;1'].
|
||||
getService(Ci.nsIAppShellService);
|
||||
const { preferences } = metadata;
|
||||
|
||||
const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
|
||||
|
|
|
@ -9,7 +9,7 @@ module.metadata = {
|
|||
|
||||
const { Ci, components } = require("chrome");
|
||||
const { parseStack, sourceURI } = require("toolkit/loader");
|
||||
const { readURISync } = require("../net/url");
|
||||
lazyRequire(this, "../net/url", "readURISync");
|
||||
|
||||
function safeGetFileLine(path, line) {
|
||||
try {
|
||||
|
|
|
@ -9,7 +9,7 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Ci } = require("chrome");
|
||||
const { open } = require("../event/dom");
|
||||
lazyRequire(this, "../event/dom", "open");
|
||||
const { observe } = require("../event/chrome");
|
||||
const { filter, merge, map, expand } = require("../event/utils");
|
||||
const { windows } = require("../window/utils");
|
||||
|
|
|
@ -8,9 +8,10 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Ci, Cc, Cu } = require("chrome");
|
||||
const core = require("../l10n/core");
|
||||
const { loadSheet, removeSheet } = require("../stylesheet/utils");
|
||||
lazyRequireModule(this, "../l10n/core", "core");
|
||||
lazyRequire(this, "../stylesheet/utils", "loadSheet", "removeSheet");
|
||||
const { process, frames } = require("../remote/child");
|
||||
|
||||
var observerService = Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(Ci.nsIObserverService);
|
||||
const { ShimWaiver } = Cu.import("resource://gre/modules/ShimWaiver.jsm");
|
||||
|
|
|
@ -7,26 +7,20 @@ module.metadata = {
|
|||
"stability": "stable"
|
||||
};
|
||||
|
||||
const { getAttachEventType } = require('../content/utils');
|
||||
lazyRequire(this, '../content/utils', 'getAttachEventType');
|
||||
const { Class } = require('../core/heritage');
|
||||
const { Disposable } = require('../core/disposable');
|
||||
const { WeakReference } = require('../core/reference');
|
||||
const { WorkerChild } = require('./worker-child');
|
||||
lazyRequire(this, './worker-child', 'WorkerChild');
|
||||
const { EventTarget } = require('../event/target');
|
||||
const { on, emit, once, setListeners } = require('../event/core');
|
||||
const { on: domOn, removeListener: domOff } = require('../dom/events');
|
||||
const { isRegExp, isUndefined } = require('../lang/type');
|
||||
const { merge } = require('../util/object');
|
||||
const { isBrowser, getFrames } = require('../window/utils');
|
||||
const { getTabs, getURI: getTabURI } = require('../tabs/utils');
|
||||
const { ignoreWindow } = require('../private-browsing/utils');
|
||||
const { Style } = require("../stylesheet/style");
|
||||
const { attach, detach } = require("../content/mod");
|
||||
const { has, hasAny } = require("../util/array");
|
||||
const { Rules } = require("../util/rules");
|
||||
const { List, addListItem, removeListItem } = require('../util/list');
|
||||
const { when } = require("../system/unload");
|
||||
const { uuid } = require('../util/uuid');
|
||||
lazyRequire(this, '../dom/events',{'on': 'domOn', 'removeListener': 'domOff'});
|
||||
lazyRequire(this, '../util/object', "merge");
|
||||
lazyRequire(this, '../window/utils', "getFrames");
|
||||
lazyRequire(this, '../private-browsing/utils', "ignoreWindow");
|
||||
lazyRequire(this, '../stylesheet/style', 'Style');
|
||||
lazyRequire(this, '../content/mod', 'attach', 'detach');
|
||||
lazyRequire(this, '../util/rules', 'Rules');
|
||||
lazyRequire(this, '../util/uuid', 'uuid');
|
||||
const { frames, process } = require('../remote/child');
|
||||
|
||||
const pagemods = new Map();
|
||||
|
@ -79,7 +73,7 @@ const ChildPageMod = Class({
|
|||
|
||||
// `applyOnExistingDocuments` has to be called after `pagemods.add()`
|
||||
// otherwise its calls to `onContent` method won't do anything.
|
||||
if (has(this.attachTo, 'existing'))
|
||||
if (this.attachTo.includes('existing'))
|
||||
applyOnExistingDocuments(this);
|
||||
},
|
||||
|
||||
|
@ -132,9 +126,9 @@ function applyOnExistingDocuments (mod) {
|
|||
if (!window || !window.frames)
|
||||
return;
|
||||
let uri = window.location.href;
|
||||
if (has(mod.attachTo, "top") && modMatchesURI(mod, uri))
|
||||
if (mod.attachTo.includes("top") && modMatchesURI(mod, uri))
|
||||
onContent(mod, window);
|
||||
if (has(mod.attachTo, "frame"))
|
||||
if (mod.attachTo.includes("frame"))
|
||||
getFrames(window).
|
||||
filter(iframe => modMatchesURI(mod, iframe.location.href)).
|
||||
forEach(frame => onContent(mod, frame));
|
||||
|
@ -167,10 +161,10 @@ function createWorker(mod, window) {
|
|||
function onContent (mod, window) {
|
||||
let isTopDocument = window.top === window;
|
||||
// Is a top level document and `top` is not set, ignore
|
||||
if (isTopDocument && !has(mod.attachTo, "top"))
|
||||
if (isTopDocument && !mod.attachTo.includes("top"))
|
||||
return;
|
||||
// Is a frame document and `frame` is not set, ignore
|
||||
if (!isTopDocument && !has(mod.attachTo, "frame"))
|
||||
if (!isTopDocument && !mod.attachTo.includes("frame"))
|
||||
return;
|
||||
|
||||
// ensure we attach only once per document
|
||||
|
|
|
@ -6,19 +6,21 @@
|
|||
const { frames } = require("../remote/child");
|
||||
const { Class } = require("../core/heritage");
|
||||
const { Disposable } = require('../core/disposable');
|
||||
const { data } = require("../self");
|
||||
const { once } = require("../dom/events");
|
||||
const { getAttachEventType } = require("./utils");
|
||||
const { Rules } = require('../util/rules');
|
||||
const { uuid } = require('../util/uuid');
|
||||
const { WorkerChild } = require("./worker-child");
|
||||
lazyRequire(this, "../self", "data");
|
||||
lazyRequire(this, "../dom/events", "once");
|
||||
lazyRequire(this, "./utils", "getAttachEventType");
|
||||
lazyRequire(this, '../util/rules', "Rules");
|
||||
lazyRequire(this, '../util/uuid', "uuid");
|
||||
lazyRequire(this, "./worker-child", "WorkerChild");
|
||||
const { Cc, Ci, Cu } = require("chrome");
|
||||
const { on: onSystemEvent } = require("../system/events");
|
||||
|
||||
const appShell = Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci.nsIAppShellService);
|
||||
|
||||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, 'appShell',
|
||||
"@mozilla.org/appshell/appShellService;1",
|
||||
"nsIAppShellService");
|
||||
|
||||
const pages = new Map();
|
||||
|
||||
const DOC_INSERTED = "document-element-inserted";
|
||||
|
|
|
@ -9,19 +9,22 @@ module.metadata = {
|
|||
|
||||
const { Class } = require('../core/heritage');
|
||||
const { EventTarget } = require('../event/target');
|
||||
const { on, off, emit } = require('../event/core');
|
||||
const { events } = require('./sandbox/events');
|
||||
const { requiresAddonGlobal } = require('./utils');
|
||||
const { delay: async } = require('../lang/functional');
|
||||
lazyRequire(this, '../event/core', "on", "off", "emit");
|
||||
lazyRequire(this, './sandbox/events', "events");
|
||||
lazyRequire(this, './utils', "requiresAddonGlobal");
|
||||
lazyRequire(this, '../lang/functional', {"delay": "async"});
|
||||
const { Ci, Cu, Cc } = require('chrome');
|
||||
const timer = require('../timers');
|
||||
const { URL } = require('../url');
|
||||
const { sandbox, evaluate, load } = require('../loader/sandbox');
|
||||
const { merge } = require('../util/object');
|
||||
const { getTabForContentWindowNoShim } = require('../tabs/utils');
|
||||
const { getInnerId } = require('../window/utils');
|
||||
const { PlainTextConsole } = require('../console/plain-text');
|
||||
const { data } = require('../self');const { isChildLoader } = require('../remote/core');
|
||||
lazyRequireModule(this, "../timers", "timer");
|
||||
lazyRequire(this, '../url', "URL");
|
||||
lazyRequire(this, '../loader/sandbox', "sandbox", "evaluate", "load");
|
||||
lazyRequire(this, '../util/object', "merge");
|
||||
lazyRequire(this, '../tabs/utils', "getTabForContentWindowNoShim");
|
||||
lazyRequire(this, '../window/utils', "getInnerId");
|
||||
lazyRequire(this, '../console/plain-text', "PlainTextConsole");
|
||||
|
||||
lazyRequire(this, '../self', "data");
|
||||
lazyRequire(this, '../remote/core', "isChildLoader");
|
||||
|
||||
// WeakMap of sandboxes so we can access private values
|
||||
const sandboxes = new WeakMap();
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ module.metadata = {
|
|||
'stability': 'unstable'
|
||||
};
|
||||
|
||||
var { merge } = require('../util/object');
|
||||
var { data } = require('../self');
|
||||
lazyRequire(this, '../util/object', "merge");
|
||||
lazyRequire(this, '../self', "data");
|
||||
var assetsURI = data.url();
|
||||
var isArray = Array.isArray;
|
||||
var method = require('../../method/core');
|
||||
var { uuid } = require('../util/uuid');
|
||||
lazyRequire(this, '../util/uuid', "uuid");
|
||||
|
||||
const isAddonContent = ({ contentURL }) =>
|
||||
contentURL && data.url(contentURL).startsWith(assetsURI);
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
'use strict';
|
||||
|
||||
const { merge } = require('../util/object');
|
||||
lazyRequire(this, '../util/object', 'merge');
|
||||
const { Class } = require('../core/heritage');
|
||||
const { emit } = require('../event/core');
|
||||
lazyRequire(this, '../event/core', 'emit');
|
||||
const { EventTarget } = require('../event/target');
|
||||
const { getInnerId, getByInnerId } = require('../window/utils');
|
||||
const { instanceOf, isObject } = require('../lang/type');
|
||||
const system = require('../system/events');
|
||||
lazyRequire(this, '../window/utils', 'getInnerId');
|
||||
lazyRequire(this, '../lang/type', 'instanceOf', 'isObject');
|
||||
lazyRequireModule(this, '../system/events', 'system');
|
||||
const { when } = require('../system/unload');
|
||||
const { WorkerSandbox } = require('./sandbox');
|
||||
lazyRequire(this, './sandbox', 'WorkerSandbox');
|
||||
const { Ci } = require('chrome');
|
||||
const { process, frames } = require('../remote/child');
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@ module.metadata = {
|
|||
"stability": "unstable"
|
||||
};
|
||||
|
||||
const { emit } = require('../event/core');
|
||||
lazyRequire(this, '../event/core', "emit");
|
||||
const { omit, merge } = require('../util/object');
|
||||
const { Class } = require('../core/heritage');
|
||||
const { method } = require('../lang/functional');
|
||||
const { getInnerId } = require('../window/utils');
|
||||
lazyRequire(this, '../window/utils', "getInnerId");
|
||||
const { EventTarget } = require('../event/target');
|
||||
const { isPrivate } = require('../private-browsing/utils');
|
||||
const { getTabForBrowser, getTabForContentWindowNoShim, getBrowserForTab } = require('../tabs/utils');
|
||||
const { attach, connect, detach, destroy, makeChildOptions } = require('./utils');
|
||||
lazyRequire(this, '../private-browsing/utils', "isPrivate");
|
||||
lazyRequire(this, '../tabs/utils', "getTabForBrowser", "getTabForContentWindowNoShim", "getBrowserForTab");
|
||||
lazyRequire(this, './utils', "attach", "connect", "detach", "destroy", "makeChildOptions");
|
||||
const { ensure } = require('../system/unload');
|
||||
const { on: observe } = require('../system/events');
|
||||
lazyRequire(this, '../system/events', {"on": "observe"});
|
||||
const { Ci, Cu } = require('chrome');
|
||||
const { modelFor: tabFor } = require('sdk/model/core');
|
||||
lazyRequire(this, 'sdk/model/core', {"modelFor": "tabFor"});
|
||||
const { remoteRequire, processes, frames } = require('../remote/parent');
|
||||
remoteRequire('sdk/content/worker-child');
|
||||
|
||||
|
|
|
@ -13,19 +13,18 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Class, mix } = require("./core/heritage");
|
||||
const { addCollectionProperty } = require("./util/collection");
|
||||
const { ns } = require("./core/namespace");
|
||||
const { validateOptions, getTypeOf } = require("./deprecated/api-utils");
|
||||
const { URL, isValidURI } = require("./url");
|
||||
const { WindowTracker, browserWindowIterator } = require("./deprecated/window-utils");
|
||||
const { isBrowser, getInnerId } = require("./window/utils");
|
||||
const { MatchPattern } = require("./util/match-pattern");
|
||||
lazyRequire(this, "./deprecated/api-utils", "validateOptions", "getTypeOf");
|
||||
lazyRequire(this, "./url", "URL", "isValidURI");
|
||||
lazyRequire(this, "./deprecated/window-utils", "WindowTracker", "browserWindowIterator");
|
||||
lazyRequire(this, "./window/utils", "isBrowser", "getInnerId");
|
||||
lazyRequire(this, "./util/match-pattern", "MatchPattern");
|
||||
const { EventTarget } = require("./event/target");
|
||||
const { emit } = require('./event/core');
|
||||
lazyRequire(this, './event/core', "emit");
|
||||
const { when } = require('./system/unload');
|
||||
const { contract: loaderContract } = require('./content/loader');
|
||||
const { omit } = require('./util/object');
|
||||
const self = require('./self')
|
||||
lazyRequireModule(this, './self', "self");
|
||||
const { remoteRequire, processes } = require('./remote/parent');
|
||||
remoteRequire('sdk/content/context-menu');
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { Class } = require("../core/heritage");
|
||||
const { extend } = require("../util/object");
|
||||
const { MatchPattern } = require("../util/match-pattern");
|
||||
lazyRequire(this, "../util/match-pattern", "MatchPattern");
|
||||
const readers = require("./readers");
|
||||
|
||||
// Context class is required to implement a single `isCurrent(target)` method
|
||||
|
|
|
@ -66,7 +66,7 @@ const ContextMenuExtension = Class({
|
|||
globalMessageManager.addMessageListener("sdk/context-menu/read", messageListener);
|
||||
globalMessageManager.addMessageListener("sdk/context-menu/readers?", messageListener);
|
||||
|
||||
preferencesService.addObserver(OVERFLOW_THRESH, this, false);
|
||||
preferencesService.addObserver(OVERFLOW_THRESH, this);
|
||||
},
|
||||
observe(_, __, name) {
|
||||
if (name === OVERFLOW_THRESH) {
|
||||
|
|
|
@ -10,8 +10,9 @@ module.metadata = {
|
|||
|
||||
const { Class } = require("./heritage");
|
||||
const { Observer, subscribe, unsubscribe, observe } = require("./observer");
|
||||
const { isWeak } = require("./reference");
|
||||
const SDKWeakSet = require("../lang/weak-set");
|
||||
|
||||
lazyRequire(this, "./reference", "isWeak");
|
||||
lazyRequireModule(this, "../lang/weak-set", "SDKWeakSet");
|
||||
|
||||
const method = require("../../method/core");
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ module.metadata = {
|
|||
|
||||
const { Cc, Ci, Cr, Cu } = require("chrome");
|
||||
const { Class } = require("./heritage");
|
||||
const { isWeak } = require("./reference");
|
||||
lazyRequire(this, "./reference", "isWeak");
|
||||
const method = require("../../method/core");
|
||||
|
||||
const observerService = Cc['@mozilla.org/observer-service;1'].
|
||||
|
|
|
@ -7,12 +7,12 @@ module.metadata = {
|
|||
"stability": "deprecated"
|
||||
};
|
||||
|
||||
const timer = require("../timers");
|
||||
lazyRequireModule(this, "../timers", "timer");
|
||||
const cfxArgs = require("../test/options");
|
||||
const { getTabs, closeTab, getURI, getTabId, getSelectedTab } = require("../tabs/utils");
|
||||
const { windows, isBrowser, getMostRecentBrowserWindow } = require("../window/utils");
|
||||
lazyRequire(this, "../tabs/utils", "getTabs", "closeTab", "getURI", "getTabId", "getSelectedTab");
|
||||
lazyRequire(this, "../window/utils", "windows", "isBrowser", "getMostRecentBrowserWindow");
|
||||
const { defer, all, Debugging: PromiseDebugging, resolve } = require("../core/promise");
|
||||
const { getInnerId } = require("../window/utils");
|
||||
lazyRequire(this, "../window/utils", "getInnerId");
|
||||
const { cleanUI } = require("../test/utils");
|
||||
|
||||
const findAndRunTests = function findAndRunTests(options) {
|
||||
|
|
|
@ -10,7 +10,7 @@ module.metadata = {
|
|||
|
||||
const { Ci } = require("chrome");
|
||||
|
||||
var { emit } = require("./core");
|
||||
lazyRequire(this, "./core", "emit");
|
||||
var { when: unload } = require("../system/unload");
|
||||
var listeners = new WeakMap();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module.metadata = {
|
|||
"stability": "unstable"
|
||||
};
|
||||
|
||||
var { emit, on, once, off, EVENT_TYPE_PATTERN } = require("./core");
|
||||
lazyRequire(this, "./core", "emit", "on", "once", "off", "EVENT_TYPE_PATTERN");
|
||||
const { Cu } = require("chrome");
|
||||
|
||||
// This module provides set of high order function for working with event
|
||||
|
|
|
@ -12,13 +12,13 @@ const { Cc, Ci } = require("chrome");
|
|||
const { Class } = require("../core/heritage");
|
||||
const { List, addListItem, removeListItem } = require("../util/list");
|
||||
const { EventTarget } = require("../event/target");
|
||||
const { emit } = require("../event/core");
|
||||
const { create: makeFrame } = require("./utils");
|
||||
const { defer } = require("../core/promise");
|
||||
lazyRequire(this, "../event/core", "emit");
|
||||
lazyRequire(this, "./utils", { "create": "makeFrame" });
|
||||
lazyRequire(this, "../core/promise", "defer");
|
||||
const { when: unload } = require("../system/unload");
|
||||
const { validateOptions, getTypeOf } = require("../deprecated/api-utils");
|
||||
const { window } = require("../addon/window");
|
||||
const { fromIterator } = require("../util/array");
|
||||
lazyRequire(this, "../deprecated/api-utils", "validateOptions", "getTypeOf");
|
||||
lazyRequire(this, "../addon/window", "window");
|
||||
lazyRequire(this, "../util/array", "fromIterator");
|
||||
|
||||
// This cache is used to access friend properties between functions
|
||||
// without exposing them on the public API.
|
||||
|
|
|
@ -18,8 +18,8 @@ module.metadata = {
|
|||
*/
|
||||
|
||||
const { Cu } = require('chrome');
|
||||
const { isNumber } = require('sdk/lang/type');
|
||||
const { TextEncoder, TextDecoder } = Cu.import('resource://gre/modules/commonjs/toolkit/loader.js', {});
|
||||
lazyRequire(this, 'sdk/lang/type', "isNumber");
|
||||
Cu.importGlobalProperties(["TextEncoder", "TextDecoder"]);
|
||||
|
||||
exports.TextEncoder = TextEncoder;
|
||||
exports.TextDecoder = TextDecoder;
|
||||
|
|
|
@ -9,8 +9,9 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const {Cc,Ci,Cr} = require("chrome");
|
||||
const byteStreams = require("./byte-streams");
|
||||
const textStreams = require("./text-streams");
|
||||
|
||||
lazyRequireModule(this, "./byte-streams", "byteStreams");
|
||||
lazyRequireModule(this, "./text-streams", "textStreams");
|
||||
|
||||
// Flags passed when opening a file. See nsprpub/pr/include/prio.h.
|
||||
const OPEN_FLAGS = {
|
||||
|
|
|
@ -9,10 +9,11 @@ module.metadata = {
|
|||
|
||||
const { Cc, Ci, CC } = require("chrome");
|
||||
|
||||
const { setTimeout } = require("../timers");
|
||||
const { Stream, InputStream, OutputStream } = require("./stream");
|
||||
const { emit, on } = require("../event/core");
|
||||
const { Buffer } = require("./buffer");
|
||||
lazyRequire(this, "../timers", "setTimeout");
|
||||
lazyRequire(this, "./stream", "Stream", "InputStream", "OutputStream");
|
||||
lazyRequire(this, "../event/core", "emit", "on");
|
||||
lazyRequire(this, "./buffer", "Buffer");
|
||||
|
||||
const { ns } = require("../core/namespace");
|
||||
const { Class } = require("../core/heritage");
|
||||
|
||||
|
|
|
@ -9,10 +9,11 @@ module.metadata = {
|
|||
|
||||
const { CC, Cc, Ci, Cu, Cr, components } = require("chrome");
|
||||
const { EventTarget } = require("../event/target");
|
||||
const { emit } = require("../event/core");
|
||||
const { Buffer } = require("./buffer");
|
||||
const { Class } = require("../core/heritage");
|
||||
const { setTimeout } = require("../timers");
|
||||
|
||||
lazyRequire(this, "../event/core", "emit");
|
||||
lazyRequire(this, "./buffer", "Buffer");
|
||||
lazyRequire(this, "../timers", "setTimeout");
|
||||
|
||||
|
||||
const MultiplexInputStream = CC("@mozilla.org/io/multiplex-input-stream;1",
|
||||
|
|
|
@ -7,14 +7,17 @@ module.metadata = {
|
|||
"stability": "stable"
|
||||
};
|
||||
|
||||
const json = require("./l10n/json/core");
|
||||
const { get: getKey } = require("./l10n/core");
|
||||
const properties = require("./l10n/properties/core");
|
||||
const { getRulesForLocale } = require("./l10n/plural-rules");
|
||||
lazyRequireModule(this, "./l10n/json/core", "json");
|
||||
lazyRequire(this, "./l10n/core", {"get": "getKey"});
|
||||
lazyRequireModule(this, "./l10n/properties/core", "properties");
|
||||
lazyRequire(this, "./l10n/plural-rules", "getRulesForLocale");
|
||||
|
||||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
// Retrieve the plural mapping function
|
||||
var pluralMappingFunction = getRulesForLocale(json.language()) ||
|
||||
getRulesForLocale("en");
|
||||
XPCOMUtils.defineLazyGetter(this, "pluralMappingFunction",
|
||||
() => getRulesForLocale(json.language()) ||
|
||||
getRulesForLocale("en"));
|
||||
|
||||
exports.get = function get(k) {
|
||||
// For now, we only accept a "string" as first argument
|
||||
|
|
|
@ -3,7 +3,13 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const json = require("./json/core");
|
||||
const properties = require("./properties/core");
|
||||
lazyRequireModule(this, "./json/core", "json");
|
||||
lazyRequireModule(this, "./properties/core", "properties");
|
||||
|
||||
exports.get = json.usingJSON ? json.get : properties.get;
|
||||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyGetter(this, "get",
|
||||
() => json.usingJSON ? json.get : properties.get);
|
||||
|
||||
module.exports = Object.freeze({
|
||||
get get() { return get; }, // ... yeah.
|
||||
});
|
||||
|
|
|
@ -8,9 +8,9 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const { getPreferedLocales, findClosestLocale } = require("./locale");
|
||||
const { readURI } = require("../net/url");
|
||||
const { resolve } = require("../core/promise");
|
||||
lazyRequire(this, "./locale", "getPreferedLocales", "findClosestLocale");
|
||||
lazyRequire(this, "../net/url", "readURI");
|
||||
lazyRequire(this, "../core/promise", "resolve");
|
||||
|
||||
function parseJsonURI(uri) {
|
||||
return readURI(uri).
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { on } = require("../system/events");
|
||||
const core = require("./core");
|
||||
lazyRequire(this, "../system/events", "on");
|
||||
lazyRequireModule(this, "./core", "core");
|
||||
const { id: jetpackId } = require('../self');
|
||||
|
||||
const OPTIONS_DISPLAYED = "addon-options-displayed";
|
||||
|
|
|
@ -4,14 +4,16 @@
|
|||
"use strict";
|
||||
|
||||
const { Cu } = require("chrome");
|
||||
const { newURI } = require('../../url/utils')
|
||||
const { getRulesForLocale } = require("../plural-rules");
|
||||
const { getPreferedLocales } = require('../locale');
|
||||
lazyRequire(this, '../../url/utils', 'newURI');
|
||||
lazyRequire(this, "../plural-rules", 'getRulesForLocale');
|
||||
lazyRequire(this, '../locale', 'getPreferedLocales');
|
||||
const { rootURI } = require("@loader/options");
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
const { Services } = require("resource://gre/modules/Services.jsm");
|
||||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const baseURI = rootURI + "locale/";
|
||||
const preferedLocales = getPreferedLocales(true);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "preferedLocales", () => getPreferedLocales(true));
|
||||
|
||||
// Make sure we don't get stale data after an update
|
||||
// (See Bug 1300735 for rationale).
|
||||
|
|
|
@ -13,7 +13,8 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { arity, name, derive, invoke } = require("./helpers");
|
||||
const { setTimeout, clearTimeout, setImmediate } = require("../../timers");
|
||||
|
||||
lazyRequire(this, "sdk/timers", "setTimeout", "clearTimeout", "setImmediate");
|
||||
|
||||
/**
|
||||
* Takes a function and returns a wrapped one instead, calling which will call
|
||||
|
|
|
@ -10,8 +10,7 @@ module.metadata = {
|
|||
|
||||
const { Ci, Cu, components } = require("chrome");
|
||||
|
||||
const { defer } = require("../core/promise");
|
||||
const { merge } = require("../util/object");
|
||||
lazyRequire(this, "../core/promise", "defer");
|
||||
|
||||
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
|
|
@ -12,13 +12,13 @@ const { contract } = require('./util/contract');
|
|||
const { WorkerHost, connect } = require('./content/utils');
|
||||
const { Class } = require('./core/heritage');
|
||||
const { Disposable } = require('./core/disposable');
|
||||
const { Worker } = require('./content/worker');
|
||||
lazyRequire(this, './content/worker', "Worker");
|
||||
const { EventTarget } = require('./event/target');
|
||||
const { on, emit, once, setListeners } = require('./event/core');
|
||||
const { isRegExp, isUndefined } = require('./lang/type');
|
||||
lazyRequire(this, './event/core', "on", "emit", "once", "setListeners");
|
||||
lazyRequire(this, './lang/type', "isRegExp", "isUndefined");
|
||||
const { merge, omit } = require('./util/object');
|
||||
const { remove, has, hasAny } = require("./util/array");
|
||||
const { Rules } = require("./util/rules");
|
||||
lazyRequire(this, "./util/array", "remove", "has", "hasAny");
|
||||
lazyRequire(this, "./util/rules", "Rules");
|
||||
const { processes, frames, remoteRequire } = require('./remote/parent');
|
||||
remoteRequire('sdk/content/page-mod');
|
||||
|
||||
|
|
|
@ -9,19 +9,19 @@ module.metadata = {
|
|||
|
||||
const { Class } = require('./core/heritage');
|
||||
const { ns } = require('./core/namespace');
|
||||
const { pipe, stripListeners } = require('./event/utils');
|
||||
lazyRequire(this, './event/utils', "pipe", "stripListeners");
|
||||
const { connect, destroy, WorkerHost } = require('./content/utils');
|
||||
const { Worker } = require('./content/worker');
|
||||
lazyRequire(this, './content/worker', "Worker");
|
||||
const { Disposable } = require('./core/disposable');
|
||||
const { EventTarget } = require('./event/target');
|
||||
const { setListeners } = require('./event/core');
|
||||
const { window } = require('./addon/window');
|
||||
const { create: makeFrame, getDocShell } = require('./frame/utils');
|
||||
lazyRequire(this, './event/core', "setListeners");
|
||||
lazyRequire(this, './addon/window', "window");
|
||||
lazyRequire(this, './frame/utils', { "create": "makeFrame" }, "getDocShell");
|
||||
const { contract } = require('./util/contract');
|
||||
const { contract: loaderContract } = require('./content/loader');
|
||||
const { Rules } = require('./util/rules');
|
||||
lazyRequire(this, './util/rules', "Rules");
|
||||
const { merge } = require('./util/object');
|
||||
const { uuid } = require('./util/uuid');
|
||||
lazyRequire(this, './util/uuid', "uuid");
|
||||
const { useRemoteProcesses, remoteRequire, frames } = require("./remote/parent");
|
||||
remoteRequire("sdk/content/page-worker");
|
||||
|
||||
|
|
|
@ -14,28 +14,27 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Cu, Ci } = require("chrome");
|
||||
const { setTimeout } = require('./timers');
|
||||
lazyRequire(this, './timers', "setTimeout");
|
||||
const { Class } = require("./core/heritage");
|
||||
const { merge } = require("./util/object");
|
||||
const { DefaultWeakMap, merge } = require("./util/object");
|
||||
const { WorkerHost } = require("./content/utils");
|
||||
const { Worker } = require("./deprecated/sync-worker");
|
||||
lazyRequire(this, "./deprecated/sync-worker", "Worker");
|
||||
const { Disposable } = require("./core/disposable");
|
||||
const { WeakReference } = require('./core/reference');
|
||||
const { contract: loaderContract } = require("./content/loader");
|
||||
const { contract } = require("./util/contract");
|
||||
const { on, off, emit, setListeners } = require("./event/core");
|
||||
lazyRequire(this, "./event/core", "on", "off", "emit", "setListeners");
|
||||
const { EventTarget } = require("./event/target");
|
||||
const domPanel = require("./panel/utils");
|
||||
const { getDocShell } = require('./frame/utils');
|
||||
lazyRequireModule(this, "./panel/utils", "domPanel");
|
||||
lazyRequire(this, './frame/utils', "getDocShell");
|
||||
const { events } = require("./panel/events");
|
||||
const systemEvents = require("./system/events");
|
||||
const { filter, pipe, stripListeners } = require("./event/utils");
|
||||
const { getNodeView, getActiveView } = require("./view/core");
|
||||
const { isNil, isObject, isNumber } = require("./lang/type");
|
||||
const { getAttachEventType } = require("./content/utils");
|
||||
lazyRequire(this, "./view/core", "getNodeView", "getActiveView");
|
||||
lazyRequire(this, "./lang/type", "isNil", "isObject", "isNumber");
|
||||
lazyRequire(this, "./content/utils", "getAttachEventType");
|
||||
const { number, boolean, object } = require('./deprecated/api-utils');
|
||||
const { Style } = require("./stylesheet/style");
|
||||
const { attach, detach } = require("./content/mod");
|
||||
lazyRequire(this, "./stylesheet/style", "Style");
|
||||
lazyRequire(this, "./content/mod", "attach", "detach");
|
||||
|
||||
var isRect = ({top, right, bottom, left}) => [top, right, bottom, left].
|
||||
some(value => isNumber(value) && !isNaN(value));
|
||||
|
@ -99,10 +98,36 @@ function isDisposed(panel) {
|
|||
return !views.has(panel);
|
||||
}
|
||||
|
||||
var optionsMap = new WeakMap();
|
||||
var panels = new WeakMap();
|
||||
var models = new WeakMap();
|
||||
var views = new WeakMap();
|
||||
var workers = new WeakMap();
|
||||
var views = new DefaultWeakMap(panel => {
|
||||
let model = models.get(panel);
|
||||
|
||||
// Setup view
|
||||
let viewOptions = {allowJavascript: !model.allow || (model.allow.script !== false)};
|
||||
let view = domPanel.make(null, viewOptions);
|
||||
panels.set(view, panel);
|
||||
|
||||
// Load panel content.
|
||||
domPanel.setURL(view, model.contentURL);
|
||||
|
||||
// Allow context menu
|
||||
domPanel.allowContextMenu(view, model.contextMenu);
|
||||
|
||||
return view;
|
||||
});
|
||||
var workers = new DefaultWeakMap(panel => {
|
||||
let options = optionsMap.get(panel);
|
||||
|
||||
let worker = new Worker(stripListeners(options));
|
||||
workers.set(panel, worker);
|
||||
|
||||
// pipe events from worker to a panel.
|
||||
pipe(worker, panel);
|
||||
|
||||
return worker;
|
||||
});
|
||||
var styles = new WeakMap();
|
||||
|
||||
const viewFor = (panel) => views.get(panel);
|
||||
|
@ -207,38 +232,22 @@ const Panel = Class({
|
|||
}));
|
||||
}
|
||||
|
||||
// Setup view
|
||||
let viewOptions = {allowJavascript: !model.allow || (model.allow.script !== false)};
|
||||
let view = domPanel.make(null, viewOptions);
|
||||
panels.set(view, this);
|
||||
views.set(this, view);
|
||||
|
||||
// Load panel content.
|
||||
domPanel.setURL(view, model.contentURL);
|
||||
|
||||
// Allow context menu
|
||||
domPanel.allowContextMenu(view, model.contextMenu);
|
||||
optionsMap.set(this, options);
|
||||
|
||||
// Setup listeners.
|
||||
setListeners(this, options);
|
||||
let worker = new Worker(stripListeners(options));
|
||||
workers.set(this, worker);
|
||||
|
||||
// pipe events from worker to a panel.
|
||||
pipe(worker, this);
|
||||
},
|
||||
dispose: function dispose() {
|
||||
this.hide();
|
||||
if (views.has(this))
|
||||
this.hide();
|
||||
off(this);
|
||||
|
||||
workerFor(this).destroy();
|
||||
detach(styleFor(this));
|
||||
|
||||
domPanel.dispose(viewFor(this));
|
||||
if (views.has(this))
|
||||
domPanel.dispose(viewFor(this));
|
||||
|
||||
// Release circular reference between view and panel instance. This
|
||||
// way view will be GC-ed. And panel as well once all the other refs
|
||||
// will be removed from it.
|
||||
views.delete(this);
|
||||
},
|
||||
/* Public API: Panel.width */
|
||||
|
@ -301,6 +310,7 @@ const Panel = Class({
|
|||
|
||||
/* Public API: Panel.show */
|
||||
show: function show(options={}, anchor) {
|
||||
let view = viewFor(this);
|
||||
SinglePanelManager.requestOpen(this, () => {
|
||||
if (options instanceof Ci.nsIDOMElement) {
|
||||
[anchor, options] = [options, null];
|
||||
|
@ -315,7 +325,6 @@ const Panel = Class({
|
|||
}
|
||||
|
||||
let model = modelFor(this);
|
||||
let view = viewFor(this);
|
||||
let anchorView = getNodeView(anchor || options.position || model.position);
|
||||
|
||||
options = merge({
|
||||
|
|
|
@ -12,7 +12,7 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const events = require("../system/events");
|
||||
const { emit } = require("../event/core");
|
||||
lazyRequire(this, "../event/core", "emit");
|
||||
|
||||
var channel = {};
|
||||
|
||||
|
|
|
@ -10,17 +10,17 @@ module.metadata = {
|
|||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const { Services } = require("resource://gre/modules/Services.jsm");
|
||||
const { setTimeout } = require("../timers");
|
||||
const { platform } = require("../system");
|
||||
const { getMostRecentBrowserWindow, getOwnerBrowserWindow,
|
||||
getScreenPixelsPerCSSPixel } = require("../window/utils");
|
||||
lazyRequire(this, "../timers", "setTimeout");
|
||||
lazyRequire(this, "../system", "platform");
|
||||
lazyRequire(this, "../window/utils", "getMostRecentBrowserWindow", "getOwnerBrowserWindow",
|
||||
"getScreenPixelsPerCSSPixel");
|
||||
|
||||
const { create: createFrame, swapFrameLoaders, getDocShell } = require("../frame/utils");
|
||||
const { window: addonWindow } = require("../addon/window");
|
||||
const { isNil } = require("../lang/type");
|
||||
const { data } = require('../self');
|
||||
lazyRequire(this, "../frame/utils", { "create": "createFrame" }, "swapFrameLoaders", "getDocShell");
|
||||
lazyRequire(this, "../addon/window", { "window": "addonWindow" });
|
||||
lazyRequire(this, "../lang/type", "isNil");
|
||||
lazyRequire(this, '../self', "data");
|
||||
|
||||
const events = require("../system/events");
|
||||
lazyRequireModule(this, "../system/events", "events");
|
||||
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
|
|
@ -129,10 +129,10 @@ historyObserver.onVisit = function(url, visitId, time, sessionId,
|
|||
}
|
||||
this.realOnVisit(url, visitId, time, sessionId, referringId, transitionType);
|
||||
};
|
||||
historyService.addObserver(historyObserver, false);
|
||||
historyService.addObserver(historyObserver);
|
||||
|
||||
var bookmarkObserver = createObserverInstance(BOOKMARK_EVENTS, BOOKMARK_ARGS);
|
||||
bookmarkService.addObserver(bookmarkObserver, false);
|
||||
bookmarkService.addObserver(bookmarkObserver);
|
||||
|
||||
when(() => {
|
||||
historyService.removeObserver(historyObserver);
|
||||
|
|
|
@ -12,9 +12,9 @@ const { Cc, Ci, Cr, Cm, components: { classesByID } } = require('chrome');
|
|||
const { registerFactory, unregisterFactory, isCIDRegistered } =
|
||||
Cm.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
|
||||
const { merge } = require('../util/object');
|
||||
const { Class, extend, mix } = require('../core/heritage');
|
||||
const { uuid } = require('../util/uuid');
|
||||
lazyRequire(this, '../util/object', 'merge');
|
||||
lazyRequire(this, '../util/uuid', 'uuid');
|
||||
|
||||
// This is a base prototype, that provides bare bones of XPCOM. JS based
|
||||
// components can be easily implement by extending it.
|
||||
|
|
|
@ -34,7 +34,7 @@ const PrefsTarget = Class({
|
|||
|
||||
// start listening to preference changes
|
||||
let observer = prefTargetNS(this).observer = onChange.bind(this);
|
||||
branch.addObserver('', observer, false);
|
||||
branch.addObserver('', observer);
|
||||
|
||||
// Make sure to destroy this on unload
|
||||
unload(destroy.bind(this));
|
||||
|
|
|
@ -8,12 +8,13 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Cc, Ci, Cu } = require('chrome');
|
||||
const { on } = require('../system/events');
|
||||
const { id, preferencesBranch } = require('../self');
|
||||
const { localizeInlineOptions } = require('../l10n/prefs');
|
||||
const { Services } = require("resource://gre/modules/Services.jsm");
|
||||
const { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
const { defer } = require("sdk/core/promise");
|
||||
lazyRequire(this, '../system/events', "on");
|
||||
lazyRequire(this, '../self', "preferencesBranch");
|
||||
lazyRequire(this, '../l10n/prefs', "localizeInlineOptions");
|
||||
|
||||
lazyRequire(this, "resource://gre/modules/Services.jsm", "Services");
|
||||
lazyRequire(this, "resource://gre/modules/AddonManager.jsm", "AddonManager");
|
||||
lazyRequire(this, "resource://gre/modules/Preferences.jsm", "Preferences");
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";;
|
||||
const DEFAULT_OPTIONS_URL = 'data:text/xml,<placeholder/>';
|
||||
|
@ -24,48 +25,46 @@ const VALID_PREF_TYPES = ['bool', 'boolint', 'integer', 'string', 'color',
|
|||
const isFennec = require("sdk/system/xul-app").is("Fennec");
|
||||
|
||||
function enable({ preferences, id }) {
|
||||
let enabled = defer();
|
||||
return new Promise(resolve => {
|
||||
validate(preferences);
|
||||
|
||||
validate(preferences);
|
||||
setDefaults(preferences, preferencesBranch);
|
||||
|
||||
setDefaults(preferences, preferencesBranch);
|
||||
// allow the use of custom options.xul
|
||||
AddonManager.getAddonByID(id, (addon) => {
|
||||
on('addon-options-displayed', onAddonOptionsDisplayed, true);
|
||||
resolve({ id });
|
||||
});
|
||||
|
||||
// allow the use of custom options.xul
|
||||
AddonManager.getAddonByID(id, (addon) => {
|
||||
on('addon-options-displayed', onAddonOptionsDisplayed, true);
|
||||
enabled.resolve({ id: id });
|
||||
});
|
||||
function onAddonOptionsDisplayed({ subject: doc, data }) {
|
||||
if (data === id) {
|
||||
let parent;
|
||||
|
||||
function onAddonOptionsDisplayed({ subject: doc, data }) {
|
||||
if (data === id) {
|
||||
let parent;
|
||||
if (isFennec) {
|
||||
parent = doc.querySelector('.options-box');
|
||||
|
||||
if (isFennec) {
|
||||
parent = doc.querySelector('.options-box');
|
||||
// NOTE: This disable the CSS rule that makes the options invisible
|
||||
let item = doc.querySelector('#addons-details .addon-item');
|
||||
item.removeAttribute("optionsURL");
|
||||
} else {
|
||||
parent = doc.getElementById('detail-downloads').parentNode;
|
||||
}
|
||||
|
||||
// NOTE: This disable the CSS rule that makes the options invisible
|
||||
let item = doc.querySelector('#addons-details .addon-item');
|
||||
item.removeAttribute("optionsURL");
|
||||
} else {
|
||||
parent = doc.getElementById('detail-downloads').parentNode;
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
injectOptions({
|
||||
preferences: preferences,
|
||||
preferencesBranch: preferencesBranch,
|
||||
document: doc,
|
||||
parent: parent,
|
||||
id: id
|
||||
});
|
||||
localizeInlineOptions(doc);
|
||||
} else {
|
||||
throw Error("Preferences parent node not found in Addon Details. The configured custom preferences will not be visible.");
|
||||
if (parent) {
|
||||
injectOptions({
|
||||
preferences: preferences,
|
||||
preferencesBranch: preferencesBranch,
|
||||
document: doc,
|
||||
parent: parent,
|
||||
id: id
|
||||
});
|
||||
localizeInlineOptions(doc);
|
||||
} else {
|
||||
throw Error("Preferences parent node not found in Addon Details. The configured custom preferences will not be visible.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return enabled.promise;
|
||||
});
|
||||
}
|
||||
exports.enable = enable;
|
||||
|
||||
|
@ -103,28 +102,14 @@ exports.validate = validate;
|
|||
|
||||
// initializes default preferences, emulates defaults/prefs.js
|
||||
function setDefaults(preferences, preferencesBranch) {
|
||||
const branch = Cc['@mozilla.org/preferences-service;1'].
|
||||
getService(Ci.nsIPrefService).
|
||||
getDefaultBranch('extensions.' + preferencesBranch + '.');
|
||||
for (let { name, value } of preferences) {
|
||||
switch (typeof value) {
|
||||
case 'boolean':
|
||||
branch.setBoolPref(name, value);
|
||||
break;
|
||||
case 'number':
|
||||
// must be integer, ignore otherwise
|
||||
if (value % 1 === 0) {
|
||||
branch.setIntPref(name, value);
|
||||
}
|
||||
break;
|
||||
case 'string':
|
||||
let str = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
str.data = value;
|
||||
branch.setComplexValue(name, Ci.nsISupportsString, str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
let prefs = new Preferences({
|
||||
branch: `extensions.${preferencesBranch}.`,
|
||||
defaultBranch: true,
|
||||
});
|
||||
|
||||
for (let { name, value } of preferences)
|
||||
if (value !== undefined)
|
||||
prefs.set(name, value);
|
||||
}
|
||||
exports.setDefaults = setDefaults;
|
||||
|
||||
|
|
|
@ -9,10 +9,11 @@ module.metadata = {
|
|||
|
||||
const { Cc, Ci, Cu } = require('chrome');
|
||||
const { is } = require('../system/xul-app');
|
||||
const { isWindowPrivate } = require('../window/utils');
|
||||
const { isPrivateBrowsingSupported } = require('../self');
|
||||
const { dispatcher } = require("../util/dispatcher");
|
||||
|
||||
lazyRequire(this, '../window/utils', "isWindowPrivate");
|
||||
lazyRequire(this, '../self', "isPrivateBrowsingSupported");
|
||||
|
||||
var PrivateBrowsingUtils;
|
||||
|
||||
// Private browsing is only supported in Fx
|
||||
|
|
|
@ -27,7 +27,8 @@ const system = require('../system/events');
|
|||
const { EventParent } = require('./utils');
|
||||
const options = require('@loader/options');
|
||||
const loaderModule = require('toolkit/loader');
|
||||
const { getTabForBrowser } = require('../tabs/utils');
|
||||
|
||||
lazyRequire(this, '../tabs/utils', "getTabForBrowser");
|
||||
|
||||
const appInfo = Cc["@mozilla.org/xre/app-info;1"].
|
||||
getService(Ci.nsIXULRuntime);
|
||||
|
@ -42,10 +43,6 @@ if (options.isNative) {
|
|||
else {
|
||||
moduleResolve = loaderModule.resolve;
|
||||
}
|
||||
// Build the sorted path mapping structure that resolveURI requires
|
||||
var pathMapping = Object.keys(options.paths)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.map(p => [p, options.paths[p]]);
|
||||
|
||||
// Load the scripts in the child processes
|
||||
var { getNewLoaderID } = require('../../framescript/FrameScriptManager.jsm');
|
||||
|
@ -326,13 +323,12 @@ function remoteRequire(id, module = null) {
|
|||
// Resolve relative to calling module if passed
|
||||
if (module)
|
||||
id = moduleResolve(id, module.id);
|
||||
let uri = loaderModule.resolveURI(id, pathMapping);
|
||||
|
||||
// Don't reload the same module
|
||||
if (remoteModules.has(uri))
|
||||
if (remoteModules.has(id))
|
||||
return;
|
||||
|
||||
remoteModules.add(uri);
|
||||
processes.port.emit('sdk/remote/require', uri);
|
||||
remoteModules.add(id);
|
||||
processes.port.emit('sdk/remote/require', id);
|
||||
}
|
||||
exports.remoteRequire = remoteRequire;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
const { Class } = require('../core/heritage');
|
||||
const { List, addListItem, removeListItem } = require('../util/list');
|
||||
const { emit } = require('../event/core');
|
||||
const { pipe } = require('../event/utils');
|
||||
lazyRequire(this, '../event/core', 'emit');
|
||||
lazyRequire(this, '../event/utils', 'pipe');
|
||||
|
||||
// A helper class that maintains a list of EventTargets. Any events emitted
|
||||
// to an EventTarget are also emitted by the EventParent. Likewise for an
|
||||
|
|
|
@ -12,18 +12,17 @@ module.metadata = {
|
|||
}
|
||||
};
|
||||
|
||||
const { Ci, Cc } = require("chrome"),
|
||||
{ setTimeout } = require("./timers"),
|
||||
{ emit, off } = require("./event/core"),
|
||||
{ Class, obscure } = require("./core/heritage"),
|
||||
{ EventTarget } = require("./event/target"),
|
||||
{ ns } = require("./core/namespace"),
|
||||
{ when: unload } = require("./system/unload"),
|
||||
{ ignoreWindow } = require('./private-browsing/utils'),
|
||||
{ getTabs, getTabForContentWindow,
|
||||
getAllTabContentWindows } = require('./tabs/utils'),
|
||||
winUtils = require("./window/utils"),
|
||||
events = require("./system/events");
|
||||
const { Ci, Cc } = require("chrome");
|
||||
lazyRequire(this, "./timers", "setTimeout");
|
||||
lazyRequire(this, "./event/core", "emit", "off");
|
||||
const { Class, obscure } = require("./core/heritage");
|
||||
const { EventTarget } = require("./event/target");
|
||||
const { ns } = require("./core/namespace");
|
||||
const { when: unload } = require("./system/unload");
|
||||
lazyRequire(this, './private-browsing/utils', "ignoreWindow");
|
||||
lazyRequire(this, './tabs/utils', "getTabs", "getTabForContentWindow", "getAllTabContentWindows");
|
||||
lazyRequireModule(this, "./window/utils", "winUtils");
|
||||
const events = require("./system/events");
|
||||
|
||||
// The selection types
|
||||
const HTML = 0x01,
|
||||
|
|
|
@ -11,7 +11,7 @@ const { CC } = require('chrome');
|
|||
const options = require('@loader/options');
|
||||
|
||||
const { get } = require("./preferences/service");
|
||||
const { readURISync } = require('./net/url');
|
||||
lazyRequire(this, './net/url', "readURISync");
|
||||
|
||||
const id = options.id;
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const file = require("./io/file");
|
||||
const prefs = require("./preferences/service");
|
||||
const jpSelf = require("./self");
|
||||
const timer = require("./timers");
|
||||
lazyRequireModule(this, "./timers", "timer");
|
||||
lazyRequireModule(this, "./io/file", "file");
|
||||
lazyRequireModule(this, "./preferences/service", "prefs");
|
||||
const unload = require("./system/unload");
|
||||
const { emit, on, off } = require("./event/core");
|
||||
lazyRequire(this, "./event/core", "emit", "on", "off");
|
||||
|
||||
const WRITE_PERIOD_PREF = "extensions.addon-sdk.simple-storage.writePeriod";
|
||||
const WRITE_PERIOD_DEFAULT = 300000; // 5 minutes
|
||||
|
|
|
@ -7,14 +7,12 @@ module.metadata = {
|
|||
"stability": "experimental"
|
||||
};
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const { Class } = require("../core/heritage");
|
||||
const { URL, isLocalURL } = require('../url');
|
||||
const events = require("../system/events");
|
||||
const { loadSheet, removeSheet, isTypeValid } = require("./utils");
|
||||
const { isString } = require("../lang/type");
|
||||
lazyRequire(this, "../url", "isLocalURL");
|
||||
lazyRequire(this, "./utils", "loadSheet", "removeSheet", "isTypeValid");
|
||||
lazyRequire(this, "../lang/type", "isString");
|
||||
const { attachTo, detachFrom } = require("../content/mod");
|
||||
const { data } = require('../self');
|
||||
lazyRequire(this, '../self', "data");
|
||||
|
||||
const { freeze, create } = Object;
|
||||
|
||||
|
|
|
@ -12,12 +12,17 @@ const options = require('@loader/options');
|
|||
const runtime = require("./system/runtime");
|
||||
const { when: unload } = require("./system/unload");
|
||||
|
||||
const appStartup = Cc['@mozilla.org/toolkit/app-startup;1'].
|
||||
getService(Ci.nsIAppStartup);
|
||||
const { XPCOMUtils } = require('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, 'appStartup',
|
||||
'@mozilla.org/toolkit/app-startup;1',
|
||||
'nsIAppStartup');
|
||||
XPCOMUtils.defineLazyServiceGetter(this, 'directoryService',
|
||||
'@mozilla.org/file/directory_service;1',
|
||||
'nsIProperties');
|
||||
|
||||
const appInfo = Cc["@mozilla.org/xre/app-info;1"].
|
||||
getService(Ci.nsIXULAppInfo);
|
||||
const directoryService = Cc['@mozilla.org/file/directory_service;1'].
|
||||
getService(Ci.nsIProperties);
|
||||
|
||||
const PR_WRONLY = parseInt("0x02");
|
||||
const PR_CREATE_FILE = parseInt("0x08");
|
||||
|
@ -34,8 +39,6 @@ function openFile(path, mode) {
|
|||
return stream
|
||||
}
|
||||
|
||||
const { eAttemptQuit: E_ATTEMPT, eForceQuit: E_FORCE } = appStartup;
|
||||
|
||||
/**
|
||||
* Parsed JSON object that was passed via `cfx --static-args "{ foo: 'bar' }"`
|
||||
*/
|
||||
|
@ -86,7 +89,7 @@ exports.exit = function exit(code) {
|
|||
}
|
||||
|
||||
unloader();
|
||||
appStartup.quit(code ? E_ATTEMPT : E_FORCE);
|
||||
appStartup.quit(code ? appStartup.eAttemptQuit : appStartup.eForceQuit);
|
||||
};
|
||||
|
||||
// Adapter for nodejs's stdout & stderr:
|
||||
|
|
|
@ -163,19 +163,21 @@ on('sdk:loader:destroy', function onunload({ subject, data: reason }) {
|
|||
off('sdk:loader:destroy', onunload, false);
|
||||
|
||||
// don't bother
|
||||
if (reason === 'shutdown')
|
||||
if (reason === 'shutdown')
|
||||
return;
|
||||
|
||||
stillAlive.forEach( (type, ref) => {
|
||||
let observer = ref.get();
|
||||
if (observer) {
|
||||
if (wasShimmed.get(ref)) {
|
||||
removeObserver(observer, type);
|
||||
} else {
|
||||
removeObserverNoShim(observer, type);
|
||||
// Wait until the next tick to let other shutdown handlers finish first.
|
||||
Promise.resolve().then(() => {
|
||||
stillAlive.forEach((type, ref) => {
|
||||
let observer = ref.get();
|
||||
if (observer) {
|
||||
if (wasShimmed.get(ref)) {
|
||||
removeObserver(observer, type);
|
||||
} else {
|
||||
removeObserverNoShim(observer, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
// a strong reference
|
||||
}, true, false);
|
||||
|
|
|
@ -8,39 +8,42 @@ module.metadata = {
|
|||
"stability": "unstable"
|
||||
};
|
||||
|
||||
var { Cc, Ci, CC } = require('chrome');
|
||||
var { PlainTextConsole } = require('../console/plain-text');
|
||||
var { stdout } = require('../system');
|
||||
var ScriptError = CC('@mozilla.org/scripterror;1', 'nsIScriptError');
|
||||
var consoleService = Cc['@mozilla.org/consoleservice;1'].getService(Ci.nsIConsoleService);
|
||||
defineLazyGetter(this, "console", () => new (require('../console/plain-text').PlainTextConsole)());
|
||||
|
||||
// On windows dump does not writes into stdout so cfx can't read thous dumps.
|
||||
// To workaround this issue we write to a special file from which cfx will
|
||||
// read and print to the console.
|
||||
// For more details see: bug-673383
|
||||
exports.dump = stdout.write;
|
||||
exports = module.exports = {};
|
||||
|
||||
exports.console = new PlainTextConsole();
|
||||
defineLazyGetter(exports, "console", () => console);
|
||||
|
||||
// Provide CommonJS `define` to allow authoring modules in a format that can be
|
||||
// loaded both into jetpack and into browser via AMD loaders.
|
||||
Object.defineProperty(exports, 'define', {
|
||||
// `define` is provided as a lazy getter that binds below defined `define`
|
||||
// function to the module scope, so that require, exports and module
|
||||
// variables remain accessible.
|
||||
configurable: true,
|
||||
get: function() {
|
||||
let sandbox = this;
|
||||
return function define(factory) {
|
||||
factory = Array.slice(arguments).pop();
|
||||
factory.call(sandbox, sandbox.require, sandbox.exports, sandbox.module);
|
||||
}
|
||||
},
|
||||
set: function(value) {
|
||||
Object.defineProperty(this, 'define', {
|
||||
|
||||
// `define` is provided as a lazy getter that binds below defined `define`
|
||||
// function to the module scope, so that require, exports and module
|
||||
// variables remain accessible.
|
||||
defineLazyGetter(exports, 'define', function() {
|
||||
return (...args) => {
|
||||
let factory = args.pop();
|
||||
factory.call(this, this.require, this.exports, this.module);
|
||||
};
|
||||
});
|
||||
|
||||
function defineLazyGetter(object, prop, getter) {
|
||||
let redefine = (obj, value) => {
|
||||
Object.defineProperty(obj, prop, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value,
|
||||
});
|
||||
},
|
||||
});
|
||||
return value;
|
||||
};
|
||||
|
||||
Object.defineProperty(object, prop, {
|
||||
configurable: true,
|
||||
get() {
|
||||
return redefine(this, getter.call(this));
|
||||
},
|
||||
set(value) {
|
||||
redefine(this, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ module.metadata = {
|
|||
// NOTE: This file should only export Tab instances
|
||||
|
||||
|
||||
const { getTabForBrowser: getRawTabForBrowser } = require('./utils');
|
||||
lazyRequire(this, './utils', { "getTabForBrowser": "getRawTabForBrowser" });
|
||||
const { modelFor } = require('../model/core');
|
||||
|
||||
exports.getTabForRawTab = modelFor;
|
||||
|
|
|
@ -8,8 +8,8 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { getTargetWindow } = require("../content/mod");
|
||||
const { getTabContentWindow, isTab } = require("./utils");
|
||||
const { viewFor } = require("../view/core");
|
||||
lazyRequire(this, "./utils", "getTabContentWindow", "isTab");
|
||||
lazyRequire(this, "../view/core", "viewFor");
|
||||
|
||||
if (require('../system/xul-app').name == 'Fennec') {
|
||||
module.exports = require('./tab-fennec');
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
const { Class } = require('../core/heritage');
|
||||
const { Tab, tabEvents } = require('./tab');
|
||||
const { EventTarget } = require('../event/target');
|
||||
const { emit, setListeners } = require('../event/core');
|
||||
lazyRequire(this, '../event/core', "emit", "setListeners");
|
||||
const { pipe } = require('../event/utils');
|
||||
const { observer: windowObserver } = require('../windows/observer');
|
||||
const { List, addListItem, removeListItem } = require('../util/list');
|
||||
const { modelFor } = require('../model/core');
|
||||
const { viewFor } = require('../view/core');
|
||||
const { getTabs, getSelectedTab } = require('./utils');
|
||||
const { getMostRecentBrowserWindow, isBrowser } = require('../window/utils');
|
||||
const { Options } = require('./common');
|
||||
const { isPrivate } = require('../private-browsing');
|
||||
const { ignoreWindow, isWindowPBSupported } = require('../private-browsing/utils')
|
||||
lazyRequire(this, '../model/core', "modelFor");
|
||||
lazyRequire(this, '../view/core', "viewFor");
|
||||
lazyRequire(this, './utils', "getTabs", "getSelectedTab");
|
||||
lazyRequire(this, '../window/utils', "getMostRecentBrowserWindow", "isBrowser");
|
||||
lazyRequire(this, './common', "Options");
|
||||
lazyRequire(this, '../private-browsing', "isPrivate");
|
||||
lazyRequire(this, '../private-browsing/utils', "ignoreWindow", "isWindowPBSupported")
|
||||
const { isPrivateBrowsingSupported } = require('sdk/self');
|
||||
|
||||
const supportPrivateTabs = isPrivateBrowsingSupported && isWindowPBSupported;
|
||||
|
|
|
@ -12,9 +12,9 @@ module.metadata = {
|
|||
|
||||
|
||||
const { Ci, Cu } = require('chrome');
|
||||
const { defer } = require("../lang/functional");
|
||||
const { windows, isBrowser } = require('../window/utils');
|
||||
const { isPrivateBrowsingSupported } = require('../self');
|
||||
lazyRequire(this, "../lang/functional", "defer");
|
||||
lazyRequire(this, '../window/utils', "windows", "isBrowser");
|
||||
lazyRequire(this, '../self', "isPrivateBrowsingSupported");
|
||||
const { ShimWaiver } = Cu.import("resource://gre/modules/ShimWaiver.jsm");
|
||||
|
||||
// Bug 834961: ignore private windows when they are not supported
|
||||
|
|
|
@ -13,7 +13,7 @@ const { serializeStack, parseStack } = require("toolkit/loader");
|
|||
const { setTimeout } = require('../timers');
|
||||
const { PlainTextConsole } = require("../console/plain-text");
|
||||
const { when: unload } = require("../system/unload");
|
||||
const { format, fromException } = require("../console/traceback");
|
||||
lazyRequire(this, "../console/traceback", "format", "fromException");
|
||||
const system = require("../system");
|
||||
const { gc: gcPromise } = require('./memory');
|
||||
const { defer } = require('../core/promise');
|
||||
|
|
|
@ -7,13 +7,13 @@ module.metadata = {
|
|||
'stability': 'unstable'
|
||||
};
|
||||
|
||||
const { defer } = require('../core/promise');
|
||||
const { setInterval, clearInterval } = require('../timers');
|
||||
const { getTabs, closeTab } = require("../tabs/utils");
|
||||
const { windows: getWindows } = require("../window/utils");
|
||||
const { close: closeWindow } = require("../window/helpers");
|
||||
const { isGenerator } = require("../lang/type");
|
||||
const { env } = require("../system/environment");
|
||||
lazyRequire(this, '../core/promise', "defer");
|
||||
lazyRequire(this, '../timers', "setInterval", "clearInterval");
|
||||
lazyRequire(this, "../tabs/utils", "getTabs", "closeTab");
|
||||
lazyRequire(this, "../window/utils", {"windows": "getWindows"});
|
||||
lazyRequire(this, "../window/helpers", {"close": "closeWindow"});
|
||||
lazyRequire(this, "../lang/type", "isGenerator");
|
||||
lazyRequire(this, "../system/environment", "env");
|
||||
const { Task } = require("resource://gre/modules/Task.jsm");
|
||||
|
||||
const getTestNames = (exports) =>
|
||||
|
|
|
@ -80,8 +80,7 @@ function setImmediate(callback, ...params) {
|
|||
// if dispatch loop is not scheduled schedule one. Own scheduler
|
||||
if (!dispatcher.scheduled) {
|
||||
dispatcher.scheduled = true;
|
||||
threadManager.currentThread.dispatch(dispatcher,
|
||||
Ci.nsIThread.DISPATCH_NORMAL);
|
||||
threadManager.dispatchToMainThread(dispatcher);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,16 @@ module.metadata = {
|
|||
}
|
||||
};
|
||||
|
||||
exports.ActionButton = require('./ui/button/action').ActionButton;
|
||||
exports.ToggleButton = require('./ui/button/toggle').ToggleButton;
|
||||
exports.Sidebar = require('./ui/sidebar').Sidebar;
|
||||
exports.Frame = require('./ui/frame').Frame;
|
||||
exports.Toolbar = require('./ui/toolbar').Toolbar;
|
||||
lazyRequire(this, './ui/button/action', 'ActionButton');
|
||||
lazyRequire(this, './ui/button/toggle', 'ToggleButton');
|
||||
lazyRequire(this, './ui/sidebar', 'Sidebar');
|
||||
lazyRequire(this, './ui/frame', 'Frame');
|
||||
lazyRequire(this, './ui/toolbar', 'Toolbar');
|
||||
|
||||
module.exports = Object.freeze({
|
||||
get ActionButton() { return ActionButton; },
|
||||
get ToggleButton() { return ToggleButton; },
|
||||
get Sidebar() { return Sidebar; },
|
||||
get Frame() { return Frame; },
|
||||
get Toolbar() { return Toolbar; },
|
||||
});
|
||||
|
|
|
@ -13,22 +13,22 @@ module.metadata = {
|
|||
const { Class } = require('../../core/heritage');
|
||||
const { merge } = require('../../util/object');
|
||||
const { Disposable } = require('../../core/disposable');
|
||||
const { on, off, emit, setListeners } = require('../../event/core');
|
||||
lazyRequire(this, '../../event/core', "on", "off", "emit", "setListeners");
|
||||
const { EventTarget } = require('../../event/target');
|
||||
const { getNodeView } = require('../../view/core');
|
||||
lazyRequire(this, '../../view/core', "getNodeView");
|
||||
|
||||
const view = require('./view');
|
||||
lazyRequireModule(this, './view', "view");
|
||||
const { buttonContract, stateContract } = require('./contract');
|
||||
const { properties, render, state, register, unregister,
|
||||
getDerivedStateFor } = require('../state');
|
||||
const { events: stateEvents } = require('../state/events');
|
||||
const { events: viewEvents } = require('./view/events');
|
||||
const events = require('../../event/utils');
|
||||
lazyRequire(this, '../state', "properties", "render", "state", "register",
|
||||
"unregister", "getDerivedStateFor");
|
||||
lazyRequire(this, '../state/events', { "events": "stateEvents" });
|
||||
lazyRequire(this, './view/events', { "events": "viewEvents" });
|
||||
lazyRequireModule(this, '../../event/utils', "events");
|
||||
|
||||
const { getActiveTab } = require('../../tabs/utils');
|
||||
lazyRequire(this, '../../tabs/utils', "getActiveTab");
|
||||
|
||||
const { id: addonID } = require('../../self');
|
||||
const { identify } = require('../id');
|
||||
lazyRequire(this, '../../self', { "id": "addonID" });
|
||||
lazyRequire(this, '../id', "identify");
|
||||
|
||||
const buttons = new Map();
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
'use strict';
|
||||
|
||||
const { contract } = require('../../util/contract');
|
||||
const { isLocalURL } = require('../../url');
|
||||
const { isNil, isObject, isString } = require('../../lang/type');
|
||||
lazyRequire(this, '../../url', "isLocalURL");
|
||||
lazyRequire(this, '../../lang/type', "isNil", "isObject", "isString");
|
||||
const { required, either, string, boolean, object, number } = require('../../deprecated/api-utils');
|
||||
const { merge } = require('../../util/object');
|
||||
const { freeze } = Object;
|
||||
|
|
|
@ -11,24 +11,24 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Class } = require('../../core/heritage');
|
||||
const { merge } = require('../../util/object');
|
||||
lazyRequire(this, '../../util/object', "merge");
|
||||
const { Disposable } = require('../../core/disposable');
|
||||
const { on, off, emit, setListeners } = require('../../event/core');
|
||||
lazyRequire(this, '../../event/core', "on", "off", "emit", "setListeners");
|
||||
const { EventTarget } = require('../../event/target');
|
||||
const { getNodeView } = require('../../view/core');
|
||||
lazyRequire(this, '../../view/core', "getNodeView");
|
||||
|
||||
const view = require('./view');
|
||||
lazyRequireModule(this, "./view", "view");
|
||||
const { toggleButtonContract, toggleStateContract } = require('./contract');
|
||||
const { properties, render, state, register, unregister,
|
||||
setStateFor, getStateFor, getDerivedStateFor } = require('../state');
|
||||
const { events: stateEvents } = require('../state/events');
|
||||
const { events: viewEvents } = require('./view/events');
|
||||
const events = require('../../event/utils');
|
||||
lazyRequire(this, '../state', "properties", "render", "state", "register", "unregister",
|
||||
"setStateFor", "getStateFor", "getDerivedStateFor");
|
||||
lazyRequire(this, '../state/events', { "events": "stateEvents" });
|
||||
lazyRequire(this, './view/events', { "events": "viewEvents" });
|
||||
lazyRequireModule(this, '../../event/utils', "events");
|
||||
|
||||
const { getActiveTab } = require('../../tabs/utils');
|
||||
lazyRequire(this, '../../tabs/utils', "getActiveTab");
|
||||
|
||||
const { id: addonID } = require('../../self');
|
||||
const { identify } = require('../id');
|
||||
lazyRequire(this, '../../self', { "id": "addonID" });
|
||||
lazyRequire(this, '../id', "identify");
|
||||
|
||||
const buttons = new Map();
|
||||
|
||||
|
|
|
@ -11,18 +11,18 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Cu } = require('chrome');
|
||||
const { on, off, emit } = require('../../event/core');
|
||||
lazyRequire(this, '../../event/core', "on", "off", "emit");
|
||||
|
||||
const { data } = require('sdk/self');
|
||||
lazyRequire(this, 'sdk/self', "data");
|
||||
|
||||
const { isObject, isNil } = require('../../lang/type');
|
||||
lazyRequire(this, '../../lang/type', "isObject", "isNil");
|
||||
|
||||
const { getMostRecentBrowserWindow } = require('../../window/utils');
|
||||
const { ignoreWindow } = require('../../private-browsing/utils');
|
||||
lazyRequire(this, '../../window/utils', "getMostRecentBrowserWindow");
|
||||
lazyRequire(this, '../../private-browsing/utils', "ignoreWindow");
|
||||
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
|
||||
const { AREA_PANEL, AREA_NAVBAR } = CustomizableUI;
|
||||
|
||||
const { events: viewEvents } = require('./view/events');
|
||||
lazyRequire(this, './view/events', { "events": "viewEvents" });
|
||||
|
||||
const XUL_NS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ module.metadata = {
|
|||
}
|
||||
};
|
||||
|
||||
require("./frame/view");
|
||||
const { Frame } = require("./frame/model");
|
||||
|
||||
exports.Frame = Frame;
|
||||
|
|
|
@ -12,19 +12,19 @@ module.metadata = {
|
|||
|
||||
const { Class } = require("../../core/heritage");
|
||||
const { EventTarget } = require("../../event/target");
|
||||
const { emit, off, setListeners } = require("../../event/core");
|
||||
lazyRequire(this, "../../event/core", "emit", "off", "setListeners");
|
||||
const { Reactor, foldp, send, merges } = require("../../event/utils");
|
||||
const { Disposable } = require("../../core/disposable");
|
||||
const { OutputPort } = require("../../output/system");
|
||||
const { InputPort } = require("../../input/system");
|
||||
const { identify } = require("../id");
|
||||
const { pairs, object, map, each } = require("../../util/sequence");
|
||||
const { patch, diff } = require("diffpatcher/index");
|
||||
const { isLocalURL } = require("../../url");
|
||||
lazyRequire(this, "../id", "identify");
|
||||
const { pairs, object, each } = require("../../util/sequence");
|
||||
lazyRequire(this, "diffpatcher/index", "patch", "diff");
|
||||
lazyRequire(this, "../../url", "isLocalURL");
|
||||
const { compose } = require("../../lang/functional");
|
||||
const { contract } = require("../../util/contract");
|
||||
const { id: addonID, data: { url: resolve }} = require("../../self");
|
||||
const { Frames } = require("../../input/frame");
|
||||
require("./view");
|
||||
|
||||
|
||||
const output = new OutputPort({ id: "frame-change" });
|
||||
|
|
|
@ -12,16 +12,13 @@ module.metadata = {
|
|||
|
||||
const { Cu, Ci } = require("chrome");
|
||||
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
|
||||
const { subscribe, send, Reactor, foldp, lift, merges, keepIf } = require("../../event/utils");
|
||||
const { InputPort } = require("../../input/system");
|
||||
const { send, Reactor } = require("../../event/utils");
|
||||
const { OutputPort } = require("../../output/system");
|
||||
const { LastClosed } = require("../../input/browser");
|
||||
const { pairs, keys, object, each } = require("../../util/sequence");
|
||||
lazyRequire(this, "../../util/sequence", "pairs", "keys", "object", "each");
|
||||
const { curry, compose } = require("../../lang/functional");
|
||||
const { getFrameElement, getOuterId,
|
||||
getByOuterId, getOwnerBrowserWindow } = require("../../window/utils");
|
||||
const { patch, diff } = require("diffpatcher/index");
|
||||
const { encode } = require("../../base64");
|
||||
lazyRequire(this, "../../window/utils", "getFrameElement", "getOuterId", "getByOuterId", "getOwnerBrowserWindow");
|
||||
lazyRequire(this, "diffpatcher/index", "patch", "diff");
|
||||
lazyRequire(this, "../../base64", "encode");
|
||||
const { Frames } = require("../../input/frame");
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
|
|
@ -8,7 +8,7 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const method = require('../../method/core');
|
||||
const { uuid } = require('../util/uuid');
|
||||
lazyRequire(this, '../util/uuid', "uuid");
|
||||
|
||||
// NOTE: use lang/functional memoize when it is updated to use WeakMap
|
||||
function memoize(f) {
|
||||
|
|
|
@ -13,27 +13,26 @@ module.metadata = {
|
|||
const { Class } = require('../core/heritage');
|
||||
const { merge } = require('../util/object');
|
||||
const { Disposable } = require('../core/disposable');
|
||||
const { off, emit, setListeners } = require('../event/core');
|
||||
lazyRequire(this, '../event/core', "off", "emit", "setListeners");
|
||||
const { EventTarget } = require('../event/target');
|
||||
const { URL } = require('../url');
|
||||
const { add, remove, has, clear, iterator } = require('../lang/weak-set');
|
||||
const { id: addonID, data } = require('../self');
|
||||
const { WindowTracker } = require('../deprecated/window-utils');
|
||||
const { isShowing } = require('./sidebar/utils');
|
||||
const { isBrowser, getMostRecentBrowserWindow, windows, isWindowPrivate } = require('../window/utils');
|
||||
lazyRequire(this, '../url', "URL");
|
||||
lazyRequire(this, '../self', { "id": "addonID" }, "data");
|
||||
lazyRequire(this, '../deprecated/window-utils', 'WindowTracker');
|
||||
lazyRequire(this, './sidebar/utils', "isShowing");
|
||||
lazyRequire(this, '../window/utils', "isBrowser", "getMostRecentBrowserWindow", "windows", "isWindowPrivate");
|
||||
const { ns } = require('../core/namespace');
|
||||
const { remove: removeFromArray } = require('../util/array');
|
||||
const { show, hide, toggle } = require('./sidebar/actions');
|
||||
const { Worker } = require('../deprecated/sync-worker');
|
||||
lazyRequire(this, '../util/array', { "remove": "removeFromArray" });
|
||||
lazyRequire(this, './sidebar/actions', "show", "hide", "toggle");
|
||||
lazyRequire(this, '../deprecated/sync-worker', "Worker");
|
||||
const { contract: sidebarContract } = require('./sidebar/contract');
|
||||
const { create, dispose, updateTitle, updateURL, isSidebarShowing, showSidebar, hideSidebar } = require('./sidebar/view');
|
||||
const { defer } = require('../core/promise');
|
||||
const { models, views, viewsFor, modelFor } = require('./sidebar/namespace');
|
||||
const { isLocalURL } = require('../url');
|
||||
lazyRequire(this, './sidebar/view', "create", "dispose", "updateTitle", "updateURL", "isSidebarShowing", "showSidebar", "hideSidebar");
|
||||
lazyRequire(this, '../core/promise', "defer");
|
||||
lazyRequire(this, './sidebar/namespace', "models", "views", "viewsFor", "modelFor");
|
||||
lazyRequire(this, '../url', "isLocalURL");
|
||||
const { ensure } = require('../system/unload');
|
||||
const { identify } = require('./id');
|
||||
const { uuid } = require('../util/uuid');
|
||||
const { viewFor } = require('../view/core');
|
||||
lazyRequire(this, './id', "identify");
|
||||
lazyRequire(this, '../util/uuid', "uuid");
|
||||
lazyRequire(this, '../view/core', "viewFor");
|
||||
|
||||
const resolveURL = (url) => url ? data.url(url) : url;
|
||||
|
||||
|
@ -41,8 +40,6 @@ const sidebarNS = ns();
|
|||
|
||||
const WEB_PANEL_BROWSER_ID = 'web-panels-browser';
|
||||
|
||||
var sidebars = {};
|
||||
|
||||
const Sidebar = Class({
|
||||
implements: [ Disposable ],
|
||||
extends: EventTarget,
|
||||
|
@ -209,8 +206,6 @@ const Sidebar = Class({
|
|||
});
|
||||
|
||||
views.set(this, bars);
|
||||
|
||||
add(sidebars, this);
|
||||
},
|
||||
get id() {
|
||||
return (modelFor(this) || {}).id;
|
||||
|
@ -259,8 +254,6 @@ const Sidebar = Class({
|
|||
|
||||
off(this);
|
||||
|
||||
remove(sidebars, this);
|
||||
|
||||
// stop tracking windows
|
||||
if (internals.tracker) {
|
||||
internals.tracker.unload();
|
||||
|
|
|
@ -10,11 +10,11 @@ module.metadata = {
|
|||
}
|
||||
};
|
||||
|
||||
const { models, buttons, views, viewsFor, modelFor } = require('./namespace');
|
||||
const { isBrowser, getMostRecentBrowserWindow, windows, isWindowPrivate } = require('../../window/utils');
|
||||
const { setStateFor } = require('../state');
|
||||
const { defer } = require('../../core/promise');
|
||||
const { isPrivateBrowsingSupported, data } = require('../../self');
|
||||
lazyRequire(this, './namespace', "models", "buttons", "views", "viewsFor", "modelFor");
|
||||
lazyRequire(this, '../../window/utils', "isBrowser", "getMostRecentBrowserWindow", "windows", "isWindowPrivate");
|
||||
lazyRequire(this, '../state', "setStateFor");
|
||||
lazyRequire(this, '../../core/promise', "defer");
|
||||
lazyRequire(this, '../../self', "isPrivateBrowsingSupported", "data");
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const WEB_PANEL_BROWSER_ID = 'web-panels-browser';
|
||||
|
|
|
@ -21,19 +21,19 @@ const { events: browserEvents } = require('../browser/events');
|
|||
const { events: tabEvents } = require('../tab/events');
|
||||
const { events: stateEvents } = require('./state/events');
|
||||
|
||||
const { windows, isInteractive, getFocusedBrowser } = require('../window/utils');
|
||||
const { getActiveTab, getOwnerWindow } = require('../tabs/utils');
|
||||
lazyRequire(this, '../window/utils', "windows", "isInteractive", "getFocusedBrowser");
|
||||
lazyRequire(this, '../tabs/utils', "getActiveTab", "getOwnerWindow");
|
||||
|
||||
const { ignoreWindow } = require('../private-browsing/utils');
|
||||
lazyRequire(this, '../private-browsing/utils', "ignoreWindow");
|
||||
|
||||
const { freeze } = Object;
|
||||
const { merge } = require('../util/object');
|
||||
const { on, off, emit } = require('../event/core');
|
||||
lazyRequire(this, '../event/core', "on", "off", "emit");
|
||||
|
||||
const { add, remove, has, clear, iterator } = require('../lang/weak-set');
|
||||
const { isNil } = require('../lang/type');
|
||||
lazyRequire(this, '../lang/weak-set', "add", "remove", "has", "clear", "iterator");
|
||||
lazyRequire(this, '../lang/type', "isNil");
|
||||
|
||||
const { viewFor } = require('../view/core');
|
||||
lazyRequire(this, '../view/core', "viewFor");
|
||||
|
||||
const components = new WeakMap();
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ const { CustomizationInput } = require("../../input/customizable-ui");
|
|||
const { pairs, map, isEmpty, object,
|
||||
each, keys, values } = require("../../util/sequence");
|
||||
const { curry, flip } = require("../../lang/functional");
|
||||
const { patch, diff } = require("diffpatcher/index");
|
||||
lazyRequire(this, "diffpatcher/index", "patch", "diff");
|
||||
const prefs = require("../../preferences/service");
|
||||
const { getByOuterId } = require("../../window/utils");
|
||||
const { ignoreWindow } = require('../../private-browsing/utils');
|
||||
lazyRequire(this, "../../window/utils", "getByOuterId");
|
||||
lazyRequire(this, '../../private-browsing/utils', "ignoreWindow");
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const PREF_ROOT = "extensions.sdk-toolbar-collapsed.";
|
||||
|
|
|
@ -8,8 +8,8 @@ module.metadata = {
|
|||
"stability": "experimental"
|
||||
};
|
||||
|
||||
const { get, format } = require("../console/traceback");
|
||||
const { get: getPref } = require("../preferences/service");
|
||||
lazyRequire(this, "../console/traceback", "get", "format");
|
||||
lazyRequire(this, "../preferences/service", {"get": "getPref"});
|
||||
const PREFERENCE = "devtools.errorconsole.deprecation_warnings";
|
||||
|
||||
function deprecateUsage(msg) {
|
||||
|
|
|
@ -7,7 +7,7 @@ module.metadata = {
|
|||
"stability": "unstable"
|
||||
};
|
||||
|
||||
const { URL } = require('../url');
|
||||
lazyRequire(this, '../url', "URL");
|
||||
const cache = {};
|
||||
|
||||
function MatchPattern(pattern) {
|
||||
|
|
|
@ -7,7 +7,7 @@ module.metadata = {
|
|||
"stability": "unstable"
|
||||
};
|
||||
|
||||
const { flatten } = require('./array');
|
||||
lazyRequire(this, './array', "flatten");
|
||||
|
||||
// Create a shortcut for Array.prototype.slice.call().
|
||||
const unbind = Function.call.bind(Function.bind, Function.call);
|
||||
|
|
|
@ -8,8 +8,8 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Class } = require('../core/heritage');
|
||||
const { MatchPattern } = require('./match-pattern');
|
||||
const { emit } = require('../event/core');
|
||||
lazyRequire(this, './match-pattern', "MatchPattern");
|
||||
lazyRequire(this, '../event/core', "emit");
|
||||
const { EventTarget } = require('../event/target');
|
||||
const { List, addListItem, removeListItem } = require('./list');
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ module.metadata = {
|
|||
// - `_` used for argument(s) or variable(s) who's values are ignored.
|
||||
|
||||
const { complement, flip, identity } = require("../lang/functional");
|
||||
const { isArray, isArguments, isMap, isSet, isGenerator,
|
||||
isString, isBoolean, isNumber } = require("../lang/type");
|
||||
lazyRequire(this, "../lang/type", "isArray", "isArguments", "isMap", "isSet",
|
||||
"isGenerator", "isString", "isBoolean", "isNumber");
|
||||
|
||||
const Sequence = function Sequence(iterator) {
|
||||
if (!isGenerator(iterator)) {
|
||||
|
|
|
@ -8,7 +8,7 @@ module.metadata = {
|
|||
};
|
||||
|
||||
const { Cc, Ci } = require('chrome');
|
||||
const array = require('../util/array');
|
||||
lazyRequireModule(this, "../util/array", "array");
|
||||
const { defer } = require('sdk/core/promise');
|
||||
const { dispatcher } = require("../util/dispatcher");
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ const { addObserver, notifyObservers } = Cc['@mozilla.org/observer-service;1'].
|
|||
getService(Ci.nsIObserverService);
|
||||
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
|
||||
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
const { join: pathJoin, normalize, dirname } = Cu.import("resource://gre/modules/osfile/ospath_unix.jsm");
|
||||
const { normalize, dirname } = Cu.import("resource://gre/modules/osfile/ospath_unix.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "resProto",
|
||||
"@mozilla.org/network/protocol;1?name=resource",
|
||||
|
@ -41,7 +41,9 @@ XPCOMUtils.defineLazyServiceGetter(this, "zipCache",
|
|||
"@mozilla.org/libjar/zip-reader-cache;1",
|
||||
"nsIZipReaderCache");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "XulApp", () => {
|
||||
const { defineLazyGetter } = XPCOMUtils;
|
||||
|
||||
defineLazyGetter(this, "XulApp", () => {
|
||||
let xulappURI = module.uri.replace("toolkit/loader.js",
|
||||
"sdk/system/xul-app.jsm");
|
||||
return Cu.import(xulappURI, {});
|
||||
|
@ -51,8 +53,10 @@ XPCOMUtils.defineLazyGetter(this, "XulApp", () => {
|
|||
const bind = Function.call.bind(Function.bind);
|
||||
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||||
const prototypeOf = Object.getPrototypeOf;
|
||||
const getOwnIdentifiers = x => [...Object.getOwnPropertyNames(x),
|
||||
...Object.getOwnPropertySymbols(x)];
|
||||
function* getOwnIdentifiers(x) {
|
||||
yield* Object.getOwnPropertyNames(x);
|
||||
yield* Object.getOwnPropertySymbols(x);
|
||||
}
|
||||
|
||||
const NODE_MODULES = new Set([
|
||||
"assert",
|
||||
|
@ -123,9 +127,8 @@ function freeze(object) {
|
|||
// Returns map of given `object`-s own property descriptors.
|
||||
const descriptor = iced(function descriptor(object) {
|
||||
let value = {};
|
||||
getOwnIdentifiers(object).forEach(function(name) {
|
||||
for (let name of getOwnIdentifiers(object))
|
||||
value[name] = getOwnPropertyDescriptor(object, name)
|
||||
});
|
||||
return value;
|
||||
});
|
||||
Loader.descriptor = descriptor;
|
||||
|
@ -158,11 +161,11 @@ function iced(f) {
|
|||
// useful during loader bootstrap when other util modules can't be used &
|
||||
// thats only case where this export should be used.
|
||||
const override = iced(function override(target, source) {
|
||||
let properties = descriptor(target)
|
||||
let extension = descriptor(source || {})
|
||||
getOwnIdentifiers(extension).forEach(function(name) {
|
||||
properties[name] = extension[name];
|
||||
});
|
||||
let properties = descriptor(target);
|
||||
|
||||
for (let name of getOwnIdentifiers(source || {}))
|
||||
properties[name] = getOwnPropertyDescriptor(source, name);
|
||||
|
||||
return Object.defineProperties({}, properties);
|
||||
});
|
||||
Loader.override = override;
|
||||
|
@ -281,6 +284,13 @@ const urlCache = {
|
|||
}
|
||||
}),
|
||||
|
||||
resolutionCache: new DefaultMap(fullId => {
|
||||
return (resolveAsFile(fullId) ||
|
||||
resolveAsDirectory(fullId));
|
||||
}),
|
||||
|
||||
nodeModulesCache: new Map(),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference]),
|
||||
|
||||
observe() {
|
||||
|
@ -288,6 +298,19 @@ const urlCache = {
|
|||
// since it probably means we're loading new copies of extensions.
|
||||
this.zipContentsCache.clear();
|
||||
this.filesCache.clear();
|
||||
this.resolutionCache.clear();
|
||||
this.nodeModulesCache.clear();
|
||||
},
|
||||
|
||||
getNodeModulePaths(rootURI, start) {
|
||||
let url = join(rootURI, start);
|
||||
|
||||
if (this.nodeModulesCache.has(url))
|
||||
return this.nodeModulesCache.get(url);
|
||||
|
||||
let result = Array.from(getNodeModulePaths(rootURI, start));
|
||||
this.nodeModulesCache.set(url, result);
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -365,10 +388,10 @@ function join(base, ...paths) {
|
|||
// or we wind up stripping too many slashes and producing invalid URLs.
|
||||
let match = /^((?:resource|file|chrome)\:\/\/[^\/]*|jar:[^!]+!)(.*)/.exec(base);
|
||||
if (match) {
|
||||
return match[1] + normalize(pathJoin(match[2], ...paths));
|
||||
return match[1] + normalize([match[2], ...paths].join("/"));
|
||||
}
|
||||
|
||||
return normalize(pathJoin(base, ...paths));
|
||||
return normalize([base, ...paths].join("/"));
|
||||
}
|
||||
Loader.join = join;
|
||||
|
||||
|
@ -471,11 +494,28 @@ const load = iced(function load(loader, module) {
|
|||
// Create a new object in this sandbox, that will be used as
|
||||
// the scope object for this particular module
|
||||
sandbox = new loader.sharedGlobalSandbox.Object();
|
||||
// Inject all expected globals in the scope object
|
||||
getOwnIdentifiers(globals).forEach(function(name) {
|
||||
descriptors[name] = getOwnPropertyDescriptor(globals, name)
|
||||
descriptors[name].configurable = true;
|
||||
});
|
||||
descriptors.lazyRequire = {
|
||||
configurable: true,
|
||||
value: lazyRequire.bind(sandbox),
|
||||
};
|
||||
descriptors.lazyRequireModule = {
|
||||
configurable: true,
|
||||
value: lazyRequireModule.bind(sandbox),
|
||||
};
|
||||
|
||||
if ("console" in globals) {
|
||||
descriptors.console = {
|
||||
configurable: true,
|
||||
get() {
|
||||
return globals.console;
|
||||
},
|
||||
};
|
||||
}
|
||||
let define = Object.getOwnPropertyDescriptor(globals, "define");
|
||||
if (define && define.value)
|
||||
descriptors.define = define;
|
||||
if ("DOMParser" in globals)
|
||||
descriptors.DOMParser = Object.getOwnPropertyDescriptor(globals, "DOMParser");
|
||||
Object.defineProperties(sandbox, descriptors);
|
||||
}
|
||||
else {
|
||||
|
@ -550,7 +590,7 @@ const load = iced(function load(loader, module) {
|
|||
// which completely replace the exports object and still want it
|
||||
// frozen need to freeze it themselves.
|
||||
if (module.exports === originalExports)
|
||||
freeze(module.exports);
|
||||
Object.freeze(module.exports);
|
||||
|
||||
return module;
|
||||
});
|
||||
|
@ -564,12 +604,6 @@ function normalizeExt(uri) {
|
|||
uri + '.js';
|
||||
}
|
||||
|
||||
// Strips `rootURI` from `string` -- used to remove absolute resourceURI
|
||||
// from a relative path
|
||||
function stripBase(rootURI, string) {
|
||||
return string.replace(rootURI, './');
|
||||
}
|
||||
|
||||
// Utility function to join paths. In common case `base` is a
|
||||
// `requirer.uri` but in some cases it may be `baseURI`. In order to
|
||||
// avoid complexity we require `baseURI` with a trailing `/`.
|
||||
|
@ -578,14 +612,16 @@ const resolve = iced(function resolve(id, base) {
|
|||
return id;
|
||||
|
||||
let baseDir = dirname(base);
|
||||
if (!baseDir)
|
||||
return normalize(id);
|
||||
|
||||
let resolved = join(baseDir, id);
|
||||
let resolved;
|
||||
if (baseDir.includes(":"))
|
||||
resolved = join(baseDir, id);
|
||||
else
|
||||
resolved = normalize(`${baseDir}/${id}`);
|
||||
|
||||
// Joining and normalizing removes the './' from relative files.
|
||||
// We need to ensure the resolution still has the root
|
||||
if (isRelative(base))
|
||||
if (base.startsWith('./'))
|
||||
resolved = './' + resolved;
|
||||
|
||||
return resolved;
|
||||
|
@ -628,10 +664,9 @@ function resolveAsDirectory(path) {
|
|||
function resolveRelative(rootURI, modulesDir, id) {
|
||||
let fullId = join(rootURI, modulesDir, id);
|
||||
|
||||
let resolvedPath = (resolveAsFile(fullId) ||
|
||||
resolveAsDirectory(fullId));
|
||||
let resolvedPath = urlCache.resolutionCache.get(fullId);
|
||||
if (resolvedPath) {
|
||||
return stripBase(rootURI, resolvedPath);
|
||||
return './' + resolvedPath.slice(rootURI.length);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -645,7 +680,7 @@ function* getNodeModulePaths(rootURI, start) {
|
|||
let parts = start.split('/');
|
||||
while (parts.length) {
|
||||
let leaf = parts.pop();
|
||||
let path = join(...parts, leaf, moduleDir);
|
||||
let path = [...parts, leaf, moduleDir].join("/");
|
||||
if (leaf !== moduleDir && urlCache.exists(join(rootURI, path))) {
|
||||
yield path;
|
||||
}
|
||||
|
@ -686,7 +721,7 @@ const nodeResolve = iced(function nodeResolve(id, requirer, { rootURI }) {
|
|||
|
||||
// If manifest has dependencies, attempt to look up node modules
|
||||
// in the `dependencies` list
|
||||
for (let modulesDir of getNodeModulePaths(rootURI, dirname(requirer))) {
|
||||
for (let modulesDir of urlCache.getNodeModulePaths(rootURI, dirname(requirer))) {
|
||||
if ((resolvedPath = resolveRelative(rootURI, modulesDir, id))) {
|
||||
return resolvedPath;
|
||||
}
|
||||
|
@ -704,14 +739,26 @@ function addTrailingSlash(path) {
|
|||
return path.replace(/\/*$/, "/");
|
||||
}
|
||||
|
||||
const resolveURI = iced(function resolveURI(id, mapping) {
|
||||
// Do not resolve if already a resource URI
|
||||
if (isAbsoluteURI(id))
|
||||
return normalizeExt(id);
|
||||
function compileMapping(paths) {
|
||||
// Make mapping array that is sorted from longest path to shortest path.
|
||||
let mapping = Object.keys(paths)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.map(path => [path, paths[path]]);
|
||||
|
||||
const PATTERN = /([.\\?+*(){}[\]^$])/g;
|
||||
const escapeMeta = str => str.replace(PATTERN, '\\$1')
|
||||
|
||||
let patterns = [];
|
||||
paths = {};
|
||||
|
||||
for (let [path, uri] of mapping) {
|
||||
// Strip off any trailing slashes to make comparisons simpler
|
||||
let stripped = path.replace(/\/+$/, "");
|
||||
if (path.endsWith("/")) {
|
||||
path = path.slice(0, -1);
|
||||
uri = uri.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
paths[path] = uri;
|
||||
|
||||
// We only want to match path segments explicitly. Examples:
|
||||
// * "foo/bar" matches for "foo/bar"
|
||||
|
@ -722,23 +769,88 @@ const resolveURI = iced(function resolveURI(id, mapping) {
|
|||
//
|
||||
// Check for an empty path, an exact match, or a substring match
|
||||
// with the next character being a forward slash.
|
||||
if(stripped === "" || id === stripped || id.startsWith(stripped + "/")) {
|
||||
return normalizeExt(id.replace(path, uri));
|
||||
}
|
||||
if (path == "")
|
||||
patterns.push("");
|
||||
else
|
||||
patterns.push(`${escapeMeta(path)}(?=$|/)`);
|
||||
}
|
||||
return null;
|
||||
|
||||
let pattern = new RegExp(`^(${patterns.join('|')})`);
|
||||
|
||||
// This will replace the longest matching path mapping at the start of
|
||||
// the ID string with its mapped value.
|
||||
return id => {
|
||||
return id.replace(pattern, (m0, m1) => paths[m1]);
|
||||
};
|
||||
}
|
||||
|
||||
const resolveURI = iced(function resolveURI(id, mapping) {
|
||||
// Do not resolve if already a resource URI
|
||||
if (isAbsoluteURI(id))
|
||||
return normalizeExt(id);
|
||||
|
||||
return normalizeExt(mapping(id))
|
||||
});
|
||||
Loader.resolveURI = resolveURI;
|
||||
|
||||
/**
|
||||
* Defines lazy getters on the given object, which lazily require the
|
||||
* given module the first time they are accessed, and then resolve that
|
||||
* module's exported properties.
|
||||
*
|
||||
* @param {object} obj
|
||||
* The target object on which to define the lazy getters.
|
||||
* @param {string} moduleId
|
||||
* The ID of the module to require, as passed to require().
|
||||
* @param {Array<string | object>} args
|
||||
* Any number of properties to import from the module. A string
|
||||
* will cause the property to be defined which resolves to the
|
||||
* same property in the module's exports. An object will define a
|
||||
* lazy getter for every value in the object which corresponds to
|
||||
* the given key in the module's exports, as in an ordinary
|
||||
* destructuring assignment.
|
||||
*/
|
||||
function lazyRequire(obj, moduleId, ...args) {
|
||||
let module;
|
||||
let getModule = () => {
|
||||
if (!module)
|
||||
module = this.require(moduleId);
|
||||
return module;
|
||||
};
|
||||
|
||||
for (let props of args) {
|
||||
if (typeof props !== "object")
|
||||
props = {[props]: props};
|
||||
|
||||
for (let [fromName, toName] of Object.entries(props))
|
||||
defineLazyGetter(obj, toName, () => getModule()[fromName]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a lazy getter on the given object which causes a module to be
|
||||
* lazily imported the first time it is accessed.
|
||||
*
|
||||
* @param {object} obj
|
||||
* The target object on which to define the lazy getter.
|
||||
* @param {string} moduleId
|
||||
* The ID of the module to require, as passed to require().
|
||||
* @param {string} [prop = moduleId]
|
||||
* The name of the lazy getter property to define.
|
||||
*/
|
||||
function lazyRequireModule(obj, moduleId, prop = moduleId) {
|
||||
defineLazyGetter(obj, prop, () => this.require(moduleId));
|
||||
}
|
||||
|
||||
|
||||
// Creates version of `require` that will be exposed to the given `module`
|
||||
// in the context of the given `loader`. Each module gets own limited copy
|
||||
// of `require` that is allowed to load only a modules that are associated
|
||||
// with it during link time.
|
||||
const Require = iced(function Require(loader, requirer) {
|
||||
let {
|
||||
modules, mapping, resolve: loaderResolve, load,
|
||||
manifest, rootURI, isNative, requireMap,
|
||||
requireHook
|
||||
modules, mapping, mappingCache, resolve: loaderResolve, load,
|
||||
manifest, rootURI, isNative, requireHook
|
||||
} = loader;
|
||||
|
||||
if (isSystemURI(requirer.uri)) {
|
||||
|
@ -763,6 +875,7 @@ const Require = iced(function Require(loader, requirer) {
|
|||
|
||||
function _require(id) {
|
||||
let { uri, requirement } = getRequirements(id);
|
||||
|
||||
let module = null;
|
||||
// If module is already cached by loader then just use it.
|
||||
if (uri in modules) {
|
||||
|
@ -804,7 +917,7 @@ const Require = iced(function Require(loader, requirer) {
|
|||
// remove it if we have any errors.
|
||||
module = modules[uri] = Module(requirement, uri);
|
||||
try {
|
||||
freeze(load(loader, module));
|
||||
Object.freeze(load(loader, module));
|
||||
}
|
||||
catch (e) {
|
||||
// Clear out modules cache so we can throw on a second invalid require
|
||||
|
@ -831,12 +944,6 @@ const Require = iced(function Require(loader, requirer) {
|
|||
// TODO should get native Firefox modules before doing node-style lookups
|
||||
// to save on loading time
|
||||
if (isNative) {
|
||||
// If a requireMap is available from `generateMap`, use that to
|
||||
// immediately resolve the node-style mapping.
|
||||
// TODO: write more tests for this use case
|
||||
if (requireMap && requireMap[requirer.id])
|
||||
requirement = requireMap[requirer.id][id];
|
||||
|
||||
let { overrides } = manifest.jetpack;
|
||||
for (let key in overrides) {
|
||||
// ignore any overrides using relative keys
|
||||
|
@ -859,8 +966,6 @@ const Require = iced(function Require(loader, requirer) {
|
|||
if (!requirement && modules[id])
|
||||
uri = requirement = id;
|
||||
|
||||
// If no requireMap was provided, or resolution not found in
|
||||
// the requireMap, and not a npm dependency, attempt a runtime lookup
|
||||
if (!requirement && !NODE_MODULES.has(id)) {
|
||||
// If `isNative` defined, this is using the new, native-style
|
||||
// loader, not cuddlefish, so lets resolve using node's algorithm
|
||||
|
@ -892,7 +997,14 @@ const Require = iced(function Require(loader, requirer) {
|
|||
}
|
||||
|
||||
// Resolves `uri` of module using loaders resolve function.
|
||||
uri = uri || resolveURI(requirement, mapping);
|
||||
if (!uri) {
|
||||
if (mappingCache.has(requirement)) {
|
||||
uri = mappingCache.get(requirement);
|
||||
} else {
|
||||
uri = resolveURI(requirement, mapping);
|
||||
mappingCache.set(requirement, uri);
|
||||
}
|
||||
}
|
||||
|
||||
// Throw if `uri` can not be resolved.
|
||||
if (!uri) {
|
||||
|
@ -975,11 +1087,15 @@ Loader.unload = unload;
|
|||
// If `resolve` does not returns `uri` string exception will be thrown by
|
||||
// an associated `require` call.
|
||||
function Loader(options) {
|
||||
function normalizeRootURI(uri) {
|
||||
return addTrailingSlash(join(uri));
|
||||
}
|
||||
|
||||
if (options.sharedGlobalBlacklist && !options.sharedGlobalBlocklist) {
|
||||
options.sharedGlobalBlocklist = options.sharedGlobalBlacklist;
|
||||
}
|
||||
let {
|
||||
modules, globals, resolve, paths, rootURI, manifest, requireMap, isNative,
|
||||
modules, globals, resolve, paths, rootURI, manifest, isNative,
|
||||
metadata, sharedGlobal, sharedGlobalBlocklist, checkCompatibility, waiveIntereposition
|
||||
} = override({
|
||||
paths: {},
|
||||
|
@ -998,7 +1114,7 @@ function Loader(options) {
|
|||
checkCompatibility: false,
|
||||
resolve: options.isNative ?
|
||||
// Make the returned resolve function have the same signature
|
||||
(id, requirer) => Loader.nodeResolve(id, requirer, { rootURI: rootURI }) :
|
||||
(id, requirer) => Loader.nodeResolve(id, requirer, { rootURI: normalizeRootURI(rootURI) }) :
|
||||
Loader.resolve,
|
||||
sharedGlobalBlocklist: ["sdk/indexed-db"],
|
||||
waiveIntereposition: false
|
||||
|
@ -1024,10 +1140,7 @@ function Loader(options) {
|
|||
// observer notifications.
|
||||
let destructor = freeze(Object.create(null));
|
||||
|
||||
// Make mapping array that is sorted from longest path to shortest path.
|
||||
let mapping = Object.keys(paths)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.map(path => [path, paths[path]]);
|
||||
let mapping = compileMapping(paths);
|
||||
|
||||
// Define pseudo modules.
|
||||
modules = override({
|
||||
|
@ -1077,9 +1190,18 @@ function Loader(options) {
|
|||
addonID: options.id,
|
||||
URI: "Addon-SDK"
|
||||
},
|
||||
prototype: options.sandboxPrototype || {}
|
||||
prototype: options.sandboxPrototype || globals,
|
||||
});
|
||||
|
||||
if (options.sandboxPrototype) {
|
||||
// If we were given a sandboxPrototype, we have to define the globals on
|
||||
// the sandbox directly. Note that this will not work for callers who
|
||||
// depend on being able to add globals after the loader was created.
|
||||
for (let name of getOwnIdentifiers(globals))
|
||||
Object.defineProperty(sharedGlobalSandbox, name,
|
||||
getOwnPropertyDescriptor(globals, name));
|
||||
}
|
||||
|
||||
// Loader object is just a representation of a environment
|
||||
// state. We freeze it and mark make it's properties non-enumerable
|
||||
// as they are pure implementation detail that no one should rely upon.
|
||||
|
@ -1087,6 +1209,7 @@ function Loader(options) {
|
|||
destructor: { enumerable: false, value: destructor },
|
||||
globals: { enumerable: false, value: globals },
|
||||
mapping: { enumerable: false, value: mapping },
|
||||
mappingCache: { enumerable: false, value: new Map() },
|
||||
// Map of module objects indexed by module URIs.
|
||||
modules: { enumerable: false, value: modules },
|
||||
metadata: { enumerable: false, value: metadata },
|
||||
|
@ -1122,8 +1245,7 @@ function Loader(options) {
|
|||
if (isNative) {
|
||||
returnObj.isNative = { enumerable: false, value: true };
|
||||
returnObj.manifest = { enumerable: false, value: manifest };
|
||||
returnObj.requireMap = { enumerable: false, value: requireMap };
|
||||
returnObj.rootURI = { enumerable: false, value: addTrailingSlash(rootURI) };
|
||||
returnObj.rootURI = { enumerable: false, value: normalizeRootURI(rootURI) };
|
||||
}
|
||||
|
||||
return freeze(Object.create(null, returnObj));
|
||||
|
@ -1135,9 +1257,7 @@ var isSystemURI = uri => /^resource:\/\/(gre|devtools|testing-common)\//.test(ur
|
|||
var isJSONURI = uri => uri.endsWith('.json');
|
||||
var isJSMURI = uri => uri.endsWith('.jsm');
|
||||
var isJSURI = uri => uri.endsWith('.js');
|
||||
var isAbsoluteURI = uri => uri.startsWith("resource://") ||
|
||||
uri.startsWith("chrome://") ||
|
||||
uri.startsWith("file://");
|
||||
var isAbsoluteURI = uri => /^(resource|chrome|file|jar):/.test(uri);
|
||||
var isRelative = id => id.startsWith(".");
|
||||
|
||||
// Default `main` entry to './index.js' and ensure is relative,
|
||||
|
|
|
@ -47,7 +47,7 @@ const make = (exports, rootURI, components) => {
|
|||
// during development is acceptable.
|
||||
components.classes["@mozilla.org/observer-service;1"].
|
||||
getService(components.interfaces.nsIObserverService).
|
||||
notifyObservers({}, "startupcache-invalidate", null);
|
||||
notifyObservers({}, "startupcache-invalidate");
|
||||
|
||||
if (all) {
|
||||
for (let uri of Object.keys(loader.sandboxes)) {
|
||||
|
|
|
@ -49,9 +49,8 @@ else {
|
|||
let listener = function (subject, topic) {
|
||||
Services.obs.removeObserver(this, topic);
|
||||
Startup.initialized = true;
|
||||
Services.tm.currentThread.dispatch(() => gOnceInitializedDeferred.resolve(),
|
||||
Ci.nsIThread.DISPATCH_NORMAL);
|
||||
Services.tm.dispatchToMainThread(() => gOnceInitializedDeferred.resolve());
|
||||
}
|
||||
|
||||
Services.obs.addObserver(listener, appStartup, false);
|
||||
Services.obs.addObserver(listener, appStartup);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function startup(data, reason) {
|
|||
dump("MU: APPLICATION-QUIT\n");
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(QuitObserver, "quit-application", false);
|
||||
Services.obs.addObserver(QuitObserver, "quit-application");
|
||||
log("MU: ready to watch firefox exit.");
|
||||
} catch(e) {
|
||||
log("MU: unable to register quit-application observer: " + e);
|
||||
|
|
|
@ -9,6 +9,7 @@ const { WindowTracker } = require('sdk/deprecated/window-utils');
|
|||
const { close, open } = require('sdk/window/helpers');
|
||||
const { data } = require('sdk/self');
|
||||
const { Panel } = require('sdk/panel');
|
||||
const { getActiveView } = require("sdk/view/core");
|
||||
|
||||
const XUL_URL = 'chrome://test/content/new-window.xul'
|
||||
|
||||
|
@ -74,6 +75,8 @@ exports.testChromeInPanel = function*(assert) {
|
|||
contentScriptFile: data.url('panel.js')
|
||||
});
|
||||
|
||||
getActiveView(panel);
|
||||
|
||||
yield new Promise(resolve => panel.port.once('start', resolve));
|
||||
assert.pass('start was emitted');
|
||||
|
||||
|
|
|
@ -456,8 +456,7 @@ nsHttpServer.prototype =
|
|||
self._notifyStopped();
|
||||
}
|
||||
};
|
||||
gThreadManager.currentThread
|
||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(stopEvent);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2695,8 +2694,7 @@ ServerHandler.prototype =
|
|||
|
||||
let writeMore = function writeMore()
|
||||
{
|
||||
gThreadManager.currentThread
|
||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(writeData);
|
||||
}
|
||||
|
||||
var input = new BinaryInputStream(fis);
|
||||
|
@ -3767,13 +3765,13 @@ Response.prototype =
|
|||
// way to handle both cases without removing bodyOutputStream access and
|
||||
// moving its effective write(data, length) method onto Response, which
|
||||
// would be slower and require more code than this anyway.
|
||||
gThreadManager.currentThread.dispatch({
|
||||
gThreadManager.dispatchToMainThread({
|
||||
run: function()
|
||||
{
|
||||
dumpn("*** canceling copy asynchronously...");
|
||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4522,7 +4520,7 @@ WriteThroughCopier.prototype =
|
|||
}
|
||||
};
|
||||
|
||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -456,8 +456,7 @@ nsHttpServer.prototype =
|
|||
self._notifyStopped();
|
||||
}
|
||||
};
|
||||
gThreadManager.currentThread
|
||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(stopEvent);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2695,8 +2694,7 @@ ServerHandler.prototype =
|
|||
|
||||
let writeMore = function writeMore()
|
||||
{
|
||||
gThreadManager.currentThread
|
||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(writeData);
|
||||
}
|
||||
|
||||
var input = new BinaryInputStream(fis);
|
||||
|
@ -3767,13 +3765,13 @@ Response.prototype =
|
|||
// way to handle both cases without removing bodyOutputStream access and
|
||||
// moving its effective write(data, length) method onto Response, which
|
||||
// would be slower and require more code than this anyway.
|
||||
gThreadManager.currentThread.dispatch({
|
||||
gThreadManager.dispatchToMainThread({
|
||||
run: function()
|
||||
{
|
||||
dumpn("*** canceling copy asynchronously...");
|
||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4522,7 +4520,7 @@ WriteThroughCopier.prototype =
|
|||
}
|
||||
};
|
||||
|
||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -457,8 +457,7 @@ nsHttpServer.prototype =
|
|||
self._notifyStopped();
|
||||
}
|
||||
};
|
||||
gThreadManager.currentThread
|
||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(stopEvent);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2696,8 +2695,7 @@ ServerHandler.prototype =
|
|||
|
||||
let writeMore = function writeMore()
|
||||
{
|
||||
gThreadManager.currentThread
|
||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(writeData);
|
||||
}
|
||||
|
||||
var input = new BinaryInputStream(fis);
|
||||
|
@ -3768,13 +3766,13 @@ Response.prototype =
|
|||
// way to handle both cases without removing bodyOutputStream access and
|
||||
// moving its effective write(data, length) method onto Response, which
|
||||
// would be slower and require more code than this anyway.
|
||||
gThreadManager.currentThread.dispatch({
|
||||
gThreadManager.dispatchToMainThread({
|
||||
run: function()
|
||||
{
|
||||
dumpn("*** canceling copy asynchronously...");
|
||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4523,7 +4521,7 @@ WriteThroughCopier.prototype =
|
|||
}
|
||||
};
|
||||
|
||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -105,7 +105,7 @@ function listener(event) {
|
|||
// Use the raw observer service here since it will be usable even if the
|
||||
// loader has unloaded
|
||||
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
Services.obs.notifyObservers(null, "Test:Reply", "");
|
||||
Services.obs.notifyObservers(null, "Test:Reply");
|
||||
}
|
||||
|
||||
frames.port.on('sdk/test/registerframesevent', (frame) => {
|
||||
|
|
|
@ -456,8 +456,7 @@ nsHttpServer.prototype =
|
|||
self._notifyStopped();
|
||||
}
|
||||
};
|
||||
gThreadManager.currentThread
|
||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(stopEvent);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2695,8 +2694,7 @@ ServerHandler.prototype =
|
|||
|
||||
let writeMore = function writeMore()
|
||||
{
|
||||
gThreadManager.currentThread
|
||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(writeData);
|
||||
}
|
||||
|
||||
var input = new BinaryInputStream(fis);
|
||||
|
@ -3767,13 +3765,13 @@ Response.prototype =
|
|||
// way to handle both cases without removing bodyOutputStream access and
|
||||
// moving its effective write(data, length) method onto Response, which
|
||||
// would be slower and require more code than this anyway.
|
||||
gThreadManager.currentThread.dispatch({
|
||||
gThreadManager.dispatchToMainThread({
|
||||
run: function()
|
||||
{
|
||||
dumpn("*** canceling copy asynchronously...");
|
||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4522,7 +4520,7 @@ WriteThroughCopier.prototype =
|
|||
}
|
||||
};
|
||||
|
||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -105,7 +105,7 @@ function listener(event) {
|
|||
// Use the raw observer service here since it will be usable even if the
|
||||
// loader has unloaded
|
||||
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
Services.obs.notifyObservers(null, "Test:Reply", "");
|
||||
Services.obs.notifyObservers(null, "Test:Reply");
|
||||
}
|
||||
|
||||
frames.port.on('sdk/test/registerframesevent', (frame) => {
|
||||
|
|
|
@ -40,7 +40,8 @@ exports.asyncWindowLeakTest = function*(assert, asyncTestFunc) {
|
|||
|
||||
// SelfSupportBackend periodically tries to open windows. This can
|
||||
// mess up our window leak detection below, so turn it off.
|
||||
SelfSupportBackend.uninit();
|
||||
if (SelfSupportBackend._log)
|
||||
SelfSupportBackend.uninit();
|
||||
|
||||
// Wait for the browser to finish loading.
|
||||
yield Startup.onceInitialized;
|
||||
|
@ -53,7 +54,7 @@ exports.asyncWindowLeakTest = function*(assert, asyncTestFunc) {
|
|||
weakWindows.push(Cu.getWeakReference(supportsWeak));
|
||||
}
|
||||
}
|
||||
Services.obs.addObserver(windowObserver, "domwindowopened", false);
|
||||
Services.obs.addObserver(windowObserver, "domwindowopened");
|
||||
|
||||
// Execute the body of the test.
|
||||
let testLoader = yield asyncTestFunc(assert);
|
||||
|
|
|
@ -457,8 +457,7 @@ nsHttpServer.prototype =
|
|||
self._notifyStopped();
|
||||
}
|
||||
};
|
||||
gThreadManager.currentThread
|
||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(stopEvent);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -2696,8 +2695,7 @@ ServerHandler.prototype =
|
|||
|
||||
let writeMore = function writeMore()
|
||||
{
|
||||
gThreadManager.currentThread
|
||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(writeData);
|
||||
}
|
||||
|
||||
var input = new BinaryInputStream(fis);
|
||||
|
@ -3768,13 +3766,13 @@ Response.prototype =
|
|||
// way to handle both cases without removing bodyOutputStream access and
|
||||
// moving its effective write(data, length) method onto Response, which
|
||||
// would be slower and require more code than this anyway.
|
||||
gThreadManager.currentThread.dispatch({
|
||||
gThreadManager.dispatchToMainThread({
|
||||
run: function()
|
||||
{
|
||||
dumpn("*** canceling copy asynchronously...");
|
||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4523,7 +4521,7 @@ WriteThroughCopier.prototype =
|
|||
}
|
||||
};
|
||||
|
||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
||||
gThreadManager.dispatchToMainThread(event);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,7 @@ exports["test changing result from addon extras in panel"] = function(assert, do
|
|||
});
|
||||
|
||||
const { Panel } = loader.require("sdk/panel");
|
||||
const { getActiveView } = loader.require("sdk/view/core");
|
||||
const { events } = loader.require("sdk/content/sandbox/events");
|
||||
const { on } = loader.require("sdk/event/core");
|
||||
const { isAddonContent } = loader.require("sdk/content/utils");
|
||||
|
@ -48,6 +49,9 @@ exports["test changing result from addon extras in panel"] = function(assert, do
|
|||
contentURL: "./test-addon-extras.html"
|
||||
});
|
||||
|
||||
// Force the panel view to actually load.
|
||||
getActiveView(panel);
|
||||
|
||||
panel.port.once("result1", (result) => {
|
||||
assert.equal(result, 1, "result is a number");
|
||||
result = true;
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче