mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
45942a6da5
- missing bit of Bug 1209403 - Build xpidl stuff in the faster make backend. (2b46f612d4) - Bug 1209875 - Get rid of XULPPFLAGS. r=gps (84b1e0140e) - Bug 1220731 - Refactor embedjs script for use from moz.build rather than makefiles r=shu r=glandium (064363aef4) - Bug 1212015 - Fix an unchecked allocation in AsmJS r=terrence (c77978cae6) - Bug 1218641 - IonMonkey: MIPS64: Add support into asmjs. r=lth (c856ea1842) - Bug 1219821 - remove static failure, make it dynamic r=arai a=me (eec5ffaa57) - Bug 1210611 - Globally define MOZILLA_OFFICIAL. r=glandium (c06518f942) - Bug 1211765 - Remove remnants from --with-libxul-sdk. r=bsmedberg (79a4d4e4aa) - Bug 1221453 - Use SourcePaths for LOCAL_INCLUDES. r=gps (abb032990d) - Bug 1176094 - [ATK] Assign role SECTION to math groups instead of PANEL/UNKNOWN. r=surkov (18b059a017) - Bug 1175182 - Expose fractions and roots as ATK_ROLE_PANEL for ATK < 2.16. r=surkov (6d00256e56) - bug 1171728 - null check the result of ProxyAccessible::OuterDocOfRemoteBrowser (378533bdaf) - Bug 1207253 - make getChildCountCB correctly deal with outerdoc accessibles with proxy children, r=tbsaunde (303d37a9d3) - bug 1209615 - make remote primary docs RELATION_EMBEDS targets for atk r=davidb (782635334d) - bug 1196880 - correctly compute interfaces for proxies r=davidb (2ee6b6ffdd) - bug 1210803 - expose the selection interface on proxied accessibles r=davidb (006b68ee32) - bug 1210884 - expose the action interface on proxied accessibles r=davidb (837add2013) - bug 1185122 - don't try and fire platform events in the child process r=lsocks (622e18ed2c) - Bug 1210108 - Emit object:state-changed:showing event for doorhangers, r=tbsaunde (bd2d410651) - bug 1164193 - emit a few more events on proxied accessibles for atk r=davidb (79b0d7a324) - bug 1213516 - fire showing state change event for atk in place of an alert event r=davidb (08efdc7620) - Bug 1209470 - Remove use of expression closure from Add-on SDK. r=mossop (736026d0e9) - Bug 1212693 - Remove skipCOWCallableChecks. r=bz (e1b7c21fe5) - Bug 877896 - Print stack trace in the console service. r=bholley (4667c5df15) - Bug 1157648 - Make nsScriptError::ToString use only the first 512 characters of mSourceName and mSourceLine. r=bholley (8cabd24397) - Bug 1052139 - Continued work on making the global object's prototype chain immutable, once a switch is flipped. r=bz (3f7549bd11) - Bug 1052139 - Adjust sandbox code to create the sandbox with an (observably) immutable [[Prototype]], once the flag's flipped. r=bz (66b846642c) - Bug 1184382 - Handle a sandboxPrototype we don't subsume. r=gabor (1736954a3e) - Bug 1205707 part 1 - Clean up some is-TypedArrayObject code in Ion. r=Waldo (08d95d5db4) - Bug 1205707 part 2 - Add test. r=Waldo (d1af75fe83)
181 lines
5.9 KiB
JavaScript
181 lines
5.9 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
module.metadata = {
|
|
"stability": "experimental"
|
|
};
|
|
|
|
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;
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
|
|
return Cu.import("resource://gre/modules/devtools/ToolboxProcess.jsm", {}).
|
|
BrowserToolboxProcess;
|
|
});
|
|
|
|
// Initializes default preferences
|
|
function setDefaultPrefs(prefsURI) {
|
|
const prefs = Cc['@mozilla.org/preferences-service;1'].
|
|
getService(Ci.nsIPrefService).
|
|
QueryInterface(Ci.nsIPrefBranch2);
|
|
const branch = prefs.getDefaultBranch('');
|
|
const sandbox = Sandbox({
|
|
name: prefsURI,
|
|
prototype: {
|
|
pref: function(key, val) {
|
|
switch (typeof val) {
|
|
case 'boolean':
|
|
branch.setBoolPref(key, val);
|
|
break;
|
|
case 'number':
|
|
if (val % 1 == 0) // number must be a integer, otherwise ignore it
|
|
branch.setIntPref(key, val);
|
|
break;
|
|
case 'string':
|
|
branch.setCharPref(key, val);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
// load preferences.
|
|
evaluate(sandbox, prefsURI);
|
|
}
|
|
|
|
function definePseudo(loader, id, exports) {
|
|
let uri = resolveURI(id, loader.mapping);
|
|
loader.modules[uri] = { exports: exports };
|
|
}
|
|
|
|
function startup(reason, options) {
|
|
return Startup.onceInitialized.then(() => {
|
|
// Inject globals ASAP in order to have console API working ASAP
|
|
Object.defineProperties(options.loader.globals, descriptor(globals));
|
|
|
|
// NOTE: Module is intentionally required only now because it relies
|
|
// on existence of hidden window, which does not exists until startup.
|
|
let { ready } = require('../addon/window');
|
|
// Load localization manifest and .properties files.
|
|
// Run the addon even in case of error (best effort approach)
|
|
require('../l10n/loader').
|
|
load(rootURI).
|
|
then(null, function failure(error) {
|
|
if (!isNative)
|
|
console.info("Error while loading localization: " + error.message);
|
|
}).
|
|
then(function onLocalizationReady(data) {
|
|
// Exports data to a pseudo module so that api-utils/l10n/core
|
|
// can get access to it
|
|
definePseudo(options.loader, '@l10n/data', data ? data : null);
|
|
return ready;
|
|
}).then(function() {
|
|
run(options);
|
|
}).then(null, console.exception);
|
|
return void 0; // otherwise we raise a warning, see bug 910304
|
|
});
|
|
}
|
|
|
|
function run(options) {
|
|
try {
|
|
// Try initializing HTML localization before running main module. Just print
|
|
// an exception in case of error, instead of preventing addon to be run.
|
|
try {
|
|
// Do not enable HTML localization while running test as it is hard to
|
|
// disable. Because unit tests are evaluated in a another Loader who
|
|
// doesn't have access to this current loader.
|
|
if (options.main !== 'sdk/test/runner') {
|
|
require('../l10n/html').enable();
|
|
}
|
|
}
|
|
catch(error) {
|
|
console.exception(error);
|
|
}
|
|
|
|
// native-options does stuff directly with preferences key from package.json
|
|
if (preferences && preferences.length > 0) {
|
|
try {
|
|
require('../preferences/native-options').
|
|
enable({ preferences: preferences, id: id }).
|
|
catch(console.exception);
|
|
}
|
|
catch (error) {
|
|
console.exception(error);
|
|
}
|
|
}
|
|
else {
|
|
// keeping support for addons packaged with older SDK versions,
|
|
// when cfx didn't include the 'preferences' key in @loader/options
|
|
|
|
// Initialize inline options localization, without preventing addon to be
|
|
// run in case of error
|
|
try {
|
|
require('../l10n/prefs').enable();
|
|
}
|
|
catch(error) {
|
|
console.exception(error);
|
|
}
|
|
|
|
// TODO: When bug 564675 is implemented this will no longer be needed
|
|
// Always set the default prefs, because they disappear on restart
|
|
if (options.prefsURI) {
|
|
// Only set if `prefsURI` specified
|
|
try {
|
|
setDefaultPrefs(options.prefsURI);
|
|
}
|
|
catch (err) {
|
|
// cfx bootstrap always passes prefsURI, even in addons without prefs
|
|
}
|
|
}
|
|
}
|
|
|
|
// this is where the addon's main.js finally run.
|
|
let program = main(options.loader, options.main);
|
|
|
|
if (typeof(program.onUnload) === 'function')
|
|
unload(program.onUnload);
|
|
|
|
if (typeof(program.main) === 'function') {
|
|
program.main({
|
|
loadReason: loadReason,
|
|
staticArgs: staticArgs
|
|
}, {
|
|
print: function print(_) { dump(_ + '\n') },
|
|
quit: exit
|
|
});
|
|
}
|
|
|
|
if (get("extensions." + id + ".sdk.debug.show", false)) {
|
|
BrowserToolboxProcess.init({ addonID: id });
|
|
}
|
|
} catch (error) {
|
|
console.exception(error);
|
|
throw error;
|
|
}
|
|
}
|
|
exports.startup = startup;
|
|
|
|
// If add-on is lunched via `cfx run` we need to use `system.exit` to let
|
|
// cfx know we're done (`cfx test` will take care of exit so we don't do
|
|
// anything here).
|
|
if (env.CFX_COMMAND === 'run') {
|
|
unload(function(reason) {
|
|
if (reason === 'shutdown')
|
|
exit(0);
|
|
});
|
|
}
|