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

Unified Diff: lib/requestBlocker.js

Issue 29777646: Issue 6586 - Handle intiator of "null" on Chrome >=66 (Closed)
Patch Set: Created May 10, 2018, 3:39 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 | « no previous file | no next file » | 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
@@ -112,8 +112,9 @@
url = details.originUrl; // In case of Service/Shared Worker, this is the
// URL of the tab that caused the worker to spawn.
- else if (details.initiator) // Chromium >=63 provides "intiator" which
- url = details.initiator + "/*"; // is equivalent to "originUrl" on Firefox
+ else if (details.initiator && details.initiator != "null")
kzar 2018/05/11 12:50:17 Why are you comparing it to the string "null" inst
Sebastian Noack 2018/05/11 12:52:40 Because that is what Chrome >=66 sets the value to
kzar 2018/05/11 12:58:56 Weird, that sounds like a bug, did you report it?
Sebastian Noack 2018/05/11 13:04:44 Well, that behavior matches the documentation: htt
+ url = details.initiator + "/*"; // Chromium >=63 provides "intiator" which
+ // is equivalent to "originUrl" on Firefox
// except that its not a full URL but just
// an origin (proto + host).
else
@@ -154,8 +155,11 @@
// Firefox provides us with the full origin URL, while Chromium (>=63)
// provides only the protocol + host of the (top-level) document which
// the request originates from through the "initiator" property.
- let originUrl = details.originUrl ? new URL(details.originUrl) :
- details.initiator ? new URL(details.initiator) : null;
+ let originUrl = null;
+ if (details.originUrl)
+ originUrl = new URL(details.originUrl);
+ else if (details.initiator && details.initiator != "null")
+ originUrl = new URL(details.initiator);
// Ignore requests sent by extensions or by Firefox itself:
// * Firefox intercepts requests sent by any extensions, indicated with
@@ -179,8 +183,8 @@
);
// On Chromium >= 63, if both the frame is unknown and we haven't get
- // an "initator", this implies a request sent by the browser itself
- // (on older versions of Chromium, due to the lack of "initator",
+ // an "initiator", this implies a request sent by the browser itself
Sebastian Noack 2018/05/10 15:41:40 Just fixed a typo here.
kzar 2018/05/11 12:50:17 Acknowledged.
+ // (on older versions of Chromium, due to the lack of "initiator",
// this can also indicate a request sent by a Shared/Service Worker).
if (!frame && !originUrl)
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld