Merge pull request #1021 from AlexVallat/master

Fix for #1017 (and #1001)
This commit is contained in:
Raymond Hill 2015-03-15 13:28:32 -04:00
commit 38d308f1f0
1 changed files with 13 additions and 15 deletions

View File

@ -308,7 +308,8 @@ var tabWatcher = {
onTabSelect: function({target}) { onTabSelect: function({target}) {
// target is tab in Firefox, browser in Fennec // 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 aboutPath = URI.schemeIs('about') && URI.path;
var tabId = vAPI.tabs.getTabId(target); var tabId = vAPI.tabs.getTabId(target);
@ -317,11 +318,13 @@ var tabWatcher = {
return; return;
} }
vAPI.tabs.onNavigation({ if ( browser.webNavigation.busyFlags === 0 /*BUSY_FLAGS_NONE*/ ) {
frameId: 0, vAPI.tabs.onNavigation({
tabId: tabId, frameId: 0,
url: URI.asciiSpec tabId: tabId,
}); url: URI.asciiSpec
});
}
}, },
onLocationChange: function(browser, webProgress, request, location, flags) { onLocationChange: function(browser, webProgress, request, location, flags) {
@ -452,15 +455,9 @@ vAPI.tabs.getTabId = function(target) {
if ( vAPI.fennec ) { if ( vAPI.fennec ) {
if ( target.browser ) { if ( target.browser ) {
// target is a tab // target is a tab
return target.id; return target.browser.loadContext.DOMWindowID;
}
for ( var win of this.getWindows() ) {
var tab = win.BrowserApp.getTabForBrowser(target);
if ( tab && tab.id !== undefined ) {
return tab.id;
}
} }
return target.loadContext.DOMWindowID;
return -1; return -1;
} }
@ -513,7 +510,8 @@ vAPI.tabs.getTabsForIds = function(tabIds, tabBrowser) {
if ( vAPI.fennec ) { if ( vAPI.fennec ) {
for ( tabId of tabIds ) { for ( tabId of tabIds ) {
var tab = tabBrowser.getTabForId(tabId);
var tab = tabBrowser.tabs.find(tab=>tab.browser.loadContext.DOMWindowID === Number(tabId));
if ( tab ) { if ( tab ) {
tabs.push(tab); tabs.push(tab);
} }