зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1003096 - Make browser_tabview_bug595601.js wait until the test session is restored r=smacleod
This commit is contained in:
Родитель
8f899ebf07
Коммит
04188028c0
|
@ -47,16 +47,14 @@ function test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRestoreWithHiddenTabs() {
|
function testRestoreWithHiddenTabs() {
|
||||||
let checked = false;
|
TabsProgressListener.setCallback(function (needsRestore, isRestoring) {
|
||||||
let ssReady = false;
|
if (needsRestore <= 4) {
|
||||||
let tabsRestored = false;
|
TabsProgressListener.unsetCallback();
|
||||||
|
is(needsRestore, 4, "4/8 tabs restored");
|
||||||
let check = function () {
|
}
|
||||||
if (checked || !ssReady || !tabsRestored)
|
});
|
||||||
return;
|
|
||||||
|
|
||||||
checked = true;
|
|
||||||
|
|
||||||
|
waitForBrowserState(state, 4, function () {
|
||||||
is(gBrowser.tabs.length, 8, "there are now eight tabs");
|
is(gBrowser.tabs.length, 8, "there are now eight tabs");
|
||||||
is(gBrowser.visibleTabs.length, 4, "four visible tabs");
|
is(gBrowser.visibleTabs.length, 4, "four visible tabs");
|
||||||
|
|
||||||
|
@ -64,25 +62,7 @@ function testRestoreWithHiddenTabs() {
|
||||||
is(cw.GroupItems.groupItems.length, 2, "there are now two groupItems");
|
is(cw.GroupItems.groupItems.length, 2, "there are now two groupItems");
|
||||||
|
|
||||||
testSwitchToInactiveGroup();
|
testSwitchToInactiveGroup();
|
||||||
}
|
|
||||||
|
|
||||||
whenSessionStoreReady(function () {
|
|
||||||
ssReady = true;
|
|
||||||
check();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
TabsProgressListener.setCallback(function (needsRestore, isRestoring) {
|
|
||||||
if (4 < needsRestore)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TabsProgressListener.unsetCallback();
|
|
||||||
is(needsRestore, 4, "4/8 tabs restored");
|
|
||||||
|
|
||||||
tabsRestored = true;
|
|
||||||
check();
|
|
||||||
});
|
|
||||||
|
|
||||||
ss.setBrowserState(JSON.stringify(state));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSwitchToInactiveGroup() {
|
function testSwitchToInactiveGroup() {
|
||||||
|
@ -108,11 +88,16 @@ function testSwitchToInactiveGroup() {
|
||||||
gBrowser.selectedTab = gBrowser.tabs[4];
|
gBrowser.selectedTab = gBrowser.tabs[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
function whenSessionStoreReady(callback) {
|
function waitForBrowserState(state, numTabs, callback) {
|
||||||
window.addEventListener("SSWindowStateReady", function onReady() {
|
let tabContainer = gBrowser.tabContainer;
|
||||||
window.removeEventListener("SSWindowStateReady", onReady, false);
|
tabContainer.addEventListener("SSTabRestored", function onRestored() {
|
||||||
executeSoon(callback);
|
if (--numTabs <= 0) {
|
||||||
}, false);
|
tabContainer.removeEventListener("SSTabRestored", onRestored, true);
|
||||||
|
executeSoon(callback);
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
ss.setBrowserState(JSON.stringify(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
function countTabs() {
|
function countTabs() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче