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 Sebastian's feedback Created May 3, 2018, 3:55 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 40becb7da9e2a0be670288122aa257844d55feac..e538d52935a40db27409a3887096e943955deaa3 100644
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -28,7 +28,7 @@ const {Prefs} = require("./prefs");
const {checkWhitelisted, getKey} = require("./whitelisting");
const {stringifyURL, 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;
@@ -122,17 +122,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 =>
@@ -196,8 +191,11 @@ browser.webRequest.onBeforeRequest.addListener(details =>
getRelatedTabIds(details).then(tabIds =>
{
- logRequest(tabIds, urlString, type, docDomain,
- thirdParty, sitekey, specificOnly, filter);
+ logRequest(
+ tabIds,
+ {url: urlString, type, docDomain, thirdParty, sitekey, specificOnly},
+ filter
+ );
});
if (filter instanceof BlockingFilter)
@@ -243,8 +241,11 @@ port.on("request.blockedByRTCWrapper", (msg, sender) =>
"WEBRTC", docDomain,
sitekey, specificOnly);
- logRequest([sender.page.id], 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