Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / navigation / resources / forward-to-fragment-fires-onload-2.html
blob5bb43dcc64edad350d05a19c9ad4d5c171d43ec1
1 Page 2.
2 <script>
3 onload = function()
5 if (window.localStorage.stage == 'one') {
6 console.log('1. Got to page 2. Going to #foo.');
7 window.localStorage.stage = 'two';
8 // Navigate in a timeout to make sure we create a history entry.
9 setTimeout(function() {
10 window.location.href = '#foo';
11 }, 0);
12 } else if (window.localStorage.stage == 'five') {
13 console.log('5. Got to page 2 onload. Success.');
14 window.localStorage.stage = 'six';
15 history.go(-2);
19 onhashchange = function()
21 if (window.localStorage.stage == 'two') {
22 console.log('2. Got to page 2 #foo. Going back to start.');
23 window.localStorage.stage = 'three';
24 history.go(-2);
28 // Go forward to fragment after the page is finished parsing.
29 document.addEventListener('DOMContentLoaded', function() {
30 if (window.localStorage.stage == 'four') {
31 console.log('4. Got back to page 2. Immediately going forward.');
32 window.localStorage.stage = 'five';
33 history.forward();
35 });
37 </script>
38 <!-- Slow image to let us to go forward while the page is still loading. -->
39 <img src="slow-resource.pl?delay=100"></iframe>