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

Unified Diff: lib/requestBlocker.js

Issue 29998582: Issue [TBD] - Update adblockpluscore dependency to [TBD] Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Feb. 5, 2019, 4:07 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
« lib/csp.js ('K') | « lib/popupBlocker.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/requestBlocker.js
===================================================================
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -19,17 +19,16 @@
"use strict";
const {Filter, RegExpFilter, BlockingFilter} =
require("../adblockpluscore/lib/filterClasses");
const {Subscription} = require("../adblockpluscore/lib/subscriptionClasses");
const {defaultMatcher} = require("../adblockpluscore/lib/matcher");
const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier");
-const {isThirdParty} = require("../adblockpluscore/lib/domain");
const {Prefs} = require("./prefs");
const {checkWhitelisted, getKey} = require("./whitelisting");
const {extractHostFromFrame} = require("./url");
const {port} = require("./messaging");
const {logRequest: hitLoggerLogRequest} = require("./hitLogger");
const extensionProtocol = new URL(browser.extension.getURL("")).protocol;
@@ -85,21 +84,18 @@
getKey(page, frame, originUrl),
!!checkWhitelisted(page, frame, originUrl,
RegExpFilter.typeMap.GENERICBLOCK)
];
}
function matchRequest(url, type, docDomain, sitekey, specificOnly)
Sebastian Noack 2019/02/05 04:41:43 With the third-party check removed, keeping this h
Manish Jethani 2019/02/05 05:16:20 Done.
{
- let thirdParty = isThirdParty(url, docDomain);
- let filter = defaultMatcher.matchesAny(url.href, RegExpFilter.typeMap[type],
- docDomain, thirdParty,
- sitekey, specificOnly);
- return [filter, thirdParty];
+ return defaultMatcher.matchesAny(url, RegExpFilter.typeMap[type],
+ docDomain, sitekey, specificOnly);
}
function getRelatedTabIds(details)
{
// This is the common case, the request is associated with a single tab.
// If tabId is -1, its not (e.g. the request was sent by
// a Service/Shared Worker) and we have to identify the related tabs.
if (details.tabId != -1)
@@ -183,18 +179,17 @@
return;
if (checkWhitelisted(page, frame, originUrl))
return;
let type = resourceTypes.get(details.type) || "OTHER";
let [docDomain, sitekey, specificOnly] = getDocumentInfo(page, frame,
originUrl);
- let [filter, thirdParty] = matchRequest(url, type, docDomain,
- sitekey, specificOnly);
+ let filter = matchRequest(url, type, docDomain, sitekey, specificOnly);
let result;
let rewrittenUrl;
if (filter instanceof BlockingFilter)
{
if (typeof filter.rewrite == "string")
{
@@ -208,17 +203,17 @@
result = {cancel: true};
}
getRelatedTabIds(details).then(tabIds =>
{
logRequest(
tabIds,
{
- url: details.url, type, docDomain, thirdParty,
+ url: details.url, type, docDomain,
sitekey, specificOnly, rewrittenUrl
},
filter
);
});
return result;
}, {urls: ["<all_urls>"]}, ["blocking"]);
@@ -230,19 +225,19 @@
if (checkWhitelisted(page, frame))
return false;
let blocked = false;
let [docDomain, sitekey, specificOnly] = getDocumentInfo(page, frame);
for (let url of message.urls)
{
- let [filter] = matchRequest(new URL(url, message.baseURL),
- message.mediatype, docDomain,
- sitekey, specificOnly);
+ let filter = matchRequest(new URL(url, message.baseURL),
+ message.mediatype, docDomain,
+ sitekey, specificOnly);
if (filter instanceof BlockingFilter)
{
if (filter.collapse != null)
return filter.collapse;
blocked = true;
}
}
@@ -254,21 +249,21 @@
{
let {page, frame} = sender;
if (checkWhitelisted(page, frame))
return false;
let {url} = msg;
let [docDomain, sitekey, specificOnly] = getDocumentInfo(page, frame);
- let [filter, thirdParty] = matchRequest(new URL(url), "WEBRTC", docDomain,
- sitekey, specificOnly);
+ let filter = matchRequest(new URL(url), "WEBRTC", docDomain, sitekey,
+ specificOnly);
logRequest(
[sender.page.id],
- {url, type: "WEBRTC", docDomain, thirdParty, sitekey, specificOnly},
+ {url, type: "WEBRTC", docDomain, sitekey, specificOnly},
filter
);
return filter instanceof BlockingFilter;
});
let ignoreFilterNotifications = false;
let handlerBehaviorChangedQuota =
« lib/csp.js ('K') | « lib/popupBlocker.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld