From 05540108b7e1f7a9436a4d3ff16ad90564012935 Mon Sep 17 00:00:00 2001 From: AlexVallat Date: Sat, 14 Mar 2015 10:02:05 +0000 Subject: [PATCH] Testing alternative tab ID for Fennec (issue #1001) --- platform/firefox/vapi-background.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index f9e28aaea..6735a4065 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -452,15 +452,9 @@ vAPI.tabs.getTabId = function(target) { if ( vAPI.fennec ) { if ( target.browser ) { // target is a tab - return target.id; - } - - for ( var win of this.getWindows() ) { - var tab = win.BrowserApp.getTabForBrowser(target); - if ( tab && tab.id !== undefined ) { - return tab.id; - } + return target.browser.loadContext.DOMWindowID; } + return target.loadContext.DOMWindowID; return -1; } @@ -513,7 +507,8 @@ vAPI.tabs.getTabsForIds = function(tabIds, tabBrowser) { if ( vAPI.fennec ) { for ( tabId of tabIds ) { - var tab = tabBrowser.getTabForId(tabId); + + var tab = tabBrowser.tabs.find(tab=>tab.browser.loadContext.DOMWindowID === Number(tabId)); if ( tab ) { tabs.push(tab); }