[Pkg-mozext-commits] [adblock-plus] 68/87: Issue 3879 - CSS property filters ignore third-party stylesheets in Chrome but not in Firefox

David Prévot taffit at moszumanska.debian.org
Sat Apr 30 17:59:09 UTC 2016


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

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

commit 7cfbf64a929ab74aa5bb390ca427db8a75031502
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Tue Apr 19 16:08:41 2016 +0200

    Issue 3879 - CSS property filters ignore third-party stylesheets in Chrome but not in Firefox
---
 chrome/content/cssProperties.js | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/chrome/content/cssProperties.js b/chrome/content/cssProperties.js
index 0106071..81ec078 100644
--- a/chrome/content/cssProperties.js
+++ b/chrome/content/cssProperties.js
@@ -56,8 +56,26 @@ CSSPropertyFilters.prototype = {
     return styles.join(" ");
   },
 
+  isSameOrigin: function(stylesheet)
+  {
+    try
+    {
+      return new URL(stylesheet.href).origin == this.window.location.origin;
+    }
+    catch (e)
+    {
+      // Invalid URL, assume that it is first-party.
+      return true;
+    }
+  },
+
   findSelectors: function(stylesheet, selectors)
   {
+    // Explicitly ignore third-party stylesheets to ensure consistent behavior
+    // between Firefox and Chrome.
+    if (!this.isSameOrigin(stylesheet))
+      return;
+
     var rules = stylesheet.cssRules;
     if (!rules)
       return;

-- 
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