Reviewed by Alexey.
[WebKit-https.git] / LayoutTests / fast / frames / frame-set-same-location.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2         "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <script>
6     
7     if (window.layoutTestController)
8         layoutTestController.waitUntilDone();
9
10     function rightFrameLoaded() {
11         rightFrameLoadCount++;
12         if (rightFrameLoadCount == 2) {
13             // Console is set by runTest
14             console.firstChild.nodeValue = "SUCCESS";
15             
16             if (window.layoutTestController) {
17                 // Put the test result in the main document so we can dump as text
18                 var text = console.ownerDocument.documentElement.innerHTML;
19                 document.open();
20                 document.write(text);
21                 document.close();
22                 
23                 layoutTestController.dumpAsText();
24                 layoutTestController.notifyDone();
25             }
26         }
27     }
28     
29     function runTest() {
30         console = document.getElementById("left_frame").contentWindow.document.getElementById("console");
31         if (console.firstChild.nodeValue == "FAILURE") {
32             console.firstChild.nodeValue = "PROCESSING...";
33             document.getElementById("right_frame").contentWindow.location.href = "resources/purple.html";
34         } else {
35             alert('TEST FAILURE: Unexpected onload call')
36         }
37     }
38     
39     rightFrameLoadCount = 0;
40 </script>
41 </head>
42 <frameset onload="runTest()" cols="50%,*">
43 <frame id="left_frame" src="data:text/html,<body><p>Test for <a href='http://bugzilla.opendarwin.org/show_bug.cgi?id=3400'>bug 3400</a>: setting the .src of an iframe to the same value does not reload page.</p><p>Testing that setting contentWindow.location.href of a frame to the same value works</p><p id=console>FAILURE</p></body>">
44 <frame id="right_frame" onload="javascript:rightFrameLoaded()" src="resources/purple.html"></frame>
45 </frameset>
46 </html>