зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1209689 - browser_crashedTabs.js fixes. r=felipe
--HG-- extra : commitid : HUgricZ9y07 extra : rebase_source : 506dfb198528c063782addbaf38bef20a93daf7e
This commit is contained in:
Родитель
07388b22cc
Коммит
6515482435
|
@ -253,13 +253,16 @@ add_task(function test_revive_tab_from_session_store() {
|
||||||
|
|
||||||
// Crash the tab
|
// Crash the tab
|
||||||
yield BrowserTestUtils.crashBrowser(browser);
|
yield BrowserTestUtils.crashBrowser(browser);
|
||||||
is(newTab2.getAttribute("crashed"), "true", "Second tab should be crashed too.");
|
// Background tabs should not be crashed, but should be in the "to be restored"
|
||||||
|
// state.
|
||||||
|
ok(!newTab2.hasAttribute("crashed"), "Second tab should not be crashed.");
|
||||||
|
ok(newTab2.hasAttribute("pending"), "Second tab should be pending.");
|
||||||
|
|
||||||
// Use SessionStore to revive the tab
|
// Use SessionStore to revive the first tab
|
||||||
clickButton(browser, "restoreTab");
|
clickButton(browser, "restoreTab");
|
||||||
yield promiseTabRestored(newTab);
|
yield promiseTabRestored(newTab);
|
||||||
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
|
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
|
||||||
is(newTab2.getAttribute("crashed"), "true", "Second tab should still be crashed though.");
|
ok(newTab2.hasAttribute("pending"), "Second tab should still be pending.");
|
||||||
|
|
||||||
// We can't just check browser.currentURI.spec, because from
|
// We can't just check browser.currentURI.spec, because from
|
||||||
// the outside, a crashed tab has the same URI as the page
|
// the outside, a crashed tab has the same URI as the page
|
||||||
|
@ -275,8 +278,8 @@ add_task(function test_revive_tab_from_session_store() {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that we can revive a crashed tab back to the page that
|
* Checks that we can revive multiple crashed tabs back to the pages
|
||||||
* it was on when it crashed.
|
* that they were on when they crashed.
|
||||||
*/
|
*/
|
||||||
add_task(function test_revive_all_tabs_from_session_store() {
|
add_task(function test_revive_all_tabs_from_session_store() {
|
||||||
let newTab = gBrowser.addTab();
|
let newTab = gBrowser.addTab();
|
||||||
|
@ -288,7 +291,12 @@ add_task(function test_revive_all_tabs_from_session_store() {
|
||||||
browser.loadURI(PAGE_1);
|
browser.loadURI(PAGE_1);
|
||||||
yield promiseBrowserLoaded(browser);
|
yield promiseBrowserLoaded(browser);
|
||||||
|
|
||||||
let newTab2 = gBrowser.addTab(PAGE_1);
|
// In order to see a second about:tabcrashed page, we'll need
|
||||||
|
// a second window, since only selected tabs will show
|
||||||
|
// about:tabcrashed.
|
||||||
|
let win2 = yield BrowserTestUtils.openNewBrowserWindow();
|
||||||
|
let newTab2 = win2.gBrowser.addTab(PAGE_1);
|
||||||
|
win2.gBrowser.selectedTab = newTab2;
|
||||||
let browser2 = newTab2.linkedBrowser;
|
let browser2 = newTab2.linkedBrowser;
|
||||||
ok(browser2.isRemoteBrowser, "Should be a remote browser");
|
ok(browser2.isRemoteBrowser, "Should be a remote browser");
|
||||||
yield promiseBrowserLoaded(browser2);
|
yield promiseBrowserLoaded(browser2);
|
||||||
|
@ -304,7 +312,9 @@ add_task(function test_revive_all_tabs_from_session_store() {
|
||||||
|
|
||||||
// Crash the tab
|
// Crash the tab
|
||||||
yield BrowserTestUtils.crashBrowser(browser);
|
yield BrowserTestUtils.crashBrowser(browser);
|
||||||
is(newTab2.getAttribute("crashed"), "true", "Second tab should be crashed too.");
|
// Both tabs should now be crashed.
|
||||||
|
is(newTab.getAttribute("crashed"), "true", "First tab should be crashed");
|
||||||
|
is(newTab2.getAttribute("crashed"), "true", "Second window tab should be crashed");
|
||||||
|
|
||||||
// Use SessionStore to revive all the tabs
|
// Use SessionStore to revive all the tabs
|
||||||
clickButton(browser, "restoreAll");
|
clickButton(browser, "restoreAll");
|
||||||
|
@ -312,10 +322,6 @@ add_task(function test_revive_all_tabs_from_session_store() {
|
||||||
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
|
ok(!newTab.hasAttribute("crashed"), "Tab shouldn't be marked as crashed anymore.");
|
||||||
ok(!newTab.hasAttribute("pending"), "Tab shouldn't be pending.");
|
ok(!newTab.hasAttribute("pending"), "Tab shouldn't be pending.");
|
||||||
ok(!newTab2.hasAttribute("crashed"), "Second tab shouldn't be marked as crashed anymore.");
|
ok(!newTab2.hasAttribute("crashed"), "Second tab shouldn't be marked as crashed anymore.");
|
||||||
ok(newTab2.hasAttribute("pending"), "Second tab should be pending.");
|
|
||||||
|
|
||||||
gBrowser.selectedTab = newTab2;
|
|
||||||
yield promiseTabRestored(newTab2);
|
|
||||||
ok(!newTab2.hasAttribute("pending"), "Second tab shouldn't be pending.");
|
ok(!newTab2.hasAttribute("pending"), "Second tab shouldn't be pending.");
|
||||||
|
|
||||||
// We can't just check browser.currentURI.spec, because from
|
// We can't just check browser.currentURI.spec, because from
|
||||||
|
@ -328,8 +334,8 @@ add_task(function test_revive_all_tabs_from_session_store() {
|
||||||
// We should also have two entries in the browser history.
|
// We should also have two entries in the browser history.
|
||||||
yield promiseHistoryLength(browser, 2);
|
yield promiseHistoryLength(browser, 2);
|
||||||
|
|
||||||
|
yield BrowserTestUtils.closeWindow(win2);
|
||||||
gBrowser.removeTab(newTab);
|
gBrowser.removeTab(newTab);
|
||||||
gBrowser.removeTab(newTab2);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,9 +365,10 @@ add_task(function test_close_tab_after_crash() {
|
||||||
is(gBrowser.tabs.length, 1, "Should have closed the tab");
|
is(gBrowser.tabs.length, 1, "Should have closed the tab");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that "restore all" button is only shown if more than one tab
|
* Checks that "restore all" button is only shown if more than one tab
|
||||||
* has crashed.
|
* is showing about:tabcrashed
|
||||||
*/
|
*/
|
||||||
add_task(function* test_hide_restore_all_button() {
|
add_task(function* test_hide_restore_all_button() {
|
||||||
let newTab = gBrowser.addTab();
|
let newTab = gBrowser.addTab();
|
||||||
|
@ -391,11 +398,19 @@ add_task(function* test_hide_restore_all_button() {
|
||||||
browser.loadURI(PAGE_2);
|
browser.loadURI(PAGE_2);
|
||||||
yield promiseBrowserLoaded(browser);
|
yield promiseBrowserLoaded(browser);
|
||||||
|
|
||||||
|
// Load up a second window so we can get another tab to show
|
||||||
|
// about:tabcrashed
|
||||||
|
let win2 = yield BrowserTestUtils.openNewBrowserWindow();
|
||||||
|
let newTab3 = win2.gBrowser.addTab(PAGE_2);
|
||||||
|
win2.gBrowser.selectedTab = newTab3;
|
||||||
|
let otherWinBrowser = newTab3.linkedBrowser;
|
||||||
|
yield promiseBrowserLoaded(otherWinBrowser);
|
||||||
// We'll need to make sure the second tab's browser has finished
|
// We'll need to make sure the second tab's browser has finished
|
||||||
// sending its AboutTabCrashedReady event before we know for
|
// sending its AboutTabCrashedReady event before we know for
|
||||||
// sure whether or not we're showing the right Restore buttons.
|
// sure whether or not we're showing the right Restore buttons.
|
||||||
let otherBrowserReady = promiseTabCrashedReady(newTab2.linkedBrowser);
|
let otherBrowserReady = promiseTabCrashedReady(otherWinBrowser);
|
||||||
// Crash the tab
|
|
||||||
|
// Crash the first tab.
|
||||||
yield BrowserTestUtils.crashBrowser(browser);
|
yield BrowserTestUtils.crashBrowser(browser);
|
||||||
yield otherBrowserReady;
|
yield otherBrowserReady;
|
||||||
|
|
||||||
|
@ -406,6 +421,7 @@ add_task(function* test_hide_restore_all_button() {
|
||||||
ok(!restoreAllButton.hasAttribute("hidden"), "Restore All button should not be hidden");
|
ok(!restoreAllButton.hasAttribute("hidden"), "Restore All button should not be hidden");
|
||||||
ok(!(restoreOneButton.classList.contains("primary")), "Restore Tab button should not have the primary class");
|
ok(!(restoreOneButton.classList.contains("primary")), "Restore Tab button should not have the primary class");
|
||||||
|
|
||||||
|
yield BrowserTestUtils.closeWindow(win2);
|
||||||
gBrowser.removeTab(newTab);
|
gBrowser.removeTab(newTab);
|
||||||
gBrowser.removeTab(newTab2);
|
gBrowser.removeTab(newTab2);
|
||||||
});
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче