diff --git a/src/js/filtering-context.js b/src/js/filtering-context.js index 8c0855c82..0380f7b62 100644 --- a/src/js/filtering-context.js +++ b/src/js/filtering-context.js @@ -84,8 +84,9 @@ } } } else if ( details.documentUrl !== undefined ) { - this.setTabOriginFromURL(details.documentUrl); - this.setDocOriginFromURL(details.documentUrl); + const normalURL = µBlock.normalizePageURL(0, details.documentUrl); + this.setTabOriginFromURL(normalURL); + this.setDocOriginFromURL(normalURL); } else { this.setDocOrigin(this.tabOrigin); } diff --git a/src/js/tab.js b/src/js/tab.js index 8146f84b2..ea8ec1e96 100644 --- a/src/js/tab.js +++ b/src/js/tab.js @@ -46,16 +46,16 @@ var µb = µBlock; /******************************************************************************/ µb.normalizePageURL = function(tabId, pageURL) { - if ( vAPI.isBehindTheSceneTabId(tabId) ) { + if ( tabId < 0 ) { return 'http://behind-the-scene/'; } - var uri = this.URI.set(pageURL); - var scheme = uri.scheme; + const uri = this.URI.set(pageURL); + const scheme = uri.scheme; if ( scheme === 'https' || scheme === 'http' ) { return uri.normalizedURI(); } - var fakeHostname = scheme + '-scheme'; + let fakeHostname = scheme + '-scheme'; if ( uri.hostname !== '' ) { fakeHostname = uri.hostname + '.' + fakeHostname; diff --git a/src/js/traffic.js b/src/js/traffic.js index 1d5d0ba57..a6c7283f7 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -284,7 +284,7 @@ const onBeforeBehindTheSceneRequest = function(fctxt) { let result = 0; if ( - µb.URI.isNetworkURI(fctxt.docOrigin) || + µb.URI.isNetworkURI(fctxt.tabOrigin) || µb.userSettings.advancedUserEnabled || fctxt.type === 'csp_report' ) { diff --git a/src/js/uritools.js b/src/js/uritools.js index 7225aee8f..6d5a12742 100644 --- a/src/js/uritools.js +++ b/src/js/uritools.js @@ -410,7 +410,7 @@ URI.isNetworkURI = function(uri) { return reNetworkURI.test(uri); }; -var reNetworkURI = /^(?:ftps?|https?|wss?):\/\//; +const reNetworkURI = /^(?:ftps?|https?|wss?):\/\//; /******************************************************************************/ @@ -418,7 +418,7 @@ URI.isNetworkScheme = function(scheme) { return reNetworkScheme.test(scheme); }; -var reNetworkScheme = /^(?:ftps?|https?|wss?)$/; +const reNetworkScheme = /^(?:ftps?|https?|wss?)$/; /******************************************************************************/