#868: code review

This commit is contained in:
gorhill 2015-11-05 09:20:40 -05:00
parent c99b61da96
commit c5c8edc4d1
2 changed files with 5 additions and 6 deletions

View File

@ -220,7 +220,7 @@ var contentObserver = {
} }
// Important: hard test against `false`. // 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; return this.REJECT;
} }

View File

@ -2161,7 +2161,6 @@ vAPI.net.registerListeners = function() {
// requests. // requests.
var details = e.data; var details = e.data;
var sourceTabId = null; var sourceTabId = null;
var mustLoad;
details.tabId = tabWatcher.tabIdFromTarget(e.target); details.tabId = tabWatcher.tabIdFromTarget(e.target);
@ -2177,8 +2176,10 @@ vAPI.net.registerListeners = function() {
// https://github.com/gorhill/uBlock/issues/868 // https://github.com/gorhill/uBlock/issues/868
// Firefox quirk: for some reasons, there are instances of resources // Firefox quirk: for some reasons, there are instances of resources
// for `video` tag not being reported to HTTP observers. // for `video` tag not being reported to HTTP observers.
if ( details.rawtype === 15 ) { // If blocking, do not bother creating a pending request entry, it
mustLoad = shouldLoadMedia(details); // 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 // We are being called synchronously from the content process, so we
@ -2190,8 +2191,6 @@ vAPI.net.registerListeners = function() {
pendingReq.rawtype = details.rawtype; pendingReq.rawtype = details.rawtype;
pendingReq.sourceTabId = sourceTabId; pendingReq.sourceTabId = sourceTabId;
pendingReq.tabId = details.tabId; pendingReq.tabId = details.tabId;
return mustLoad;
}; };
vAPI.messaging.globalMessageManager.addMessageListener( vAPI.messaging.globalMessageManager.addMessageListener(