Commit 0b80394c authored by Alex Catarineu's avatar Alex Catarineu
Browse files

Bug 40002: Fix generateNSGetFactory being moved to ComponentUtils

This was changed in https://bugzilla.mozilla.org/show_bug.cgi?id=1649554.
parent 11848e8c
......@@ -11,6 +11,10 @@
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
});
// Make the logger available.
let logger = Cc["@torproject.org/torbutton-logger;1"]
.getService(Ci.nsISupports).wrappedJSObject;
......@@ -199,4 +203,6 @@ DomainIsolator.prototype = {
};
// Assign factory to global object.
const NSGetFactory = XPCOMUtils.generateNSGetFactory([DomainIsolator]);
const NSGetFactory = XPCOMUtils.generateNSGetFactory
? XPCOMUtils.generateNSGetFactory([DomainIsolator])
: ComponentUtils.generateNSGetFactory([DomainIsolator]);
......@@ -9,6 +9,10 @@
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
});
// Module specific constants
const kMODULE_NAME = "Torbutton Drag and Drop Handler";
const kCONTRACT_ID = "@torproject.org/torbutton-dragDropFilter;1";
......@@ -79,4 +83,7 @@ DragDropFilter.prototype =
}
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([DragDropFilter]);
// Assign factory to global object.
const NSGetFactory = XPCOMUtils.generateNSGetFactory
? XPCOMUtils.generateNSGetFactory([DragDropFilter])
: ComponentUtils.generateNSGetFactory([DragDropFilter]);
......@@ -16,6 +16,10 @@ const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { PromptUtils } = ChromeUtils.import("resource://gre/modules/SharedPromptUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
});
let { torbutton_get_property_string } = ChromeUtils.import("resource://torbutton/modules/utils.js", {});
// Module specific constants
......@@ -131,4 +135,7 @@ ExternalAppBlocker.prototype =
},
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ExternalAppBlocker]);
// Assign factory to global object.
const NSGetFactory = XPCOMUtils.generateNSGetFactory
? XPCOMUtils.generateNSGetFactory([ExternalAppBlocker])
: ComponentUtils.generateNSGetFactory([ExternalAppBlocker]);
......@@ -15,6 +15,10 @@
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
});
XPCOMUtils.defineLazyModuleGetters(this, {
FileUtils: "resource://gre/modules/FileUtils.jsm",
FileSource: "resource://gre/modules/L10nRegistry.jsm",
......@@ -205,4 +209,7 @@ StartupObserver.prototype = {
_xpcom_categories: [{category:"profile-after-change"}],
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([StartupObserver]);
// Assign factory to global object.
const NSGetFactory = XPCOMUtils.generateNSGetFactory
? XPCOMUtils.generateNSGetFactory([StartupObserver])
: ComponentUtils.generateNSGetFactory([StartupObserver]);
......@@ -10,6 +10,10 @@
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
});
// Module specific constants
const kMODULE_NAME = "Torbutton Tor Check Service";
const kMODULE_CONTRACTID = "@torproject.org/torbutton-torCheckService;1";
......@@ -131,4 +135,7 @@ TBTorCheckService.prototype =
},
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([TBTorCheckService]);
// Assign factory to global object.
const NSGetFactory = XPCOMUtils.generateNSGetFactory
? XPCOMUtils.generateNSGetFactory([TBTorCheckService])
: ComponentUtils.generateNSGetFactory([TBTorCheckService]);
......@@ -16,6 +16,10 @@ const kMODULE_CID = Components.ID("f36d72c9-9718-4134-b550-e109638331d7");
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
ComponentUtils: "resource://gre/modules/ComponentUtils.jsm",
});
function TorbuttonLogger() {
// Register observer
Services.prefs.addObserver("extensions.torbutton", this);
......@@ -154,11 +158,7 @@ TorbuttonLogger.prototype =
}
}
/**
* XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2 (Firefox 4).
* XPCOMUtils.generateNSGetModule is for Mozilla 1.9.2 (Firefox 3.6).
*/
if (XPCOMUtils.generateNSGetFactory)
var NSGetFactory = XPCOMUtils.generateNSGetFactory([TorbuttonLogger]);
else
var NSGetModule = XPCOMUtils.generateNSGetModule([TorbuttonLogger]);
// Assign factory to global object.
const NSGetFactory = XPCOMUtils.generateNSGetFactory
? XPCOMUtils.generateNSGetFactory([TorbuttonLogger])
: ComponentUtils.generateNSGetFactory([TorbuttonLogger]);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment