mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 851130 - Part 9 - Deal with tab switching from StartUI tabs that have active context actions. r=sfoster
This commit is contained in:
parent
fd8d10a4c0
commit
70732017b0
@ -31,6 +31,14 @@ var Appbar = {
|
||||
switch (aEvent.type) {
|
||||
case 'URLChanged':
|
||||
case 'TabSelect':
|
||||
this.update();
|
||||
// Switching away from or loading a site into a startui tab that has actions
|
||||
// pending, we consider this confirmation that the user wants to flush changes.
|
||||
if (this.activeTileset && aEvent.lastTab && aEvent.lastTab.browser.currentURI.spec == kStartURI) {
|
||||
ContextUI.dismiss();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'MozAppbarShowing':
|
||||
this.update();
|
||||
break;
|
||||
|
@ -563,9 +563,16 @@ var Browser = {
|
||||
item.owner = null;
|
||||
});
|
||||
|
||||
// tray tab
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("TabClose", true, false);
|
||||
aTab.chromeTab.dispatchEvent(event);
|
||||
|
||||
// tab window
|
||||
event = document.createEvent("Events");
|
||||
event.initEvent("TabClose", true, false);
|
||||
aTab.browser.contentWindow.dispatchEvent(event);
|
||||
|
||||
aTab.browser.messageManager.sendAsyncMessage("Browser:TabClose");
|
||||
|
||||
let container = aTab.chromeTab.parentNode;
|
||||
|
@ -28,6 +28,7 @@ function BookmarksView(aSet, aLimit, aRoot, aFilterUnpinned) {
|
||||
Services.obs.addObserver(this, "metro_viewstate_changed", false);
|
||||
StartUI.chromeWin.addEventListener('MozAppbarDismissing', this, false);
|
||||
StartUI.chromeWin.addEventListener('BookmarksNeedsRefresh', this, false);
|
||||
window.addEventListener("TabClose", this, true);
|
||||
|
||||
this.root = aRoot;
|
||||
}
|
||||
@ -297,6 +298,12 @@ BookmarksView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
case "BookmarksNeedsRefresh":
|
||||
this.getBookmarks(true);
|
||||
break;
|
||||
|
||||
case "TabClose":
|
||||
// Flush any pending actions - appbar will call us back
|
||||
// before this returns with 'MozAppbarDismissing' above.
|
||||
StartUI.chromeWin.ContextUI.dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -19,6 +19,7 @@ function HistoryView(aSet, aLimit, aFilterUnpinned) {
|
||||
Services.obs.addObserver(this, "metro_viewstate_changed", false);
|
||||
StartUI.chromeWin.addEventListener('MozAppbarDismissing', this, false);
|
||||
StartUI.chromeWin.addEventListener('HistoryNeedsRefresh', this, false);
|
||||
window.addEventListener("TabClose", this, true);
|
||||
}
|
||||
|
||||
HistoryView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
@ -210,6 +211,12 @@ HistoryView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
case "HistoryNeedsRefresh":
|
||||
this.populateGrid(true);
|
||||
break;
|
||||
|
||||
case "TabClose":
|
||||
// Flush any pending actions - appbar will call us back
|
||||
// before this returns with 'MozAppbarDismissing' above.
|
||||
StartUI.chromeWin.ContextUI.dismiss();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user