Index: lib/contentPolicy.js |
=================================================================== |
--- a/lib/contentPolicy.js |
+++ b/lib/contentPolicy.js |
@@ -76,22 +76,16 @@ var Policy = exports.Policy = |
*/ |
whitelistSchemes: new Set(), |
/** |
* Called on module startup, initializes various exported properties. |
*/ |
init: function() |
{ |
- // Populate types map |
- let iface = Ci.nsIContentPolicy; |
- for (let name in iface) |
- if (name.indexOf("TYPE_") == 0 && name != "TYPE_DATAREQUEST") |
- types.set(iface[name], name.substr(5)); |
- |
// whitelisted URL schemes |
for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" ")) |
this.whitelistSchemes.add(scheme); |
// Generate class identifier used to collapse node and register corresponding |
// stylesheet. |
let offset = "a".charCodeAt(0); |
for (let i = 0; i < 20; i++) |
@@ -341,16 +335,22 @@ var PolicyImplementation = |
contractID: "@adblockplus.org/abp/policy;1", |
xpcom_categories: ["content-policy", "net-channel-event-sinks"], |
/** |
* Registers the content policy on startup. |
*/ |
init: function() |
{ |
+ // Populate types map |
+ let iface = Ci.nsIContentPolicy; |
+ for (let name in iface) |
+ if (name.indexOf("TYPE_") == 0 && name != "TYPE_DATAREQUEST") |
+ types.set(iface[name], name.substr(5)); |
+ |
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
registrar.registerFactory(this.classID, this.classDescription, this.contractID, this); |
let catMan = Utils.categoryManager; |
for (let category of this.xpcom_categories) |
catMan.addCategoryEntry(category, this.contractID, this.contractID, false, true); |
Services.obs.addObserver(this, "content-document-global-created", true); |