зеркало из https://github.com/mozilla/gecko-dev.git
Bug 615954 - Intermittent Failure in tabview/browser_tabview_bug597248.js [r=ian, a=orange]
This commit is contained in:
Родитель
80bc3fedf2
Коммит
6eb03475c6
|
@ -95,8 +95,10 @@ function setupTwo() {
|
|||
restoredWin.addEventListener("load", function(event) {
|
||||
restoredWin.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
// execute code when the frame isninitialized.
|
||||
// execute code when the frame is initialized.
|
||||
restoredWin.addEventListener("tabviewshown", onTabViewShown, false);
|
||||
|
||||
is(restoredWin.gBrowser.tabs.length, 2, "The total number of tabs is 2");
|
||||
|
||||
// setup tab variables and listen to the load progress.
|
||||
newTabOne = restoredWin.gBrowser.tabs[0];
|
||||
|
@ -139,23 +141,26 @@ function setupTwo() {
|
|||
|
||||
let gTabsProgressListener = {
|
||||
onStateChange: function(browser, webProgress, request, stateFlags, status) {
|
||||
if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
|
||||
stateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||
// ensure about:blank doesn't trigger the code
|
||||
if ((stateFlags & Ci.nsIWebProgressListener.STATE_STOP) &&
|
||||
(stateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) &&
|
||||
browser.currentURI.spec != "about:blank") {
|
||||
if (newTabOne.linkedBrowser == browser)
|
||||
restoredNewTabOneLoaded = true;
|
||||
else if (newTabTwo.linkedBrowser == browser)
|
||||
restoredNewTabTwoLoaded = true;
|
||||
|
||||
|
||||
// since we are not sure whether the frame is initialized first or two tabs
|
||||
// compete loading first so we need this.
|
||||
if (restoredNewTabOneLoaded && restoredNewTabTwoLoaded) {
|
||||
restoredWin.gBrowser.removeTabsProgressListener(gTabsProgressListener);
|
||||
|
||||
if (frameInitialized) {
|
||||
// since a tabs progress listener is used in the code to set
|
||||
// tabItem.shouldHideCachedData, executeSoon is used to avoid a racing
|
||||
// condition.
|
||||
executeSoon(updateAndCheck);
|
||||
}
|
||||
restoredWin.gBrowser.removeTabsProgressListener(gTabsProgressListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,8 +180,9 @@ function onTabViewShown() {
|
|||
// because tabs progress listener might run at the same time as this test
|
||||
// code.
|
||||
executeSoon(updateAndCheck);
|
||||
} else
|
||||
} else {
|
||||
frameInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
let tabItems = contentWindow.TabItems.getItems();
|
||||
|
@ -188,8 +194,7 @@ function onTabViewShown() {
|
|||
ok(tabItem.isShowingCachedData(),
|
||||
"Tab item is showing cached data and is already connected. " +
|
||||
tabItem.tab.linkedBrowser.currentURI.spec);
|
||||
count--;
|
||||
if (count == 0)
|
||||
if (--count == 0)
|
||||
nextStep();
|
||||
} else {
|
||||
tabItem.addSubscriber(tabItem, "reconnected", function() {
|
||||
|
@ -197,8 +202,7 @@ function onTabViewShown() {
|
|||
ok(tabItem.isShowingCachedData(),
|
||||
"Tab item is showing cached data and is just connected. " +
|
||||
tabItem.tab.linkedBrowser.currentURI.spec);
|
||||
count--;
|
||||
if (count == 0)
|
||||
if (--count == 0)
|
||||
nextStep();
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче