Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / construct-global-object.html
blob7f38ea7f17a8babafc31774887ffd900bfe10b80
1 <p>This page tests which object prototype is used when calling "new" across
2 windows. If the test passes, you'll see a series of PASS messages below.
3 </p>
5 <pre id="console"></pre>
7 <iframe id="iframe" style="visibility:hidden"></iframe>
9 <script>
10 function log(s)
12 document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
15 function shouldBe(a, aDescription, b)
17 if (a === b)
18 log("PASS: " + aDescription + " should be " + b + " and is.");
19 else
20 log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".");
23 if (window.testRunner)
24 testRunner.dumpAsText();
26 frames[0].document.open();
27 frames[0].document.write("<\script>function O() { }</script\>");
28 frames[0].document.close();
30 var o = new frames[0].O;
31 shouldBe(o instanceof frames[0].Object, "o instanceof frames[0].Object", true);
32 shouldBe(o.__proto__.__proto__ === frames[0].Object.prototype, "o.__proto__.__proto__ === frames[0].Object.prototype", true);
33 </script>