JS Test Harness: Insert the stylesheet dynamically
[WebKit-https.git] / LayoutTests / fast / history / same-document-iframes-changing-fragment.html
1 <!DOCTYPE html> 
2 <html> 
3 <head>
4   <script src="../js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <pre id="console"></pre>
9
10 <iframe src="data:text/plain,iframe1" id="iframe1"></iframe> 
11 <iframe src="data:text/plain,iframe2" id="iframe2"></iframe> 
12
13 <script>
14 var wentBack = false;
15
16 description('Tests that we trigger same-document navigation when history entries are generated via fragment changes, even if the frames present in the document change between history entries.');
17
18 if (window.layoutTestController) {
19     layoutTestController.dumpChildFramesAsText();
20     layoutTestController.clearBackForwardList();
21     layoutTestController.dumpBackForwardList();
22 }
23
24 onload = function()
25 {
26     // Run afer onload, to make sure that we can generate history entries.
27     setTimeout(beginTest, 0);
28 }
29
30 onpopstate = function(event) {
31     var loc = location.href;
32     var filenameAndQuery = loc.substring(loc.lastIndexOf('/') + 1);
33     debug('popstate to state: ' + event.state + ' filename: ' + filenameAndQuery);
34     
35     if (!location.hash) {
36         if (wentBack) {
37             debug('going forward');
38             history.forward();
39         }
40     } else if (location.hash == '#newState') {
41         if (!wentBack) {
42             wentBack = true;
43             debug('going back');
44             history.back();
45         } else {
46             finishJSTest();
47         }
48     } else {
49         testFailed('Unexpected state');
50     }
51 };
52
53
54 function beginTest() 
55 {
56     debug('removing iframe2');
57     document.body.removeChild(document.getElementById('iframe2'));
58
59     debug('navigating to #newState');
60     window.location.href = '#newState';
61 }
62
63 var successfullyParsed = true;
64 var jsTestIsAsync = true;
65 </script>  
66 <script src="../js/resources/js-test-post.js"></script>
67 </body>
68 </html>