Bug 597980 - Switching into and out of Panorama mode quickly can cause the wrong tab to be selected on return; r=ian

This commit is contained in:
Raymond Lee 2011-03-09 16:37:25 +08:00
Родитель b9eb38aa19
Коммит b2c386b115
2 изменённых файлов: 30 добавлений и 3 удалений

Просмотреть файл

@ -721,6 +721,7 @@ TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
complete();
};
UI.setActiveTab(this);
TabItems._update(this.tab, {force: true});
$tab.addClass("front");

Просмотреть файл

@ -4,10 +4,12 @@
function test() {
waitForExplicitFinish();
newWindowWithTabView(onTabViewShown);
newWindowWithTabView(part1);
}
function onTabViewShown(win) {
function part1(win) {
registerCleanupFunction(function() win.close());
let contentWindow = win.document.getElementById("tab-view").contentWindow;
is(contentWindow.GroupItems.groupItems.length, 1, "Has only one group");
@ -52,8 +54,32 @@ function onTabViewShown(win) {
checkActive(function() {
checkActive(function() {
win.close();
finish();
newWindowWithTabView(part2);
});
}, 490);
}, 10)
}
function part2(win) {
registerCleanupFunction(function() win.close());
let newTab = win.gBrowser.loadOneTab("about:blank", {inBackground: true});
hideTabView(function() {
let selectedTab = win.gBrowser.selectedTab;
isnot(selectedTab, newTab, "They are different tabs");
// switch the selected tab to new tab
win.gBrowser.selectedTab = newTab;
win.addEventListener("tabviewhidden", function () {
win.removeEventListener("tabviewhidden", arguments.callee, false);
is(win.gBrowser.selectedTab, newTab, "The seleted tab should be the same as before (new tab)");
win.close();
finish();
}, false);
// show tabview
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, win);
// hide tabview
EventUtils.synthesizeKey("e", { accelKey: true, shiftKey: true }, win);
})
}