mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Bug 904927: Assign globals to "this" in modules so that they are available through the B2G module loader; r=Unfocused
This commit is contained in:
parent
d2573d2d4a
commit
451e8dc5af
@ -92,8 +92,8 @@ AddonLogger.prototype = {
|
||||
Ci.nsIScriptError.errorFlag, "component javascript");
|
||||
Services.console.logMessage(consoleMessage);
|
||||
|
||||
if (gDebugLogEnabled)
|
||||
dump("*** " + message + "\n");
|
||||
// Always dump errors, in case the Console Service isn't listening yet
|
||||
dump("*** " + message + "\n");
|
||||
|
||||
try {
|
||||
var tstamp = new Date();
|
||||
|
@ -38,7 +38,7 @@ const DEFAULT_SAVE_DELAY_MS = 50;
|
||||
* that marks the data as needing to be saved, and when the DeferredSave
|
||||
* begins writing the data to disk. Default 50 milliseconds.
|
||||
*/
|
||||
function DeferredSave(aPath, aDataProvider, aDelay) {
|
||||
this.DeferredSave = function (aPath, aDataProvider, aDelay) {
|
||||
// Set up loggers for this instance of DeferredSave
|
||||
let leafName = OS.Path.basename(aPath);
|
||||
Cu.import("resource://gre/modules/AddonLogging.jsm");
|
||||
@ -87,7 +87,7 @@ function DeferredSave(aPath, aDataProvider, aDelay) {
|
||||
this._delay = DEFAULT_SAVE_DELAY_MS;
|
||||
}
|
||||
|
||||
DeferredSave.prototype = {
|
||||
this.DeferredSave.prototype = {
|
||||
get dirty() {
|
||||
return this._pending || this.writeInProgress;
|
||||
},
|
||||
|
@ -192,9 +192,10 @@ var gLazyObjectsLoaded = false;
|
||||
|
||||
function loadLazyObjects() {
|
||||
let scope = {};
|
||||
scope.AddonInternal = AddonInternal;
|
||||
scope.XPIProvider = XPIProvider;
|
||||
Services.scriptloader.loadSubScript("resource://gre/modules/XPIProviderUtils.js",
|
||||
scope);
|
||||
scope.XPIProvider = XPIProvider;
|
||||
|
||||
for (let name of LAZY_OBJECTS) {
|
||||
delete gGlobalScope[name];
|
||||
@ -2803,8 +2804,10 @@ var XPIProvider = {
|
||||
newAddon = loadManifestFromFile(file);
|
||||
}
|
||||
// The add-on in the manifest should match the add-on ID.
|
||||
if (newAddon.id != aId)
|
||||
throw new Error("Incorrect id in install manifest");
|
||||
if (newAddon.id != aId) {
|
||||
throw new Error("Invalid addon ID: expected addon ID " + aId +
|
||||
", found " + newAddon.id + " in manifest");
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
WARN("Add-on is invalid", e);
|
||||
@ -4246,7 +4249,6 @@ var XPIProvider = {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function getHashStringForCrypto(aCrypto) {
|
||||
// return the two-digit hexadecimal code for a byte
|
||||
function toHexString(charCode)
|
||||
|
@ -12,6 +12,8 @@ const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
|
||||
"resource://gre/modules/AddonRepository.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
|
||||
|
Loading…
x
Reference in New Issue
Block a user