Index: lib/elemHide.js |
=================================================================== |
--- a/lib/elemHide.js |
+++ b/lib/elemHide.js |
@@ -75,25 +75,19 @@ let ElemHide = exports.ElemHide = |
*/ |
applied: false, |
/** |
* Called on module startup. |
*/ |
init: function() |
{ |
- let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"] |
- .getService(Ci.nsIMessageListenerManager); |
- let hitHandler = (message => { |
- let result = ElemHide.shouldHide(message.data); |
- let target = message.target.QueryInterface(Ci.nsIMessageSender); |
- target.sendAsyncMessage(message.data.responseMessage, result); |
+ Utils.addChildMessageListener("AdblockPlus:ElemHideHit", (data) => { |
+ return ElemHide.shouldHide(data); |
}); |
- messageManager.addMessageListener("AdblockPlus:ElemHideHit", hitHandler); |
- onShutdown.add(() => messageManager.removeMessageListener("AdblockPlus:ElemHideHit", hitHandler)); |
Prefs.addListener(function(name) |
{ |
if (name == "enabled") |
ElemHide.apply(); |
}); |
onShutdown.add(() => ElemHide.unapply()); |