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

Unified Diff: lib/contentPolicy.js

Issue 29356078: Issue 524 - Stop using @-moz-document (Closed) Base URL: https://hg.adblockplus.org/adblockplus
Patch Set: Created Oct. 6, 2016, 11:17 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
Index: lib/contentPolicy.js
===================================================================
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -25,17 +25,16 @@ let {XPCOMUtils} = Cu.import("resource:/
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
let {Utils} = require("utils");
let {port} = require("messaging");
let {Prefs} = require("prefs");
let {FilterStorage} = require("filterStorage");
let {BlockingFilter, WhitelistFilter, RegExpFilter} = require("filterClasses");
let {defaultMatcher} = require("matcher");
-let {ElemHide} = require("elemHide");
/**
* Public policy checking functions and auxiliary objects
* @class
*/
var Policy = exports.Policy =
{
/**
@@ -108,17 +107,17 @@ var Policy = exports.Policy =
Utils.styleService.unregisterSheet(collapseStyle, Ci.nsIStyleSheetService.USER_SHEET);
});
},
/**
* Checks whether a node should be blocked, hides it if necessary
* @param {Object} data request data
* @param {String} data.contentType
- * @param {String} data.location location of the request, filter key if contentType is ELEMHIDE
+ * @param {String} data.location location of the request
* @param {Object[]} data.frames
* @param {Boolean} data.isPrivate true if the request belongs to a private browsing window
* @return {Object} An object containing properties allow, collapse and hits
* indicating how this request should be handled.
*/
shouldAllow: function({contentType, location, frames, isPrivate})
{
let hits = [];
@@ -145,52 +144,34 @@ var Policy = exports.Policy =
// Interpret unknown types as "other"
contentType = this.contentTypes.get(contentType) || "OTHER";
let nogeneric = false;
if (Prefs.enabled)
{
let whitelistHit =
- this.isFrameWhitelisted(frames, contentType == "ELEMHIDE");
+ this.isFrameWhitelisted(frames, false);
if (whitelistHit)
{
let [frameIndex, matchType, docDomain, thirdParty, location, filter] = whitelistHit;
addHit(frameIndex, matchType, docDomain, thirdParty, location, filter);
- if (matchType == "DOCUMENT" || matchType == "ELEMHIDE")
+ if (matchType == "DOCUMENT")
return response(true, false);
else
nogeneric = true;
}
}
let match = null;
let wndLocation = frames[0].location;
let docDomain = getHostname(wndLocation);
let [sitekey, sitekeyFrame] = getSitekey(frames);
- if (contentType == "ELEMHIDE")
- {
- match = ElemHide.getFilterByKey(location);
- location = match.text.replace(/^.*?#/, '#');
-
- if (!match.isActiveOnDomain(docDomain))
- return response(true, false);
- let exception = ElemHide.getException(match, docDomain);
- if (exception)
- {
- addHit(null, contentType, docDomain, false, location, exception);
- return response(true, false);
- }
-
- if (nogeneric && match.isGeneric())
- return response(true, false);
- }
-
- let thirdParty = (contentType == "ELEMHIDE" ? false : isThirdParty(location, docDomain));
+ let thirdParty = isThirdParty(location, docDomain);
let collapse = false;
if (!match && Prefs.enabled && RegExpFilter.typeMap.hasOwnProperty(contentType))
{
match = defaultMatcher.matchesAny(location, RegExpFilter.typeMap[contentType],
docDomain, thirdParty, sitekey, nogeneric);
if (match instanceof BlockingFilter && !this.nonVisualTypes.has(contentType))
collapse = (match.collapse != null ? match.collapse : !Prefs.fastcollapse);
}
« lib/child/elemHide.js ('K') | « lib/child/elemHide.js ('k') | lib/elemHideFF.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld