OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head><title>History test1</title> |
| 3 <script src="HistoryHelper.js"></script> |
| 4 </head> |
| 5 |
| 6 <body onload="onLoad();"> |
| 7 <div id="statusPanel" style="border: 1px solid red; width: 100%"> |
| 8 History Test1 running.... |
| 9 </body> |
| 10 |
| 11 <SCRIPT type="text/javascript"> |
| 12 var first_run_cookie = "First_History_Test_Run"; |
| 13 var second_run_cookie = "Second_History_Test_Run"; |
| 14 |
| 15 function onLoad() { |
| 16 if (readCookie(second_run_cookie) != null) { |
| 17 setTimeout(OnValidateHistoryForSecondRun, 100); |
| 18 return true; |
| 19 } |
| 20 |
| 21 if (readCookie(first_run_cookie) != null) { |
| 22 setTimeout(OnMoveForwardInHistory, 100); |
| 23 return true; |
| 24 } |
| 25 |
| 26 setTimeout(OnNavigateToPage2, 100); |
| 27 return true; |
| 28 } |
| 29 |
| 30 function OnValidateHistoryForSecondRun() { |
| 31 eraseCookie(first_run_cookie); |
| 32 eraseCookie(second_run_cookie); |
| 33 |
| 34 if (window.history.length != 2) { |
| 35 onFailure("History_Length_Test", 1, "Second run history length mismatch"); |
| 36 return false; |
| 37 } |
| 38 |
| 39 onSuccess("History_Length_Test", 1); |
| 40 return true; |
| 41 } |
| 42 |
| 43 function OnMoveForwardInHistory() { |
| 44 if (window.history.length != 2) { |
| 45 onFailure("History_Length_Test", 1, "History length mismatch in MoveForward
navigation"); |
| 46 return false; |
| 47 } |
| 48 |
| 49 createCookie(second_run_cookie, "1", "1"); |
| 50 window.history.forward(); |
| 51 return true; |
| 52 } |
| 53 |
| 54 function OnNavigateToPage2() { |
| 55 if (window.history.length != 2) { |
| 56 onFailure("History_Length_Test", 1, "History length mismatch in initial navi
gation"); |
| 57 return false; |
| 58 } |
| 59 |
| 60 createCookie(first_run_cookie, "1", "1"); |
| 61 window.location.href = "history_length_test2.html"; |
| 62 return true; |
| 63 } |
| 64 |
| 65 </SCRIPT> |
| 66 </html> |
OLD | NEW |