| OLD | NEW |
| (Empty) |
| 1 <script> | |
| 2 function noop(x) { | |
| 3 } | |
| 4 | |
| 5 function doGC() { | |
| 6 if (window.gc) { | |
| 7 // GC twice to make sure everything is cleaned up. | |
| 8 for (var i = 0; i < 4; i++) { | |
| 9 window.gc(); | |
| 10 } | |
| 11 } | |
| 12 } | |
| 13 | |
| 14 function runtest() { | |
| 15 if (window.layoutTestController) | |
| 16 layoutTestController.dumpAsText(); | |
| 17 | |
| 18 doGC(); | |
| 19 | |
| 20 var plug1 = document.getElementById("plug1"); | |
| 21 var plug2 = document.getElementById("plug2"); | |
| 22 var output = document.getElementById("output"); | |
| 23 output.innerHTML = ""; | |
| 24 | |
| 25 var testObj1 = plug1.testObject; | |
| 26 var testObj2 = plug2.testObject; | |
| 27 | |
| 28 var successCount = 0; | |
| 29 | |
| 30 // Verify we can access each object. | |
| 31 if (testObj1.foo == "foo") { | |
| 32 successCount++; | |
| 33 output.innerHTML += "Got testObj1 property<br>"; | |
| 34 } | |
| 35 if (testObj2.foo == "foo") { | |
| 36 successCount++; | |
| 37 output.innerHTML += "Got testObj2 property<br>"; | |
| 38 } | |
| 39 | |
| 40 // Now remove the first plugin | |
| 41 plug1.parentNode.removeChild(plug1); | |
| 42 | |
| 43 try { | |
| 44 if (testObj1.foo == "foo") { | |
| 45 output.innerHTML = "Accessed nuked object!<br>"; | |
| 46 } | |
| 47 } catch (e) { | |
| 48 if (e instanceof ReferenceError) | |
| 49 successCount++; | |
| 50 } | |
| 51 | |
| 52 try { | |
| 53 if (testObj2.foo == "foo") { | |
| 54 successCount++; | |
| 55 output.innerHTML += "Got testObj2 property<br>"; | |
| 56 } | |
| 57 } catch(e) { | |
| 58 output.inerHTML += "Reference error accessing live object: " + e; | |
| 59 } | |
| 60 | |
| 61 // Now remove the second plugin | |
| 62 plug2.parentNode.removeChild(plug2); | |
| 63 | |
| 64 try { | |
| 65 if (testObj2.foo == "foo") { | |
| 66 output.innerHTML = "Accessed nuked object!<br>"; | |
| 67 } | |
| 68 } catch (e) { | |
| 69 if (e instanceof ReferenceError) | |
| 70 successCount++; | |
| 71 } | |
| 72 | |
| 73 var success = (successCount == 5); | |
| 74 output.innerHTML += (success ? "SUCCESS" : "FAILURE"); | |
| 75 } | |
| 76 </script> | |
| 77 | |
| 78 <body onload="runtest()"> | |
| 79 | |
| 80 Test that we can create two plugins, and independently clean each. | |
| 81 | |
| 82 Prints "SUCCESS" on success, "FAILURE" on failure. | |
| 83 | |
| 84 <embed id="plug1" type="application/x-webkit-test-netscape"> | |
| 85 <embed id="plug2" type="application/x-webkit-test-netscape"> | |
| 86 | |
| 87 <div id=output>FAILURE</div> | |
| 88 | |
| 89 </body> | |
| 90 | |
| OLD | NEW |