| <p>This page tests which object prototype is used when calling "new" across |
| windows. If the test passes, you'll see a series of PASS messages below. |
| </p> |
| |
| <pre id="console"></pre> |
| |
| <iframe id="iframe" style="visibility:hidden"></iframe> |
| |
| <script> |
| function log(s) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(s + "\n")); |
| } |
| |
| function shouldBe(a, aDescription, b) |
| { |
| if (a === b) |
| log("PASS: " + aDescription + " should be " + b + " and is."); |
| else |
| log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + "."); |
| } |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| frames[0].document.open(); |
| frames[0].document.write("<\script>function O() { }</script\>"); |
| frames[0].document.close(); |
| |
| var o = new frames[0].O; |
| shouldBe(o instanceof frames[0].Object, "o instanceof frames[0].Object", true); |
| shouldBe(o.__proto__.__proto__ === frames[0].Object.prototype, "o.__proto__.__proto__ === frames[0].Object.prototype", true); |
| </script> |