| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <script> | |
| 3 if (window.testRunner) { | |
| 4 testRunner.dumpAsText(); | |
| 5 testRunner.waitUntilDone(); | |
| 6 testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1); | |
| 7 testRunner.overridePreference("WebKitPageCacheSupportsPluginsPreferenceKey",
1); | |
| 8 } | |
| 9 | |
| 10 var savedTestObject = null; | |
| 11 var currentTestStage = null; | |
| 12 var hasHidden = false; | |
| 13 | |
| 14 function runTest() | |
| 15 { | |
| 16 var plugin = document.getElementById("testPlugin"); | |
| 17 | |
| 18 if (!savedTestObject) | |
| 19 savedTestObject = plugin.testObject; | |
| 20 | |
| 21 try { | |
| 22 log("Accessing testObject.property"); | |
| 23 savedTestObject.property; | |
| 24 log("Accessed testObject.property without exception"); | |
| 25 } catch (e) { | |
| 26 log("While accessing testObject.property: " + e); | |
| 27 } | |
| 28 | |
| 29 try { | |
| 30 log("Assigning to testObject.property"); | |
| 31 savedTestObject.property = 'hello'; | |
| 32 log("Assigned to testObject.property without exception"); | |
| 33 } catch (e) { | |
| 34 log("While assigning to testObject.property: " + e); | |
| 35 } | |
| 36 | |
| 37 if (!hasHidden) | |
| 38 setTimeout("window.location.href = 'resources/go-back.html'", 0); | |
| 39 else { | |
| 40 if (window.testRunner) | |
| 41 testRunner.notifyDone(); | |
| 42 } | |
| 43 | |
| 44 } | |
| 45 | |
| 46 function loaded() { | |
| 47 currentTestStage = "Initial load"; | |
| 48 log("Page loaded"); | |
| 49 } | |
| 50 | |
| 51 function hidden() { | |
| 52 log("Page hidden"); | |
| 53 hasHidden = true; | |
| 54 } | |
| 55 | |
| 56 function shown() { | |
| 57 if (hasHidden) | |
| 58 currentTestStage = "Restored from page cache" | |
| 59 log("Page shown"); | |
| 60 } | |
| 61 | |
| 62 function pluginCreated() | |
| 63 { | |
| 64 log("Plugin created"); | |
| 65 setTimeout("runTest()", 0); | |
| 66 } | |
| 67 | |
| 68 function log(message) | |
| 69 { | |
| 70 document.getElementById("logging").innerHTML += currentTestStage + ": " + mes
sage + "<br>"; | |
| 71 } | |
| 72 </script> | |
| 73 | |
| 74 <body onload="loaded()" onpagehide="hidden();" onpageshow="shown();"> | |
| 75 This tests that pages with plugins behave properly with the page cache. This in
cludes:<br> | |
| 76 -The plugin being destroyed upon navigation away from the page.<br> | |
| 77 -The plugin being recreated upon restoring the page from the page cache.<br> | |
| 78 -Plugin script objects accessed the first time the plugin was created are approp
riately invalidated after the page has been restored from the page cache.<br><br
> | |
| 79 Unfortunately there is no reliable way to get affirmative confirmation that the
plugin was destroyed upon navigation away from the page. For now we'll assume r
ecreation means it had successfully been destroyed.<br> | |
| 80 <embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" hei
ght="200" onNew="pluginCreated()"></embed><br> | |
| 81 <div id="logging"></div> | |
| 82 </body> | |
| 83 </html> | |
| OLD | NEW |