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

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

Issue 29378674: Issue 4962 - Fix the tests.- Fix syntax in chrome/content/elemHideEmulation.js to use ES5Regress… (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: changes following feedback Created March 8, 2017, 1:35 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 | test/browser/elemHideEmulation.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // We are currently limited to ECMAScript 5 in this file, because it is being 1 // We are currently limited to ECMAScript 5 in this file, because it is being
2 // used in the browser tests. See https://issues.adblockplus.org/ticket/4796 2 // used in the browser tests. See https://issues.adblockplus.org/ticket/4796
3 3
4 var propertySelectorRegExp = /\[\-abp\-properties=(["'])([^"']+)\1\]/; 4 var propertySelectorRegExp = /\[\-abp\-properties=(["'])([^"']+)\1\]/;
5 5
6 function splitSelector(selector) 6 function splitSelector(selector)
7 { 7 {
8 if (selector.indexOf(",") == -1) 8 if (selector.indexOf(",") == -1)
9 return [selector]; 9 return [selector];
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 }, 77 },
78 78
79 findSelectors: function(stylesheet, selectors, filters) 79 findSelectors: function(stylesheet, selectors, filters)
80 { 80 {
81 // Explicitly ignore third-party stylesheets to ensure consistent behavior 81 // Explicitly ignore third-party stylesheets to ensure consistent behavior
82 // between Firefox and Chrome. 82 // between Firefox and Chrome.
83 if (!this.isSameOrigin(stylesheet)) 83 if (!this.isSameOrigin(stylesheet))
84 return; 84 return;
85 85
86 let rules = stylesheet.cssRules; 86 var rules = stylesheet.cssRules;
87 if (!rules) 87 if (!rules)
88 return; 88 return;
89 89
90 for (let rule of rules) 90 for (var i = 0; i < rules.length; i++)
91 { 91 {
92 var rule = rules[i];
92 if (rule.type != rule.STYLE_RULE) 93 if (rule.type != rule.STYLE_RULE)
93 continue; 94 continue;
94 95
95 let style = this.stringifyStyle(rule.style); 96 var style = this.stringifyStyle(rule.style);
96 for (let pattern of this.patterns) 97 for (var j = 0; j < this.patterns.length; j++)
97 { 98 {
99 var pattern = this.patterns[j];
98 if (pattern.regexp.test(style)) 100 if (pattern.regexp.test(style))
99 { 101 {
100 let subSelectors = splitSelector(rule.selectorText); 102 var subSelectors = splitSelector(rule.selectorText);
101 for (let subSelector of subSelectors) 103 for (var k = 0; k < subSelectors.length; k++)
102 { 104 {
105 var subSelector = subSelectors[k];
103 selectors.push(pattern.prefix + subSelector + pattern.suffix); 106 selectors.push(pattern.prefix + subSelector + pattern.suffix);
104 filters.push(pattern.text); 107 filters.push(pattern.text);
105 } 108 }
106 } 109 }
107 } 110 }
108 } 111 }
109 }, 112 },
110 113
111 addSelectors: function(stylesheets) 114 addSelectors: function(stylesheets)
112 { 115 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 158
156 if (this.patterns.length > 0) 159 if (this.patterns.length > 0)
157 { 160 {
158 var document = this.window.document; 161 var document = this.window.document;
159 this.addSelectors(document.styleSheets); 162 this.addSelectors(document.styleSheets);
160 document.addEventListener("load", this.onLoad.bind(this), true); 163 document.addEventListener("load", this.onLoad.bind(this), true);
161 } 164 }
162 }.bind(this)); 165 }.bind(this));
163 } 166 }
164 }; 167 };
OLDNEW
« no previous file with comments | « no previous file | test/browser/elemHideEmulation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld