diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 8398c3d93..896e0cdae 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -938,15 +938,19 @@ vAPI.tabs._remove = (function() { tabBrowser.closeTab(tab); }; } - return function(tab, tabBrowser) { - tabBrowser.removeTab(tab); + return function(tab, tabBrowser, nuke) { + if ( tabBrowser.tabs.length === 1 && nuke ) { + getOwnerWindow(tab).close(); + } else { + tabBrowser.removeTab(tab); + } }; })(); /******************************************************************************/ vAPI.tabs.remove = (function() { - var remove = function(tabId) { + var remove = function(tabId, nuke) { var browser = tabWatcher.browserFromTabId(tabId); if ( !browser ) { return; @@ -955,12 +959,12 @@ vAPI.tabs.remove = (function() { if ( !tab ) { return; } - this._remove(tab, getTabBrowser(getOwnerWindow(browser))); + this._remove(tab, getTabBrowser(getOwnerWindow(browser)), nuke); }; // Do this asynchronously - return function(tabId) { - vAPI.setTimeout(remove.bind(this, tabId), 10); + return function(tabId, nuke) { + vAPI.setTimeout(remove.bind(this, tabId, nuke), 1); }; })(); diff --git a/src/js/tab.js b/src/js/tab.js index c901e1155..0a1194614 100644 --- a/src/js/tab.js +++ b/src/js/tab.js @@ -650,7 +650,7 @@ vAPI.tabs.onPopupUpdated = (function() { // It is a popup, block and remove the tab. µb.unbindTabFromPageStats(targetTabId); - vAPI.tabs.remove(targetTabId); + vAPI.tabs.remove(targetTabId, true); return true; };