mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 855581. Wait until we've actually closed the last tab to create a new one. DONTBUILD. r=fryn
This commit is contained in:
parent
e084fbac50
commit
7fc1898ae5
@ -393,29 +393,15 @@ var BrowserUI = {
|
||||
},
|
||||
|
||||
closeTab: function closeTab(aTab) {
|
||||
// If we only have one tab, open a new one
|
||||
if (Browser.tabs.length === 1 && !StartUI.isStartURI())
|
||||
Browser.addTab(Browser.getHomePage());
|
||||
|
||||
// We only have the start tab
|
||||
if (Browser.tabs.length === 1)
|
||||
return;
|
||||
|
||||
// If no tab is passed in, assume the current tab
|
||||
let tab = aTab || Browser.selectedTab;
|
||||
let tabToClose = tab instanceof XULElement ? Browser.getTabFromChrome(tab) : tab;
|
||||
Browser.closeTab(tab);
|
||||
},
|
||||
|
||||
animateClosingTab: function animateClosingTab(tabToClose) {
|
||||
if (this.isTabsOnly) {
|
||||
Browser.closeTab(tabToClose);
|
||||
Browser.closeTab(tabToClose, { forceClose: true } );
|
||||
} else {
|
||||
let nextTab = Browser.getNextTab(tabToClose);
|
||||
|
||||
if (!nextTab)
|
||||
return;
|
||||
|
||||
if (nextTab)
|
||||
Browser.selectedTab = nextTab;
|
||||
|
||||
// Trigger closing animation
|
||||
tabToClose.chromeTab.setAttribute("closing", "true");
|
||||
|
||||
@ -425,7 +411,7 @@ var BrowserUI = {
|
||||
}
|
||||
|
||||
this.setOnTabAnimationEnd(function() {
|
||||
Browser.closeTab(tabToClose);
|
||||
Browser.closeTab(tabToClose, { forceClose: true } );
|
||||
if (wasCollapsed)
|
||||
ContextUI.dismissWithDelay(kNewTabAnimationDelayMsec);
|
||||
});
|
||||
|
@ -453,11 +453,12 @@ var Browser = {
|
||||
|
||||
closeTab: function closeTab(aTab, aOptions) {
|
||||
let tab = aTab instanceof XULElement ? this.getTabFromChrome(aTab) : aTab;
|
||||
if (!tab || !this.getNextTab(tab))
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aOptions && "forceClose" in aOptions && aOptions.forceClose) {
|
||||
this._doCloseTab(aTab);
|
||||
this._doCloseTab(tab);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -469,9 +470,11 @@ var Browser = {
|
||||
},
|
||||
|
||||
_doCloseTab: function _doCloseTab(aTab) {
|
||||
if (this._tabs.length === 1) {
|
||||
Browser.addTab(this.getHomePage());
|
||||
}
|
||||
|
||||
let nextTab = this.getNextTab(aTab);
|
||||
if (!nextTab)
|
||||
return;
|
||||
|
||||
// Tabs owned by the closed tab are now orphaned.
|
||||
this._tabs.forEach(function(item, index, array) {
|
||||
@ -918,16 +921,11 @@ var Browser = {
|
||||
break;
|
||||
|
||||
case "Browser:CanUnload:Return": {
|
||||
if (!json.permit)
|
||||
return;
|
||||
|
||||
// Allow a little delay to not close the target tab while processing
|
||||
// a message for this particular tab
|
||||
setTimeout(function(self) {
|
||||
let tab = self.getTabForBrowser(browser);
|
||||
self._doCloseTab(tab);
|
||||
}, 0, this);
|
||||
break;
|
||||
if (json.permit) {
|
||||
let tab = this.getTabForBrowser(browser);
|
||||
BrowserUI.animateClosingTab(tab);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Browser:ZoomToPoint:Return":
|
||||
if (json.zoomTo) {
|
||||
|
Loading…
Reference in New Issue
Block a user