[Pkg-mozext-commits] [adblock-plus] 03/98: Issue 4001 - Update dependency on adblockpluscore to revision d576e2dac412

David Prévot taffit at moszumanska.debian.org
Tue Oct 24 01:30:12 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit ff28c9fb677abb051aafea881e8b1c7581eb988a
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Wed Apr 27 20:25:38 2016 +0200

    Issue 4001 - Update dependency on adblockpluscore to revision d576e2dac412
---
 dependencies               |  2 +-
 lib/child/cssProperties.js | 49 ++++++++++++++++++++--------------------------
 2 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/dependencies b/dependencies
index 322d972..25b5979 100644
--- a/dependencies
+++ b/dependencies
@@ -1,5 +1,5 @@
 _root = hg:https://hg.adblockplus.org/ git:https://github.com/adblockplus/
 _self = buildtools/ensure_dependencies.py
 buildtools = buildtools hg:3816c08c0f98 git:93e54d4
-adblockpluscore = adblockpluscore hg:5d9618f68a0c git:0f979e7
+adblockpluscore = adblockpluscore hg:d576e2dac412 git:8c6e1bd
 adblockplusui = adblockplusui hg:eaf7a04285fa git:d6484f7
diff --git a/lib/child/cssProperties.js b/lib/child/cssProperties.js
index 7ae9f26..3c9a0fa 100644
--- a/lib/child/cssProperties.js
+++ b/lib/child/cssProperties.js
@@ -24,22 +24,17 @@
   let {port} = require("messaging");
   let {getFrames} = require("child/utils");
 
-  let senderWindow = null;
-
-  let scope = {
-    ext: {
-      backgroundPage: {
-        sendMessage: function(payload, callback)
-        {
-          let message = {payload, frames: getFrames(senderWindow)};
-          if (typeof callback == "function")
-            port.emitWithResponse("ext_message", message).then(callback);
-          else
-            port.emit("ext_message", message);
-        }
+  function getFilters(window, callback)
+  {
+    let message = {
+      frames: getFrames(window),
+      payload: {
+        type: "filters.get",
+        what: "cssproperties"
       }
-    }
-  };
+    };
+    port.emitWithResponse("ext_message", message).then(callback);
+  }
 
   function addUserCSS(window, cssCode)
   {
@@ -52,6 +47,7 @@
 
   function initCSSPropertyFilters()
   {
+    let scope = {};
     Services.scriptloader.loadSubScript(
         "chrome://adblockplus/content/cssProperties.js", scope);
 
@@ -63,22 +59,19 @@
       let onReady = event =>
       {
         subject.removeEventListener("load", onReady);
-        let handler = new scope.CSSPropertyFilters(subject, selectors =>
-        {
-          if (selectors.length == 0)
-            return;
+        let handler = new scope.CSSPropertyFilters(
+          subject, getFilters.bind(null, subject), selectors =>
+          {
+            if (selectors.length == 0)
+              return;
 
-          addUserCSS(subject, selectors.map(
-            selector => selector + "{display: none !important;}"
-          ).join("\n"));
-        });
+            addUserCSS(subject, selectors.map(
+              selector => selector + "{display: none !important;}"
+            ).join("\n"));
+          }
+        );
 
-        // HACK: The content script just calls ext.backgroundPage.sendMessage
-        // without indicating which window this is about. We'll store the window
-        // here because we know that messaging happens synchronously.
-        senderWindow = subject;
         handler.load(() => handler.apply());
-        senderWindow = null;
       };
 
       subject.addEventListener("load", onReady);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list