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

Unified Diff: lib/requestBlocker.js

Issue 29705719: Issue 6402 - Split filter hit / request logging out into own API (Closed)
Patch Set: Addressed Manish's feedback Created May 9, 2018, 5: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 | « 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
diff --git a/lib/requestBlocker.js b/lib/requestBlocker.js
index 15719023fd8cacf9b101d2cb3078e3e993850a9d..556e9cbadd3c755195793344e2de41d9015fbc76 100644
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -28,7 +28,7 @@ const {Prefs} = require("./prefs");
const {checkWhitelisted, getKey} = require("./whitelisting");
const {extractHostFromFrame, isThirdParty} = require("./url");
const {port} = require("./messaging");
-const devtools = require("./devtools");
+const {logRequest: hitLoggerLogRequest} = require("./hitLogger");
const extensionProtocol = new URL(browser.extension.getURL("")).protocol;
@@ -118,17 +118,12 @@ function getRelatedTabIds(details)
return browser.tabs.query({url}).then(tabs => tabs.map(tab => tab.id));
}
-function logRequest(tabIds, url, type, docDomain, thirdParty,
- sitekey, specificOnly, filter)
+function logRequest(tabIds, request, filter)
{
if (filter)
FilterNotifier.emit("filter.hitCount", filter, 0, 0, tabIds);
- devtools.logRequest(
- tabIds, url, type, docDomain,
- thirdParty, sitekey,
- specificOnly, filter
- );
+ hitLoggerLogRequest(tabIds, request, filter);
}
browser.webRequest.onBeforeRequest.addListener(details =>
@@ -192,8 +187,11 @@ browser.webRequest.onBeforeRequest.addListener(details =>
getRelatedTabIds(details).then(tabIds =>
{
- logRequest(tabIds, details.url, type, docDomain,
- thirdParty, sitekey, specificOnly, filter);
+ logRequest(
+ tabIds,
+ {url: details.url, type, docDomain, thirdParty, sitekey, specificOnly},
+ filter
+ );
});
if (filter instanceof BlockingFilter)
@@ -234,13 +232,15 @@ port.on("request.blockedByRTCWrapper", (msg, sender) =>
if (checkWhitelisted(page, frame))
return false;
+ let {url} = msg;
let [docDomain, sitekey, specificOnly] = getDocumentInfo(page, frame);
- let [filter, thirdParty] = matchRequest(new URL(msg.url),
- "WEBRTC", docDomain,
+ let [filter, thirdParty] = matchRequest(new URL(url), "WEBRTC", docDomain,
sitekey, specificOnly);
-
- logRequest([sender.page.id], msg.url, "WEBRTC", docDomain,
- thirdParty, sitekey, specificOnly, filter);
+ logRequest(
+ [sender.page.id],
+ {url, type: "WEBRTC", docDomain, thirdParty, sitekey, specificOnly},
+ filter
+ );
return filter instanceof BlockingFilter;
});
« no previous file with comments | « lib/popupBlocker.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld