Bumping manifests a=b2g-bump
[gecko.git] / docshell / test / test_bug640387_2.html
blob00c27fdda427f87bf7f502c00f07e125cde82ae6
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=640387
5 -->
6 <head>
7 <title>Test for Bug 640387</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=640387">Mozilla Bug 640387</a>
15 <!-- Test that, when going from
17 http://example.com/#foo
21 http://example.com/
23 via a non-history load, we do a true load, rather than a scroll. -->
25 <script type='application/javascript;version=1.7'>
26 SimpleTest.waitForExplicitFinish();
28 callbackOnLoad = false;
29 function childLoad() {
30 if (callbackOnLoad) {
31 callbackOnLoad = false;
32 gGen.next();
36 errorOnHashchange = false;
37 callbackOnHashchange = false;
38 function childHashchange() {
39 if (errorOnHashchange) {
40 ok(false, 'Got unexpected hashchange.');
42 if (callbackOnHashchange) {
43 callbackOnHashchange = false;
44 gGen.next();
48 function run_test() {
49 var iframe = $('iframe').contentWindow;
51 ok(true, 'Got first load');
53 // Spin the event loop so we exit the onload handler.
54 SimpleTest.executeSoon(function() { gGen.next() });
55 yield undefined;
57 let origLocation = iframe.location + '';
58 callbackOnHashchange = true;
59 iframe.location.hash = '#1';
60 // Wait for a hashchange event.
61 yield undefined;
63 ok(true, 'Got hashchange.');
65 iframe.location = origLocation;
66 // This should produce a load event and *not* a hashchange, because the
67 // result of the load is a different document than we had previously.
68 callbackOnLoad = true;
69 errorOnHashchange = true;
70 yield undefined;
72 ok(true, 'Got final load.');
74 // Spin the event loop to give hashchange a chance to fire, if it's going to.
75 SimpleTest.executeSoon(function() { gGen.next() });
76 yield undefined;
78 SimpleTest.finish();
79 yield undefined;
82 callbackOnLoad = true;
83 gGen = run_test();
85 </script>
87 <iframe id='iframe' src='file_bug640387.html'></iframe>
89 </body>
90 </html>