Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/elemHide.js

Issue 29329742: Issue 3251 - Simplify messaging from child scripts to parent (Closed)
Patch Set: Adjusted a caller that was forgotten Created Nov. 9, 2015, 1:36 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/contentPolicy.js ('k') | lib/requestNotifier.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « lib/contentPolicy.js ('k') | lib/requestNotifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld