| OLD | NEW |
| (Empty) |
| 1 <script> | |
| 2 if (window.testRunner) { | |
| 3 testRunner.dumpAsText(); | |
| 4 testRunner.waitUntilDone(); | |
| 5 testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1); | |
| 6 } | |
| 7 | |
| 8 var cachedApplicationCache = window.applicationCache; | |
| 9 var cachedConsole = window.console; | |
| 10 var cachedCrypto = window.crypto; | |
| 11 var cachedHistory = window.history; | |
| 12 var cachedLocalStorage = window.localStorage; | |
| 13 var cachedLocation = window.location; | |
| 14 var cachedLocationbar = window.locationbar; | |
| 15 var cachedMedia = window.styleMedia; | |
| 16 var cachedMenubar = window.menubar; | |
| 17 var cachedNavigator = window.navigator; | |
| 18 var cachedPersonalbar = window.personalbar; | |
| 19 var cachedScreen = window.screen; | |
| 20 var cachedScrollbars = window.scrollbars; | |
| 21 var cachedSelection = window.getSelection(); | |
| 22 var cachedSessionStorage = window.sessionStorage; | |
| 23 var cachedStatusbar = window.statusbar; | |
| 24 var cachedToolbar = window.toolbar; | |
| 25 | |
| 26 function logMessage(msg) | |
| 27 { | |
| 28 document.getElementById("outputDiv").innerText += msg + " \n"; | |
| 29 } | |
| 30 | |
| 31 function logErrorMessage(msg) | |
| 32 { | |
| 33 document.getElementById("errorDiv").innerText += msg + " \n"; | |
| 34 } | |
| 35 | |
| 36 window.onpageshow = function(evt) { | |
| 37 if (!evt.persisted) { | |
| 38 window.setTimeout("window.location.href = 'resources/empty-docum
ent-goes-back.html'", 0); | |
| 39 return; | |
| 40 } | |
| 41 | |
| 42 // First alert all of the objects to make sure we get a valid toString()
-ification | |
| 43 // instead of "undefined", "null", or "Object" | |
| 44 logMessage(window.applicationCache); | |
| 45 logMessage(window.console); | |
| 46 logMessage(window.crypto); | |
| 47 logMessage(window.history); | |
| 48 logMessage(window.localStorage); | |
| 49 logMessage(window.location != null && window.location != undefined); | |
| 50 logMessage(window.locationbar); | |
| 51 logMessage(window.styleMedia); | |
| 52 logMessage(window.menubar); | |
| 53 logMessage(window.navigator); | |
| 54 logMessage(window.personalbar); | |
| 55 logMessage(window.screen); | |
| 56 logMessage(window.scrollbars); | |
| 57 logMessage(window.getSelection() != null && window.getSelection() != und
efined); | |
| 58 logMessage(window.sessionStorage); | |
| 59 logMessage(window.statusbar); | |
| 60 logMessage(window.toolbar); | |
| 61 | |
| 62 // Then make sure the window properties match the cached references from
the initial page load | |
| 63 if (cachedApplicationCache != window.applicationCache) | |
| 64 logErrorMessage("applicationCache"); | |
| 65 if (cachedConsole != window.console) | |
| 66 logErrorMessage("console"); | |
| 67 if (cachedCrypto != window.crypto) | |
| 68 logErrorMessage("crypto"); | |
| 69 if (cachedHistory != window.history) | |
| 70 logErrorMessage("history"); | |
| 71 if (cachedLocalStorage != window.localStorage) | |
| 72 logErrorMessage("localStorage"); | |
| 73 if (cachedLocation != window.location) | |
| 74 logErrorMessage("location"); | |
| 75 if (cachedLocationbar != window.locationbar) | |
| 76 logErrorMessage("locationbar"); | |
| 77 if (cachedMedia != window.styleMedia) | |
| 78 logErrorMessage("styleMedia"); | |
| 79 if (cachedMenubar != window.menubar) | |
| 80 logErrorMessage("menubar"); | |
| 81 if (cachedNavigator != window.navigator) | |
| 82 logErrorMessage("navigator"); | |
| 83 if (cachedPersonalbar != window.personalbar) | |
| 84 logErrorMessage("personalbar"); | |
| 85 if (cachedScreen != window.screen) | |
| 86 logErrorMessage("screen"); | |
| 87 if (cachedScrollbars != window.scrollbars) | |
| 88 logErrorMessage("scrollbars"); | |
| 89 if (cachedSelection != window.getSelection()) | |
| 90 logErrorMessage("getSelection"); | |
| 91 if (cachedSessionStorage != window.sessionStorage) | |
| 92 logErrorMessage("sessionStorage"); | |
| 93 if (cachedStatusbar != window.statusbar) | |
| 94 logErrorMessage("statusbar"); | |
| 95 if (cachedToolbar != window.toolbar) | |
| 96 logErrorMessage("toolbar"); | |
| 97 | |
| 98 if (document.getElementById("errorDiv").innerText == "") | |
| 99 document.getElementById("errorDiv").innerText = "All tests passe
d."; | |
| 100 | |
| 101 if (window.testRunner) | |
| 102 testRunner.notifyDone(); | |
| 103 } | |
| 104 | |
| 105 </script> | |
| 106 <body> | |
| 107 This test makes sure that various properties on the window object are correctly
reconnected after restoring a page from the page cache.<br> | |
| 108 <div id="outputDiv"></div><br> | |
| 109 <div id="errorDiv"></div> | |
| 110 </body> | |
| OLD | NEW |