Browse Source

code review re. #554: use channel data when available

pull/2/head
gorhill 9 years ago
parent
commit
a429b71665
  1. 13
      platform/firefox/vapi-background.js

13
platform/firefox/vapi-background.js

@ -1885,7 +1885,7 @@ var httpObserver = {
channelDataFromChannel: function(channel) { channelDataFromChannel: function(channel) {
if ( channel instanceof Ci.nsIWritablePropertyBag ) { if ( channel instanceof Ci.nsIWritablePropertyBag ) {
try { try {
return channel.getProperty(this.REQDATAKEY);
return channel.getProperty(this.REQDATAKEY) || null;
} catch (ex) { } catch (ex) {
} }
} }
@ -1957,10 +1957,9 @@ var httpObserver = {
} }
var URI = channel.URI; var URI = channel.URI;
var channelData;
var channelData = this.channelDataFromChannel(channel);
if ( topic.lastIndexOf('http-on-examine-', 0) === 0 ) { if ( topic.lastIndexOf('http-on-examine-', 0) === 0 ) {
channelData = this.channelDataFromChannel(channel);
if ( channelData === null ) { if ( channelData === null ) {
return; return;
} }
@ -2000,6 +1999,14 @@ var httpObserver = {
} }
// http-on-modify-request // http-on-modify-request
// The channel was previously serviced.
if ( channelData !== null ) {
this.handleRequest(channel, URI, channelData[0], channelData[1]);
return;
}
// The channel was never serviced.
var tabId; var tabId;
var pendingRequest = this.lookupPendingRequest(URI.asciiSpec); var pendingRequest = this.lookupPendingRequest(URI.asciiSpec);
var rawType = 1; var rawType = 1;

Loading…
Cancel
Save