зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1265818 - Part 4 - Test that scroll positions for previous session history entries are restored on Desktop. r=mikedeboer
This extends the existing the existing scroll position test by navigating to a second page and then checking that after closing and restoring that tab, the scroll position is restored not only for the current history entry, but after going back as well. MozReview-Commit-ID: Ddig1Mfo5rz --HG-- extra : rebase_source : 20bdc1f116b27f7386a9b7d1cdc0ad383b21b99c
This commit is contained in:
Родитель
6d4628844f
Коммит
8da83bac15
|
@ -31,6 +31,7 @@ support-files =
|
|||
browser_pageStyle_sample_nested.html
|
||||
browser_sessionHistory_slow.sjs
|
||||
browser_scrollPositions_sample.html
|
||||
browser_scrollPositions_sample2.html
|
||||
browser_scrollPositions_sample_frameset.html
|
||||
browser_scrollPositions_readerModeArticle.html
|
||||
browser_sessionStorage.html
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
const BASE = "http://example.com/browser/browser/components/sessionstore/test/"
|
||||
const URL = BASE + "browser_scrollPositions_sample.html";
|
||||
const URL2 = BASE + "browser_scrollPositions_sample2.html";
|
||||
const URL_FRAMESET = BASE + "browser_scrollPositions_sample_frameset.html";
|
||||
|
||||
// Randomized set of scroll positions we will use in this test.
|
||||
|
@ -108,6 +109,8 @@ add_task(function* test_scroll_nested() {
|
|||
/**
|
||||
* Test that scroll positions persist after restoring background tabs in
|
||||
* a restored window (bug 1228518).
|
||||
* Also test that scroll positions for previous session history entries
|
||||
* are preserved as well (bug 1265818).
|
||||
*/
|
||||
add_task(function* test_scroll_background_tabs() {
|
||||
pushPrefs(["browser.sessionstore.restore_on_demand", true]);
|
||||
|
@ -119,7 +122,15 @@ add_task(function* test_scroll_background_tabs() {
|
|||
|
||||
// Scroll down a little.
|
||||
yield sendMessage(browser, "ss-test:setScrollPosition", {x: SCROLL_X, y: SCROLL_Y});
|
||||
yield checkScroll(tab, {scroll: SCROLL_STR}, "scroll is fine");
|
||||
yield checkScroll(tab, {scroll: SCROLL_STR}, "scroll on first page is fine");
|
||||
|
||||
// Navigate to a different page and scroll there as well.
|
||||
browser.loadURI(URL2);
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
// Scroll down a little.
|
||||
yield sendMessage(browser, "ss-test:setScrollPosition", {x: SCROLL2_X, y: SCROLL2_Y});
|
||||
yield checkScroll(tab, {scroll: SCROLL2_STR}, "scroll on second page is fine");
|
||||
|
||||
// Close the window
|
||||
yield BrowserTestUtils.closeWindow(newWin);
|
||||
|
@ -149,7 +160,17 @@ add_task(function* test_scroll_background_tabs() {
|
|||
newWin.gBrowser.selectedTab = tab;
|
||||
yield promiseTabRestored(tab);
|
||||
|
||||
yield checkScroll(tab, {scroll: SCROLL_STR}, "scroll is still fine");
|
||||
yield checkScroll(tab, {scroll: SCROLL2_STR}, "scroll is still fine");
|
||||
|
||||
// Now go back in history and check that the scroll position
|
||||
// is restored there as well.
|
||||
is(browser.canGoBack, true, "can go back");
|
||||
browser.goBack();
|
||||
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
yield TabStateFlusher.flush(browser);
|
||||
|
||||
yield checkScroll(tab, {scroll: SCROLL_STR}, "scroll is still fine after navigating back");
|
||||
|
||||
yield BrowserTestUtils.closeWindow(newWin);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>browser_scrollPositions_sample.html</title>
|
||||
</head>
|
||||
<body style='width: 100000px; height: 100000px;'>top</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче