make use of Chromium 63's webRequest's new `initiator` property

This commit is contained in:
Raymond Hill 2018-03-30 15:29:46 -04:00
parent b22c193cf2
commit b7e5c9af49
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 12 additions and 0 deletions

View File

@ -104,7 +104,19 @@ vAPI.net.registerListeners = function() {
return '';
};
var reNetworkURI = /^(?:ftps?|https?|wss?)/;
var normalizeRequestDetails = function(details) {
// Chromium 63+ supports the `initiator` property, which contains
// the URL of the origin from which the network request was made.
if (
details.tabId === vAPI.noTabId &&
reNetworkURI.test(details.initiator)
) {
details.tabId = vAPI.anyTabId;
details.documentUrl = details.initiator;
}
var type = details.type;
// https://github.com/gorhill/uBlock/issues/1493