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

Unified 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.
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 | « chrome/locale/en-US/global.properties ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/contentPolicy.js
===================================================================
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -104,16 +104,26 @@ var Policy = exports.Policy =
let id = iface["TYPE_" + typeName];
this.type[typeName] = id;
this.typeDescr[id] = typeName;
this.localizedDescr[id] = Utils.getString("type_label_" + typeName.toLowerCase());
this.typeMask[id] = RegExpFilter.typeMap[typeName];
}
}
+ this.type.GENERICBLOCK = 0xFFFB;
+ this.typeDescr[0xFFFB] = "GENERICBLOCK";
+ this.localizedDescr[0xFFFB] = Utils.getString("type_label_genericblock");
+ this.typeMask[0xFFFB] = RegExpFilter.typeMap.GENERICBLOCK;
+
+ this.type.GENERICHIDE = 0xFFFC;
+ this.typeDescr[0xFFFC] = "GENERICHIDE";
+ this.localizedDescr[0xFFFC] = Utils.getString("type_label_generichide");
+ this.typeMask[0xFFFC] = RegExpFilter.typeMap.GENERICHIDE;
+
this.type.ELEMHIDE = 0xFFFD;
this.typeDescr[0xFFFD] = "ELEMHIDE";
this.localizedDescr[0xFFFD] = Utils.getString("type_label_elemhide");
this.typeMask[0xFFFD] = RegExpFilter.typeMap.ELEMHIDE;
this.type.POPUP = 0xFFFE;
this.typeDescr[0xFFFE] = "POPUP";
this.localizedDescr[0xFFFE] = Utils.getString("type_label_popup");
@@ -179,28 +189,27 @@ var Policy = exports.Policy =
if (match instanceof WhitelistFilter)
{
FilterStorage.increaseHitCount(match, wnd);
RequestNotifier.addNodeData(testWnd.document, topWnd, Policy.type.DOCUMENT, getHostname(parentWndLocation), false, testWndLocation, match);
return true;
}
let genericType = (contentType == Policy.type.ELEMHIDE ?
- RegExpFilter.typeMap.GENERICHIDE :
- RegExpFilter.typeMap.GENERICBLOCK);
+ Policy.type.GENERICHIDE :
+ Policy.type.GENERICBLOCK);
let parentDocDomain = getHostname(parentWndLocation);
- let nogenericMatch = defaultMatcher.matchesAny(
- testWndLocation, genericType, parentDocDomain, false, testSitekey
- );
+ let nogenericMatch = defaultMatcher.matchesAny(testWndLocation,
+ Policy.typeMask[genericType], parentDocDomain, false, testSitekey);
if (nogenericMatch instanceof WhitelistFilter)
{
nogeneric = true;
FilterStorage.increaseHitCount(nogenericMatch, wnd);
- RequestNotifier.addNodeData(testWnd.document, topWnd, contentType,
+ RequestNotifier.addNodeData(testWnd.document, topWnd, genericType,
parentDocDomain, false, testWndLocation,
nogenericMatch);
}
if (testWnd.parent == testWnd)
break;
if (testWnd == testSitekeyWnd)
« 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