Index: chrome/content/cssProperties.js |
=================================================================== |
--- a/chrome/content/cssProperties.js |
+++ b/chrome/content/cssProperties.js |
@@ -66,17 +66,17 @@ CSSPropertyFilters.prototype = { |
} |
catch (e) |
{ |
// Invalid URL, assume that it is first-party. |
return true; |
} |
}, |
- findSelectors: function(stylesheet, selectors) |
+ findSelectors: function(stylesheet, selectors, filters) |
{ |
// Explicitly ignore third-party stylesheets to ensure consistent behavior |
// between Firefox and Chrome. |
if (!this.isSameOrigin(stylesheet)) |
return; |
var rules = stylesheet.cssRules; |
if (!rules) |
@@ -97,27 +97,29 @@ CSSPropertyFilters.prototype = { |
if (typeof regexp == "string") |
regexp = pattern.regexp = new RegExp(regexp); |
if (regexp.test(style)) |
{ |
var subSelectors = splitSelector(rule.selectorText); |
for (var k = 0; k < subSelectors.length; k++) |
selectors.push(pattern.prefix + subSelectors[k] + pattern.suffix); |
+ filters[pattern.text] = true; |
} |
} |
} |
}, |
addSelectors: function(stylesheets) |
{ |
var selectors = []; |
+ var filters = {}; |
for (var i = 0; i < stylesheets.length; i++) |
- this.findSelectors(stylesheets[i], selectors); |
- this.addSelectorsFunc(selectors); |
+ this.findSelectors(stylesheets[i], selectors, filters); |
+ this.addSelectorsFunc(selectors, Object.keys(filters)); |
}, |
onLoad: function(event) |
{ |
var stylesheet = event.target.sheet; |
if (stylesheet) |
this.addSelectors([stylesheet]); |
}, |