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

Side by Side Diff: lib/contentPolicy.js

Issue 29329367: Issue 3208 - Log generichide and genericblock hits with the correct content type (Closed)
Patch Set: Created Oct. 26, 2015, 7:53 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 | « chrome/locale/en-US/global.properties ('k') | 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 file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if ("TYPE_" + typeName in iface) 102 if ("TYPE_" + typeName in iface)
103 { 103 {
104 let id = iface["TYPE_" + typeName]; 104 let id = iface["TYPE_" + typeName];
105 this.type[typeName] = id; 105 this.type[typeName] = id;
106 this.typeDescr[id] = typeName; 106 this.typeDescr[id] = typeName;
107 this.localizedDescr[id] = Utils.getString("type_label_" + typeName.toLow erCase()); 107 this.localizedDescr[id] = Utils.getString("type_label_" + typeName.toLow erCase());
108 this.typeMask[id] = RegExpFilter.typeMap[typeName]; 108 this.typeMask[id] = RegExpFilter.typeMap[typeName];
109 } 109 }
110 } 110 }
111 111
112 this.type.GENERICBLOCK = 0xFFFB;
113 this.typeDescr[0xFFFB] = "GENERICBLOCK";
114 this.localizedDescr[0xFFFB] = Utils.getString("type_label_genericblock");
115 this.typeMask[0xFFFB] = RegExpFilter.typeMap.GENERICBLOCK;
116
117 this.type.GENERICHIDE = 0xFFFC;
118 this.typeDescr[0xFFFC] = "GENERICHIDE";
119 this.localizedDescr[0xFFFC] = Utils.getString("type_label_generichide");
120 this.typeMask[0xFFFC] = RegExpFilter.typeMap.GENERICHIDE;
121
112 this.type.ELEMHIDE = 0xFFFD; 122 this.type.ELEMHIDE = 0xFFFD;
113 this.typeDescr[0xFFFD] = "ELEMHIDE"; 123 this.typeDescr[0xFFFD] = "ELEMHIDE";
114 this.localizedDescr[0xFFFD] = Utils.getString("type_label_elemhide"); 124 this.localizedDescr[0xFFFD] = Utils.getString("type_label_elemhide");
115 this.typeMask[0xFFFD] = RegExpFilter.typeMap.ELEMHIDE; 125 this.typeMask[0xFFFD] = RegExpFilter.typeMap.ELEMHIDE;
116 126
117 this.type.POPUP = 0xFFFE; 127 this.type.POPUP = 0xFFFE;
118 this.typeDescr[0xFFFE] = "POPUP"; 128 this.typeDescr[0xFFFE] = "POPUP";
119 this.localizedDescr[0xFFFE] = Utils.getString("type_label_popup"); 129 this.localizedDescr[0xFFFE] = Utils.getString("type_label_popup");
120 this.typeMask[0xFFFE] = RegExpFilter.typeMap.POPUP; 130 this.typeMask[0xFFFE] = RegExpFilter.typeMap.POPUP;
121 131
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 match = Policy.isWhitelisted(testWndLocation, parentWndLocation, testSit ekey); 187 match = Policy.isWhitelisted(testWndLocation, parentWndLocation, testSit ekey);
178 188
179 if (match instanceof WhitelistFilter) 189 if (match instanceof WhitelistFilter)
180 { 190 {
181 FilterStorage.increaseHitCount(match, wnd); 191 FilterStorage.increaseHitCount(match, wnd);
182 RequestNotifier.addNodeData(testWnd.document, topWnd, Policy.type.DOCU MENT, getHostname(parentWndLocation), false, testWndLocation, match); 192 RequestNotifier.addNodeData(testWnd.document, topWnd, Policy.type.DOCU MENT, getHostname(parentWndLocation), false, testWndLocation, match);
183 return true; 193 return true;
184 } 194 }
185 195
186 let genericType = (contentType == Policy.type.ELEMHIDE ? 196 let genericType = (contentType == Policy.type.ELEMHIDE ?
187 RegExpFilter.typeMap.GENERICHIDE : 197 Policy.type.GENERICHIDE :
188 RegExpFilter.typeMap.GENERICBLOCK); 198 Policy.type.GENERICBLOCK);
189 let parentDocDomain = getHostname(parentWndLocation); 199 let parentDocDomain = getHostname(parentWndLocation);
190 let nogenericMatch = defaultMatcher.matchesAny( 200 let nogenericMatch = defaultMatcher.matchesAny(testWndLocation,
191 testWndLocation, genericType, parentDocDomain, false, testSitekey 201 Policy.typeMask[genericType], parentDocDomain, false, testSitekey);
192 );
193 if (nogenericMatch instanceof WhitelistFilter) 202 if (nogenericMatch instanceof WhitelistFilter)
194 { 203 {
195 nogeneric = true; 204 nogeneric = true;
196 205
197 FilterStorage.increaseHitCount(nogenericMatch, wnd); 206 FilterStorage.increaseHitCount(nogenericMatch, wnd);
198 RequestNotifier.addNodeData(testWnd.document, topWnd, contentType, 207 RequestNotifier.addNodeData(testWnd.document, topWnd, genericType,
199 parentDocDomain, false, testWndLocation, 208 parentDocDomain, false, testWndLocation,
200 nogenericMatch); 209 nogenericMatch);
201 } 210 }
202 211
203 if (testWnd.parent == testWnd) 212 if (testWnd.parent == testWnd)
204 break; 213 break;
205 214
206 if (testWnd == testSitekeyWnd) 215 if (testWnd == testSitekeyWnd)
207 [testSitekey, testSitekeyWnd] = getSitekey(testWnd.parent); 216 [testSitekey, testSitekeyWnd] = getSitekey(testWnd.parent);
208 testWnd = testWnd.parent; 217 testWnd = testWnd.parent;
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 if (!wnd || wnd.closed) 827 if (!wnd || wnd.closed)
819 return; 828 return;
820 829
821 if (entry.type == Policy.type.OBJECT) 830 if (entry.type == Policy.type.OBJECT)
822 { 831 {
823 node.removeEventListener("mouseover", objectMouseEventHander, true); 832 node.removeEventListener("mouseover", objectMouseEventHander, true);
824 node.removeEventListener("mouseout", objectMouseEventHander, true); 833 node.removeEventListener("mouseout", objectMouseEventHander, true);
825 } 834 }
826 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; 835 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ;
827 } 836 }
OLDNEW
« no previous file with comments | « chrome/locale/en-US/global.properties ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld