Index: lib/contentPolicy.js |
=================================================================== |
--- a/lib/contentPolicy.js |
+++ b/lib/contentPolicy.js |
@@ -73,26 +73,18 @@ var Policy = exports.Policy = |
* Called on module startup, initializes various exported properties. |
*/ |
init: function() |
{ |
// whitelisted URL schemes |
for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" ")) |
this.whitelistSchemes.add(scheme); |
- let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
- .getService(Ci.nsIMessageListenerManager) |
- .QueryInterface(Ci.nsIMessageBroadcaster); |
- let handler = (message => JSON.stringify(this.shouldAllow(message.data))); |
- messageManager.addMessageListener("AdblockPlus:ShouldAllow", handler); |
- onShutdown.add(() => messageManager.removeMessageListener("AdblockPlus:ShouldAllow", handler)); |
- |
- let handler2 = () => collapsedClass; |
- messageManager.addMessageListener("AdblockPlus:GetCollapsedClass", handler2); |
- onShutdown.add(() => messageManager.removeMessageListener("AdblockPlus:GetCollapsedClass", handler2)); |
+ Utils.addChildMessageListener("AdblockPlus:ShouldAllow", this.shouldAllow.bind(this)); |
+ Utils.addChildMessageListener("AdblockPlus:GetCollapsedClass", () => collapsedClass); |
// Generate class identifier used to collapse node and register corresponding |
// stylesheet. |
let offset = "a".charCodeAt(0); |
for (let i = 0; i < 20; i++) |
collapsedClass += String.fromCharCode(offset + Math.random() * 26); |
let collapseStyle = Services.io.newURI("data:text/css," + |