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 c978b2c5e9
commit 7f632afe29

@ -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);
}
} catch (ex) {
// console.error(ex);
} finally {
callback.onRedirectVerifyCallback(result);
callback.onRedirectVerifyCallback(this.ACCEPT);
}
}
};

Loading…
Cancel
Save