From 7f632afe29aca3011e40f74578b2e8a030637450 Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 6 Jun 2016 10:10:29 -0400 Subject: [PATCH] code review re. #554 No longer need to evaluate within asyncOnChannelRedirect() since all is now evaluated at `http-on-modify-request` time. --- platform/firefox/vapi-background.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index acf2eb4..7e9397c 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -2042,34 +2042,28 @@ var httpObserver = { // contentPolicy.shouldLoad doesn't detect redirects, this needs to be used asyncOnChannelRedirect: function(oldChannel, newChannel, flags, callback) { - var result = this.ACCEPT; - // If error thrown, the redirect will fail try { var URI = newChannel.URI; - if ( !URI.schemeIs('http') && !URI.schemeIs('https') ) { return; } - var channelData = this.channelDataFromChannel(oldChannel); - if ( channelData === null ) { + if ( newChannel instanceof Ci.nsIWritablePropertyBag === false ) { return; } - if ( this.handleRequest(newChannel, URI, channelData[0], channelData[1]) ) { - result = this.ABORT; + var channelData = this.channelDataFromChannel(oldChannel); + if ( channelData === null ) { return; } // Carry the data on in case of multiple redirects - if ( newChannel instanceof Ci.nsIWritablePropertyBag ) { - newChannel.setProperty(this.REQDATAKEY, channelData); - } + newChannel.setProperty(this.REQDATAKEY, channelData); } catch (ex) { // console.error(ex); } finally { - callback.onRedirectVerifyCallback(result); + callback.onRedirectVerifyCallback(this.ACCEPT); } } };