1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/test/test_bug662170.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=662170 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 662170</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=662170">Mozilla Bug 662170</a> 1.17 + 1.18 +<script type="application/javascript;version=1.7"> 1.19 + 1.20 +/** Test for Bug 662170 **/ 1.21 +SimpleTest.waitForExplicitFinish(); 1.22 + 1.23 +function childLoad() { 1.24 + // Spin the event loop so we leave the onload handler. 1.25 + SimpleTest.executeSoon(childLoad2); 1.26 +} 1.27 + 1.28 +function childLoad2() { 1.29 + let cw = $('iframe').contentWindow; 1.30 + 1.31 + // When we initially load the page, we should be at the top. 1.32 + is(cw.pageYOffset, 0, 'Initial Y offset should be 0.'); 1.33 + 1.34 + // Scroll the iframe to the bottom. 1.35 + cw.scrollTo(0, 300); 1.36 + 1.37 + // Did we actually scroll somewhere? 1.38 + isnot(cw.pageYOffset, 0, 'Y offset should be non-zero after scrolling.'); 1.39 + 1.40 + // Now load file_bug662170.html#, which should take us to the top of the 1.41 + // page. 1.42 + cw.location = cw.location + '#'; 1.43 + 1.44 + is(cw.pageYOffset, 0, 'Correct Y offset after loading #.'); 1.45 + SimpleTest.finish(); 1.46 +} 1.47 + 1.48 +</script> 1.49 + 1.50 +<!-- When the iframe loads, it calls childLoad(). --> 1.51 +<iframe height='100px' id='iframe' src='file_bug662170.html'></iframe> 1.52 + 1.53 +</body> 1.54 +</html>