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

Side by Side Diff: lib/matcher.js

Issue 8686043: Make sure that custom filters cannot break our options page (Closed)
Patch Set: Created Oct. 25, 2012, 10:34 a.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 /* 1 /*
2 * This Source Code is subject to the terms of the Mozilla Public License 2 * This Source Code is subject to the terms of the Mozilla Public License
3 * version 2.0 (the "License"). You can obtain a copy of the License at 3 * version 2.0 (the "License"). You can obtain a copy of the License at
4 * http://mozilla.org/MPL/2.0/. 4 * http://mozilla.org/MPL/2.0/.
5 */ 5 */
6 6
7 // 7 //
8 // This mimicks the API of the Matcher module in ABP/Firefox but users Opera's 8 // This mimicks the API of the Matcher module in ABP/Firefox but users Opera's
9 // URLFilter API. 9 // URLFilter API.
10 // 10 //
11 11
12 (function() 12 (function()
13 { 13 {
14 // Make sure that filters don't apply to extension pages. We shouldn't allow
15 // users to break our options page unintentionally, recovering is very hard
16 // if they do.
17 opera.extension.urlfilter.allow.add("widget://*");
18
14 var WhitelistFilter = null; 19 var WhitelistFilter = null;
15 var RegExpFilter = null; 20 var RegExpFilter = null;
16 var resourceTypes = [ 21 var resourceTypes = [
17 "DOCUMENT", "FONT", "IMAGE", "MEDIA", "OBJECT", "OBJECT_SUBREQUEST", 22 "DOCUMENT", "FONT", "IMAGE", "MEDIA", "OBJECT", "OBJECT_SUBREQUEST",
18 "OTHER", "SCRIPT", "STYLESHEET", "SUBDOCUMENT", "XMLHTTPREQUEST" 23 "OTHER", "SCRIPT", "STYLESHEET", "SUBDOCUMENT", "XMLHTTPREQUEST"
19 ]; 24 ];
20 25
21 require.scopes.matcher = 26 require.scopes.matcher =
22 { 27 {
23 defaultMatcher: 28 defaultMatcher:
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 for (var text in this._rules) 171 for (var text in this._rules)
167 { 172 {
168 var rule = this._rules[text]; 173 var rule = this._rules[text];
169 opera.extension.urlfilter[rule.type].remove(rule.text); 174 opera.extension.urlfilter[rule.type].remove(rule.text);
170 } 175 }
171 this._rules = {}; 176 this._rules = {};
172 } 177 }
173 } 178 }
174 }; 179 };
175 })(); 180 })();
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