Firefox: each frame should have a unique ID

pull/2/head
Deathamns 10 years ago committed by gorhill
parent 97ae38c584
commit f4a7378ff2

@ -958,7 +958,13 @@ var httpObserver = {
} }
try { try {
// [type, tabId, sourceTabId - given if it was a popup] /*[
type,
tabId,
sourceTabId - given if it was a popup,
frameId,
parentFrameId
]*/
channelData = channel.getProperty(location.host + 'reqdata'); channelData = channel.getProperty(location.host + 'reqdata');
} catch (ex) { } catch (ex) {
return; return;
@ -1047,7 +1053,13 @@ var httpObserver = {
if ( channel instanceof Ci.nsIWritablePropertyBag ) { if ( channel instanceof Ci.nsIWritablePropertyBag ) {
channel.setProperty( channel.setProperty(
location.host + 'reqdata', location.host + 'reqdata',
[lastRequest.type, lastRequest.tabId, sourceTabId] [
lastRequest.type,
lastRequest.tabId,
sourceTabId,
lastRequest.frameId,
lastRequest.parentFrameId
]
); );
} }
}, },
@ -1074,20 +1086,21 @@ var httpObserver = {
return; return;
} }
// TODO: what if a behind-the-scene request is being redirected?
// This data is present only for tabbed requests, so if this throws,
// the redirection won't be evaluated and canceled (if necessary)
var channelData = oldChannel.getProperty(location.host + 'reqdata'); var channelData = oldChannel.getProperty(location.host + 'reqdata');
var [type, tabId, sourceTabId] = channelData;
if ( this.handlePopup(URI, tabId, sourceTabId) ) { if ( this.handlePopup(URI, channelData[1], channelData[2]) ) {
result = this.ABORT; result = this.ABORT;
return; return;
} }
var details = { var details = {
type: type, type: channelData[0],
tabId: tabId, tabId: channelData[1],
// well... frameId: channelData[3],
frameId: type === this.MAIN_FRAME ? -1 : 0, parentFrameId: channelData[4]
parentFrameId: -1
}; };
if ( this.handleRequest(newChannel, URI, details) ) { if ( this.handleRequest(newChannel, URI, details) ) {

Loading…
Cancel
Save