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 // 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 ( newChannel instanceof Ci.nsIWritablePropertyBag === false ) {
if ( channelData === null ) {
return; return;
} }
if ( this.handleRequest(newChannel, URI, channelData[0], channelData[1]) ) { var channelData = this.channelDataFromChannel(oldChannel);
result = this.ABORT; 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