mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 653741 - You should be able to scoll back to the current anchor by focusing the location bar and pressing <enter>. r=bz
--HG-- extra : rebase_source : fde3ce1083868e7d398c626628344bc521224666
This commit is contained in:
parent
d95de3bc9d
commit
bbf62ae869
@ -8300,8 +8300,10 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
GetCurScrollPos(ScrollOrientation_X, &cx);
|
||||
GetCurScrollPos(ScrollOrientation_Y, &cy);
|
||||
|
||||
// We scroll the window precisely when we fire a hashchange event.
|
||||
if (doHashchange) {
|
||||
// We scroll whenever we're not doing a history load. Note that
|
||||
// sometimes we might scroll even if we don't fire a hashchange
|
||||
// event! See bug 653741.
|
||||
if (!aSHEntry) {
|
||||
// Take the '#' off the hashes before passing them to
|
||||
// ScrollToAnchor.
|
||||
nsDependentCSubstring curHashName(curHash, 1);
|
||||
|
@ -101,6 +101,8 @@ _TEST_FILES = \
|
||||
test_bug640387_1.html \
|
||||
test_bug640387_2.html \
|
||||
file_bug640387.html \
|
||||
test_bug653741.html \
|
||||
file_bug653741.html \
|
||||
test_framedhistoryframes.html \
|
||||
test_windowedhistoryframes.html \
|
||||
historyframes.html \
|
||||
|
13
docshell/test/file_bug653741.html
Normal file
13
docshell/test/file_bug653741.html
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<body onload='(parent || opener).childLoad()'>
|
||||
|
||||
<div style='height:500px; background:yellow'>
|
||||
<a id='#top'>Top of the page</a>
|
||||
</div>
|
||||
|
||||
<div id='bottom'>
|
||||
<a id='#bottom'>Bottom of the page</a>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
50
docshell/test/test_bug653741.html
Normal file
50
docshell/test/test_bug653741.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=653741
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 653741</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=653741">Mozilla Bug 653741</a>
|
||||
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
/** Test for Bug 653741 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function childLoad() {
|
||||
// Spin the event loop so we leave the onload handler.
|
||||
SimpleTest.executeSoon(childLoad2);
|
||||
}
|
||||
|
||||
function childLoad2() {
|
||||
let cw = $('iframe').contentWindow;
|
||||
|
||||
// Save the Y offset. For sanity's sake, make sure it's not 0, because we
|
||||
// should be at the bottom of the page!
|
||||
let origYOffset = cw.pageYOffset;
|
||||
ok(origYOffset != 0, 'Original Y offset is not 0.');
|
||||
|
||||
// Scroll the iframe to the top, then navigate to #bottom again.
|
||||
cw.scrollTo(0, 0);
|
||||
|
||||
// Our current location is #bottom, so this should scroll us down to the
|
||||
// bottom again.
|
||||
cw.location = cw.location + '';
|
||||
|
||||
is(cw.pageYOffset, origYOffset, 'Correct offset after reloading page.');
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<iframe height='100px' id='iframe' src='file_bug653741.html#bottom'></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user