Bug 1237075 - Navigating from 'manual' to 'auto' session history entry should scroll the page, r=jst

--HG--
extra : rebase_source : c6d901084edf1b17e21c44515a0483c7fbcc77dd
This commit is contained in:
Olli Pettay 2016-01-06 04:03:42 +02:00
parent ddf76b50b9
commit fb35bc42f0
2 changed files with 14 additions and 0 deletions

View File

@ -10072,6 +10072,11 @@ nsDocShell::InternalLoad(nsIURI* aURI,
}
}
// If we're doing a history load, use its scroll restoration state.
if (aSHEntry) {
aSHEntry->GetScrollRestorationIsManual(&scrollRestorationIsManual);
}
/* Assign mOSHE to mLSHE. This will either be a new entry created
* by OnNewURI() for normal loads or aSHEntry for history loads.
*/

View File

@ -82,6 +82,15 @@
opener.is(window.scrollY, 0, "Shouldn't have scrolled back to the state3's position");
opener.is(history.state.state, "state3", "Unexpected state.");
history.pushState({ state: "state5" }, "state5");
history.scrollRestoration = "auto";
document.getElementById("bottom").scrollIntoView();
opener.isnot(window.scrollY, 0, "Should have scrolled to 'bottom'.");
history.back();
window.scrollTo(0, 0);
history.forward();
opener.isnot(window.scrollY, 0, "Should have scrolled back to the state5's position");
var ifr = document.createElement("iframe");
ifr.src = "data:text/html,";
document.body.appendChild(ifr);