mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Bug 654295 - Closing last tab of a group doesn't show Panorama r=tim
This commit is contained in:
parent
0fd3b8d723
commit
4cfb98213e
@ -42,6 +42,7 @@ let TabView = {
|
||||
_window: null,
|
||||
_initialized: false,
|
||||
_browserKeyHandlerInitialized: false,
|
||||
_closedLastVisibleTabBeforeFrameInitialized: false,
|
||||
_isFrameLoading: false,
|
||||
_initFrameCallbacks: [],
|
||||
_lastSessionGroupName: null,
|
||||
@ -124,14 +125,24 @@ let TabView = {
|
||||
let self = this;
|
||||
// if a tab is changed from hidden to unhidden and the iframe is not
|
||||
// initialized, load the iframe and setup the tab.
|
||||
this._tabShowEventListener = function (event) {
|
||||
this._tabShowEventListener = function(event) {
|
||||
if (!self._window)
|
||||
self._initFrame(function() {
|
||||
self._window.UI.onTabSelect(gBrowser.selectedTab);
|
||||
if (self._closedLastVisibleTabBeforeFrameInitialized) {
|
||||
self._closedLastVisibleTabBeforeFrameInitialized = false;
|
||||
self._window.UI.showTabView(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
this._tabCloseEventListener = function(event) {
|
||||
if (!self._window && gBrowser.visibleTabs.length == 0)
|
||||
self._closedLastVisibleTabBeforeFrameInitialized = true;
|
||||
};
|
||||
gBrowser.tabContainer.addEventListener(
|
||||
"TabShow", this._tabShowEventListener, true);
|
||||
"TabShow", this._tabShowEventListener, false);
|
||||
gBrowser.tabContainer.addEventListener(
|
||||
"TabClose", this._tabCloseEventListener, false);
|
||||
|
||||
// grab the last used group title
|
||||
this._lastSessionGroupName = sessionstore.getWindowValue(window,
|
||||
@ -161,10 +172,13 @@ let TabView = {
|
||||
|
||||
Services.prefs.removeObserver(this.PREF_BRANCH, this);
|
||||
|
||||
if (this._tabShowEventListener) {
|
||||
if (this._tabShowEventListener)
|
||||
gBrowser.tabContainer.removeEventListener(
|
||||
"TabShow", this._tabShowEventListener, true);
|
||||
}
|
||||
"TabShow", this._tabShowEventListener, false);
|
||||
|
||||
if (this._tabCloseEventListener)
|
||||
gBrowser.tabContainer.removeEventListener(
|
||||
"TabClose", this._tabCloseEventListener, false);
|
||||
|
||||
this._initialized = false;
|
||||
},
|
||||
@ -213,10 +227,14 @@ let TabView = {
|
||||
|
||||
if (self._tabShowEventListener) {
|
||||
gBrowser.tabContainer.removeEventListener(
|
||||
"TabShow", self._tabShowEventListener, true);
|
||||
"TabShow", self._tabShowEventListener, false);
|
||||
self._tabShowEventListener = null;
|
||||
}
|
||||
|
||||
if (self._tabCloseEventListener) {
|
||||
gBrowser.tabContainer.removeEventListener(
|
||||
"TabClose", self._tabCloseEventListener, false);
|
||||
self._tabCloseEventListener = null;
|
||||
}
|
||||
self._initFrameCallbacks.forEach(function (cb) cb());
|
||||
self._initFrameCallbacks = [];
|
||||
}, false);
|
||||
|
@ -146,6 +146,7 @@ _BROWSER_FILES = \
|
||||
browser_tabview_bug650280.js \
|
||||
browser_tabview_bug650573.js \
|
||||
browser_tabview_bug651311.js \
|
||||
browser_tabview_bug654295.js \
|
||||
browser_tabview_bug654721.js \
|
||||
browser_tabview_bug654941.js \
|
||||
browser_tabview_bug655269.js \
|
||||
|
@ -0,0 +1,62 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
const DUMMY_PAGE_URL = "about:blank";
|
||||
const DUMMY_PAGE_URL_2 = "http://mochi.test:8888/";
|
||||
|
||||
// create two groups and each group has one tab item
|
||||
let newState = {
|
||||
windows: [{
|
||||
tabs: [{
|
||||
entries: [{ url: DUMMY_PAGE_URL }],
|
||||
hidden: true,
|
||||
attributes: {},
|
||||
extData: {
|
||||
"tabview-tab":
|
||||
'{"bounds":{"left":21,"top":29,"width":204,"height":153},' +
|
||||
'"userSize":null,"url":"' + DUMMY_PAGE_URL + '","groupID":1,' +
|
||||
'"imageData":null,"title":null}'
|
||||
}
|
||||
},{
|
||||
entries: [{ url: DUMMY_PAGE_URL_2 }],
|
||||
hidden: false,
|
||||
attributes: {},
|
||||
extData: {
|
||||
"tabview-tab":
|
||||
'{"bounds":{"left":315,"top":29,"width":111,"height":84},' +
|
||||
'"userSize":null,"url":"' + DUMMY_PAGE_URL_2 + '","groupID":2,' +
|
||||
'"imageData":null,"title":null}'
|
||||
},
|
||||
}],
|
||||
selected:2,
|
||||
_closedTabs: [],
|
||||
extData: {
|
||||
"tabview-groups": '{"nextID":3,"activeGroupId":2}',
|
||||
"tabview-group":
|
||||
'{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},' +
|
||||
'"userSize":null,"title":"","id":1},' +
|
||||
'"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},' +
|
||||
'"userSize":null,"title":"","id":2}}',
|
||||
"tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":788,"height":548}}'
|
||||
}, sizemode:"normal"
|
||||
}]
|
||||
};
|
||||
|
||||
newWindowWithState(newState, function(win) {
|
||||
registerCleanupFunction(function () win.close());
|
||||
|
||||
whenTabViewIsShown(function() {
|
||||
let contentWindow = win.TabView.getContentWindow();
|
||||
|
||||
is(contentWindow.GroupItems.groupItems.length, 2, "There are still two groups");
|
||||
is(win.gBrowser.tabs.length, 1, "There is only one tab");
|
||||
|
||||
finish();
|
||||
}, win);
|
||||
win.gBrowser.removeTab(win.gBrowser.selectedTab);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user