From 05540108b7e1f7a9436a4d3ff16ad90564012935 Mon Sep 17 00:00:00 2001 From: AlexVallat Date: Sat, 14 Mar 2015 10:02:05 +0000 Subject: [PATCH 1/2] 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); } From 50804eb1bb98f22f10e50c6fc552612bd0290950 Mon Sep 17 00:00:00 2001 From: AlexVallat Date: Sun, 15 Mar 2015 16:05:39 +0000 Subject: [PATCH 2/2] Fixing #1017, only apply switch to about:blank or about:newtab if not loading --- platform/firefox/vapi-background.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 6735a4065..9b45bcf2e 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -308,7 +308,8 @@ var tabWatcher = { onTabSelect: function({target}) { // target is tab in Firefox, browser in Fennec - var URI = (target.linkedBrowser || target).currentURI; + var browser = (target.linkedBrowser || target); + var URI = browser.currentURI; var aboutPath = URI.schemeIs('about') && URI.path; var tabId = vAPI.tabs.getTabId(target); @@ -317,11 +318,13 @@ var tabWatcher = { return; } - vAPI.tabs.onNavigation({ - frameId: 0, - tabId: tabId, - url: URI.asciiSpec - }); + if ( browser.webNavigation.busyFlags === 0 /*BUSY_FLAGS_NONE*/ ) { + vAPI.tabs.onNavigation({ + frameId: 0, + tabId: tabId, + url: URI.asciiSpec + }); + } }, onLocationChange: function(browser, webProgress, request, location, flags) {