From f4a7378ff2c3636f075748812ac90d33f76ca8c8 Mon Sep 17 00:00:00 2001 From: Deathamns Date: Tue, 27 Jan 2015 16:37:02 +0100 Subject: [PATCH] Firefox: each frame should have a unique ID --- platform/firefox/vapi-background.js | 31 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 9fec753..e3cdd6c 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -958,7 +958,13 @@ var httpObserver = { } 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'); } catch (ex) { return; @@ -1047,7 +1053,13 @@ var httpObserver = { if ( channel instanceof Ci.nsIWritablePropertyBag ) { channel.setProperty( location.host + 'reqdata', - [lastRequest.type, lastRequest.tabId, sourceTabId] + [ + lastRequest.type, + lastRequest.tabId, + sourceTabId, + lastRequest.frameId, + lastRequest.parentFrameId + ] ); } }, @@ -1074,20 +1086,21 @@ var httpObserver = { 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 [type, tabId, sourceTabId] = channelData; - if ( this.handlePopup(URI, tabId, sourceTabId) ) { + if ( this.handlePopup(URI, channelData[1], channelData[2]) ) { result = this.ABORT; return; } var details = { - type: type, - tabId: tabId, - // well... - frameId: type === this.MAIN_FRAME ? -1 : 0, - parentFrameId: -1 + type: channelData[0], + tabId: channelData[1], + frameId: channelData[3], + parentFrameId: channelData[4] }; if ( this.handleRequest(newChannel, URI, details) ) {