Browse Source

code review re. #554

No longer need to evaluate within asyncOnChannelRedirect() since
all is now evaluated at `http-on-modify-request` time.
pull/2/head
gorhill 9 years ago
parent
commit
7f632afe29
  1. 16
      platform/firefox/vapi-background.js

16
platform/firefox/vapi-background.js

@ -2042,34 +2042,28 @@ var httpObserver = {
// contentPolicy.shouldLoad doesn't detect redirects, this needs to be used // contentPolicy.shouldLoad doesn't detect redirects, this needs to be used
asyncOnChannelRedirect: function(oldChannel, newChannel, flags, callback) { asyncOnChannelRedirect: function(oldChannel, newChannel, flags, callback) {
var result = this.ACCEPT;
// If error thrown, the redirect will fail // If error thrown, the redirect will fail
try { try {
var URI = newChannel.URI; var URI = newChannel.URI;
if ( !URI.schemeIs('http') && !URI.schemeIs('https') ) { if ( !URI.schemeIs('http') && !URI.schemeIs('https') ) {
return; return;
} }
var channelData = this.channelDataFromChannel(oldChannel);
if ( channelData === null ) {
if ( newChannel instanceof Ci.nsIWritablePropertyBag === false ) {
return; return;
} }
if ( this.handleRequest(newChannel, URI, channelData[0], channelData[1]) ) {
result = this.ABORT;
var channelData = this.channelDataFromChannel(oldChannel);
if ( channelData === null ) {
return; return;
} }
// Carry the data on in case of multiple redirects // 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) { } catch (ex) {
// console.error(ex); // console.error(ex);
} finally { } finally {
callback.onRedirectVerifyCallback(result);
callback.onRedirectVerifyCallback(this.ACCEPT);
} }
} }
}; };

Loading…
Cancel
Save