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

Unified Diff: lib/elemHideFF.js

Issue 29356270: Issue 4499 - Consider $generichide exceptions when applying element hiding rules (Closed) Base URL: https://hg.adblockplus.org/adblockplus
Patch Set: Added comment to explain the logic Created Oct. 7, 2016, 10:52 a.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 | « lib/child/elemHide.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHideFF.js
===================================================================
--- a/lib/elemHideFF.js
+++ b/lib/elemHideFF.js
@@ -44,41 +44,38 @@ FilterNotifier.on("elemhideupdate", () =
port.on("getUnconditionalSelectors", () =>
{
return [
ElemHide.getUnconditionalSelectors(),
ElemHide.getUnconditionalFilterKeys()
];
});
-port.on("getSelectorsForDomain", domain =>
+port.on("getSelectorsForDomain", ([domain, specificOnly]) =>
{
- return ElemHide.getSelectorsForDomain(domain, ElemHide.NO_UNCONDITIONAL,
- true);
+ let type = specificOnly ? ElemHide.SPECIFIC_ONLY : ElemHide.NO_UNCONDITIONAL;
+ return ElemHide.getSelectorsForDomain(domain, type, true);
});
port.on("elemhideEnabled", ({frames, isPrivate}) =>
{
if (!Prefs.enabled)
return {enabled: false};
let hit = Policy.isFrameWhitelisted(frames, true);
if (hit)
{
let [frameIndex, contentType, docDomain, thirdParty, location, filter] = hit;
- if (contentType != "GENERICHIDE")
- {
- if (!isPrivate)
- FilterStorage.increaseHitCount(filter);
- return {
- enabled: false,
- contentType, docDomain, thirdParty, location,
- filter: filter.text, filterType: filter.type
- };
- }
+ if (!isPrivate)
+ FilterStorage.increaseHitCount(filter);
+ return {
+ enabled: contentType == "GENERICHIDE",
+ contentType, docDomain, thirdParty, location,
+ filter: filter.text, filterType: filter.type
+ };
}
return {enabled: true};
});
port.on("registerElemHideHit", ({key, frames, isPrivate}) =>
{
let filter = ElemHide.getFilterByKey(key);
« no previous file with comments | « lib/child/elemHide.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld