From be9e7fd11c4565e4fc6555a61857fc2d524b1f68 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 24 Dec 2018 08:56:35 -0500 Subject: [PATCH] Code review related to the early blocking of network requests at launch --- platform/firefox/vapi-webrequest.js | 4 ++-- src/js/filtering-context.js | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/platform/firefox/vapi-webrequest.js b/platform/firefox/vapi-webrequest.js index 0ba557708..b2a358568 100644 --- a/platform/firefox/vapi-webrequest.js +++ b/platform/firefox/vapi-webrequest.js @@ -170,8 +170,8 @@ vAPI.net.onBeforeReady = (function() { stop: function(resolver) { if ( pendings === undefined ) { return; } for ( const pending of pendings ) { - const result = resolver(pending.details); - pending.resolve(result); + vAPI.net.normalizeDetails(pending.details); + pending.resolve(resolver(pending.details)); } pendings = undefined; }, diff --git a/src/js/filtering-context.js b/src/js/filtering-context.js index 0380f7b62..39c67a05d 100644 --- a/src/js/filtering-context.js +++ b/src/js/filtering-context.js @@ -46,13 +46,11 @@ µBlock.FilteringContext.prototype = { fromTabId: function(tabId) { - if ( tabId !== -1 || tabId !== this.tabId ) { - const tabContext = µBlock.tabContextManager.mustLookup(tabId); - this.tabOrigin = tabContext.origin; - this.tabHostname = tabContext.rootHostname; - this.tabDomain = tabContext.rootDomain; - this.tabId = tabId; - } + const tabContext = µBlock.tabContextManager.mustLookup(tabId); + this.tabOrigin = tabContext.origin; + this.tabHostname = tabContext.rootHostname; + this.tabDomain = tabContext.rootDomain; + this.tabId = tabContext.tabId; return this; }, fromWebrequestDetails: function(details) {