From c5c8edc4d18bd4ba43f87ad96caa3633474bc6ac Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 5 Nov 2015 09:20:40 -0500 Subject: [PATCH] #868: code review --- platform/firefox/frameModule.js | 2 +- platform/firefox/vapi-background.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js index 9d9c52d49..06f2eee7e 100644 --- a/platform/firefox/frameModule.js +++ b/platform/firefox/frameModule.js @@ -220,7 +220,7 @@ var contentObserver = { } // Important: hard test against `false`. - if ( Array.isArray(r) && r.length !== 0 && r[0] === false ) { + if ( Array.isArray(r) && r[0] === false ) { return this.REJECT; } diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index cc3b73332..0759b18e3 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -2161,7 +2161,6 @@ vAPI.net.registerListeners = function() { // requests. var details = e.data; var sourceTabId = null; - var mustLoad; details.tabId = tabWatcher.tabIdFromTarget(e.target); @@ -2177,8 +2176,10 @@ vAPI.net.registerListeners = function() { // https://github.com/gorhill/uBlock/issues/868 // Firefox quirk: for some reasons, there are instances of resources // for `video` tag not being reported to HTTP observers. - if ( details.rawtype === 15 ) { - mustLoad = shouldLoadMedia(details); + // If blocking, do not bother creating a pending request entry, it + // won't be used anyway. + if ( details.rawtype === 15 && shouldLoadMedia(details) === false ) { + return false; } // We are being called synchronously from the content process, so we @@ -2190,8 +2191,6 @@ vAPI.net.registerListeners = function() { pendingReq.rawtype = details.rawtype; pendingReq.sourceTabId = sourceTabId; pendingReq.tabId = details.tabId; - - return mustLoad; }; vAPI.messaging.globalMessageManager.addMessageListener(