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

Unified Diff: lib/requestBlocker.js

Issue 29737602: Issue 4580 - Make filter/request logging use plain tabIds, prepare for multi-tab requests (Closed)
Patch Set: Created April 2, 2018, 12:27 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/requestBlocker.js
===================================================================
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -73,21 +73,20 @@
yield "CSP";
}());
-function onBeforeRequestAsync(page, url, type, docDomain,
+function onBeforeRequestAsync(tabId, url, type, docDomain,
thirdParty, sitekey,
specificOnly, filter)
{
- if (filter)
- FilterNotifier.emit("filter.hitCount", filter, 0, 0, page);
+ let tabIds = tabId != -1 ? [tabId] : [];
kzar 2018/04/03 17:14:03 Nit: Seems like switching the order and using == w
Sebastian Noack 2018/04/04 01:50:33 If you think in numbers, yes, this way around seem
- if (devtools)
- {
- devtools.logRequest(
- page, url, type, docDomain,
- thirdParty, sitekey,
- specificOnly, filter
- );
- }
+ if (filter)
+ FilterNotifier.emit("filter.hitCount", filter, 0, 0, tabIds);
+
+ devtools.logRequest(
+ tabIds, url, type, docDomain,
+ thirdParty, sitekey,
+ specificOnly, filter
+ );
}
browser.webRequest.onBeforeRequest.addListener(details =>
@@ -125,7 +124,6 @@
details.type == "sub_frame" ? details.parentFrameId : details.frameId
);
- let page = null;
let docDomain = null;
let sitekey = null;
let thirdParty = false;
@@ -133,7 +131,7 @@
if (frame)
{
- page = new ext.Page({id: details.tabId});
+ let page = new ext.Page({id: details.tabId});
if (checkWhitelisted(page, frame))
return;
@@ -152,7 +150,7 @@
docDomain, thirdParty, sitekey, specificOnly
);
- setTimeout(onBeforeRequestAsync, 0, page, urlString,
+ setTimeout(onBeforeRequestAsync, 0, details.tabId, urlString,
type, docDomain,
thirdParty, sitekey,
specificOnly, filter);

Powered by Google App Engine
This is Rietveld