| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <script> |
| 3 |
| 4 // Navigation steps: |
| 5 // 1- loads this page |
| 6 // 2- loads this page + hash (doesn't call onload) |
| 7 // 3- loads a data URL that just navigates back |
| 8 // 4- loads this page + hash (calls onload, triggering completion) |
| 9 |
| 10 function navigateToHash(field) { |
| 11 location.hash = 'hash'; |
| 12 field.value = 'test'; |
| 13 } |
| 14 |
| 15 function navigateAwayAndBack() { |
| 16 // Assigning to location does not create a history entry, so |
| 17 // instead we simulate a link click. |
| 18 var evt = document.createEvent("MouseEvents"); |
| 19 evt.initMouseEvent("click", true, true, window, |
| 20 0, 0, 0, 0, 0, false, false, false, false, 0, null); |
| 21 document.getElementById('anchor').dispatchEvent(evt); |
| 22 } |
| 23 |
| 24 function runTestStep() { |
| 25 var hash = location.hash; |
| 26 var field = document.getElementById('field'); |
| 27 |
| 28 if (hash == "") { |
| 29 if (window.layoutTestController) { |
| 30 layoutTestController.dumpAsText(); |
| 31 layoutTestController.waitUntilDone(); |
| 32 } |
| 33 navigateToHash(field); |
| 34 navigateAwayAndBack(); |
| 35 } else { |
| 36 document.body.innerHTML = (field.value == '') ? 'FAIL' : 'PASS'; |
| 37 if (window.layoutTestController) |
| 38 layoutTestController.notifyDone(); |
| 39 } |
| 40 } |
| 41 |
| 42 </script> |
| 43 <body onload='runTestStep()' onunload='/*suppress page cache*/'> |
| 44 <input id='field'></input> |
| 45 <a id='anchor' href='data:text/html,<body onload="history.back()"></body>'>go
away and come back</a> |
| 46 </body> |
| 47 </html> |
| OLD | NEW |