mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-14 00:05:08 +12:00
code review re. #554
No longer need to evaluate within asyncOnChannelRedirect() since all is now evaluated at `http-on-modify-request` time.
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
if ( newChannel instanceof Ci.nsIWritablePropertyBag === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var channelData = this.channelDataFromChannel(oldChannel);
|
||||
if ( channelData === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.handleRequest(newChannel, URI, channelData[0], channelData[1]) ) {
|
||||
result = this.ABORT;
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue