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: Created Nov. 4, 2015, 2:58 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
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());
« lib/child/bootstrap.js ('K') | « lib/contentPolicy.js ('k') | lib/requestNotifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld