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

This commit is contained in:
Raymond Hill 2018-03-30 15:29:46 -04:00
parent b22c193cf2
commit 0ba8c33a40
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 ''; return '';
}; };
var reNetworkURI = /^(?:ftps?|https?|wss?)/;
var normalizeRequestDetails = function(details) { 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; var type = details.type;
// https://github.com/gorhill/uBlock/issues/1493 // https://github.com/gorhill/uBlock/issues/1493