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

Unified Diff: chrome/content/cssProperties.js

Issue 29340895: Issue 3998 - cssProperties.js content script shouldn't assume that messaging will automatically kno… (Closed)
Patch Set: Created April 27, 2016, 5:18 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/cssProperties.js
===================================================================
--- a/chrome/content/cssProperties.js
+++ b/chrome/content/cssProperties.js
@@ -31,18 +31,20 @@ function splitSelector(selector)
}
}
}
selectors.push(selector.substring(start));
return selectors;
}
-function CSSPropertyFilters(window, addSelectorsFunc) {
+function CSSPropertyFilters(window, getFiltersFunc, addSelectorsFunc)
+{
this.window = window;
+ this.getFiltersFunc = getFiltersFunc;
this.addSelectorsFunc = addSelectorsFunc;
}
CSSPropertyFilters.prototype = {
stringifyStyle: function(style)
{
var styles = [];
for (var i = 0; i < style.length; i++)
@@ -117,27 +119,21 @@ CSSPropertyFilters.prototype = {
{
var stylesheet = event.target.sheet;
if (stylesheet)
this.addSelectors([stylesheet]);
},
load: function(callback)
{
- ext.backgroundPage.sendMessage(
- {
- type: "filters.get",
- what: "cssproperties"
- },
- function(patterns)
- {
- this.patterns = patterns;
- callback();
- }.bind(this)
- );
+ this.getFiltersFunc(function(patterns)
+ {
+ this.patterns = patterns;
+ callback();
+ }.bind(this));
},
apply: function()
{
if (this.patterns.length > 0)
{
var document = this.window.document;
this.addSelectors(document.styleSheets);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld