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

Side by Side Diff: chrome/content/cssProperties.js

Issue 29340588: Issue 3879 - CSS property filters ignore third-party stylesheets in Chrome but not in Firefox (Closed)
Patch Set: Created April 19, 2016, 2:32 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function splitSelector(selector) 1 function splitSelector(selector)
2 { 2 {
3 if (selector.indexOf(",") == -1) 3 if (selector.indexOf(",") == -1)
4 return [selector]; 4 return [selector];
5 5
6 var selectors = []; 6 var selectors = [];
7 var start = 0; 7 var start = 0;
8 var level = 0; 8 var level = 0;
9 var sep = ""; 9 var sep = "";
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 var value = style.getPropertyValue(property); 51 var value = style.getPropertyValue(property);
52 var priority = style.getPropertyPriority(property); 52 var priority = style.getPropertyPriority(property);
53 styles.push(property + ": " + value + (priority ? " !" + priority : "") + ";"); 53 styles.push(property + ": " + value + (priority ? " !" + priority : "") + ";");
54 } 54 }
55 styles.sort(); 55 styles.sort();
56 return styles.join(" "); 56 return styles.join(" ");
57 }, 57 },
58 58
59 findSelectors: function(stylesheet, selectors) 59 findSelectors: function(stylesheet, selectors)
60 { 60 {
61 try
62 {
63 // Explicitly ignore third-party stylesheets to ensure consistent behavior
64 // between Firefox and Chrome.
65 if (stylesheet.href &&
66 new URL(stylesheet.href).origin != this.window.location.origin)
67 {
68 return;
69 }
70 }
71 catch (e)
72 {
73 // An invalid URL, can be ignored.
74 Cu.reportError(e);
75 }
76
61 var rules = stylesheet.cssRules; 77 var rules = stylesheet.cssRules;
62 if (!rules) 78 if (!rules)
63 return; 79 return;
64 80
65 for (var i = 0; i < rules.length; i++) 81 for (var i = 0; i < rules.length; i++)
66 { 82 {
67 var rule = rules[i]; 83 var rule = rules[i];
68 if (rule.type != rule.STYLE_RULE) 84 if (rule.type != rule.STYLE_RULE)
69 continue; 85 continue;
70 86
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 apply: function() 136 apply: function()
121 { 137 {
122 if (this.patterns.length > 0) 138 if (this.patterns.length > 0)
123 { 139 {
124 var document = this.window.document; 140 var document = this.window.document;
125 this.addSelectors(document.styleSheets); 141 this.addSelectors(document.styleSheets);
126 document.addEventListener("load", this.onLoad.bind(this), true); 142 document.addEventListener("load", this.onLoad.bind(this), true);
127 } 143 }
128 } 144 }
129 }; 145 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld