Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <script src="/js-test-resources/js-test.js"></script> | |
| 3 <script> | |
| 4 var w; | |
| 5 | |
| 6 window.onload = function() | |
| 7 { | |
| 8 if (window.testRunner) { | |
| 9 testRunner.dumpAsText(); | |
| 10 testRunner.waitUntilDone(); | |
| 11 } | |
| 12 | |
| 13 shouldBe("window + ''", "'[object Window]'"); | |
| 14 shouldBe("window.toString()", "'[object Window]'"); | |
| 15 shouldBe("Object.prototype.toString.call(window)", "'[object Window]'"); | |
|
arv (Not doing code reviews)
2015/05/08 21:42:24
WebIDL does not mention `[object WindowPrototype]`
adamk
2015/05/08 22:03:04
Oh huh, we currently return [object Object] for th
| |
| 16 shouldBe("Window.prototype + ''", "'[object Window]'"); | |
| 17 shouldBe("Window.prototype.toString()", "'[object Window]'"); | |
| 18 shouldBe("Object.prototype.toString.call(Window.prototype)", "'[object Windo w]'"); | |
| 19 | |
| 20 Object.defineProperty(window, Symbol.toStringTag, { | |
| 21 value: 'iii', | |
| 22 configurable: true, | |
| 23 }); | |
| 24 shouldBe("window + ''", "'[object iii]'"); | |
| 25 shouldBe("window.toString()", "'[object iii]'"); | |
| 26 shouldBe("Object.prototype.toString.call(window)", "'[object iii]'"); | |
| 27 shouldBe("Window.prototype + ''", "'[object Window]'"); | |
| 28 shouldBe("Window.prototype.toString()", "'[object Window]'"); | |
| 29 shouldBe("Object.prototype.toString.call(Window.prototype)", "'[object Windo w]'"); | |
| 30 delete window[Symbol.toStringTag]; | |
| 31 | |
| 32 Object.defineProperty(Window.prototype, Symbol.toStringTag, { | |
| 33 value: 'jjj', | |
| 34 configurable: true, | |
| 35 }); | |
| 36 shouldBe("window + ''", "'[object jjj]'"); | |
| 37 shouldBe("window.toString()", "'[object jjj]'"); | |
| 38 shouldBe("Object.prototype.toString.call(window)", "'[object jjj]'"); | |
| 39 shouldBe("Window.prototype + ''", "'[object jjj]'"); | |
| 40 shouldBe("Window.prototype.toString()", "'[object jjj]'"); | |
| 41 shouldBe("Object.prototype.toString.call(Window.prototype)", "'[object jjj]' "); | |
| 42 delete Window.prototype[Symbol.toStringTag]; | |
| 43 | |
| 44 debug(""); | |
| 45 debug("Testing local iframe"); | |
| 46 w = document.querySelectorAll('iframe')[0].contentWindow; | |
| 47 | |
| 48 shouldBe("w + ''", "'[object inner]'"); | |
| 49 shouldBe("w.toString()", "'[object inner]'"); | |
| 50 shouldBe("Object.prototype.toString.call(w)", "'[object inner]'"); | |
| 51 | |
| 52 Object.defineProperty(w, Symbol.toStringTag, { | |
| 53 value: 'kkk', | |
| 54 configurable: true, | |
| 55 }); | |
| 56 shouldBe("w + ''", "'[object kkk]'"); | |
| 57 shouldBe("w.toString()", "'[object kkk]'"); | |
| 58 shouldBe("Object.prototype.toString.call(w)", "'[object kkk]'"); | |
| 59 delete w[Symbol.toStringTag]; | |
| 60 | |
| 61 Object.defineProperty(Window.prototype, Symbol.toStringTag, { | |
| 62 value: 'lll', | |
| 63 configurable: true, | |
| 64 }); | |
| 65 shouldBe("w + ''", "'[object inner]'"); | |
| 66 shouldBe("w.toString()", "'[object inner]'"); | |
| 67 shouldBe("Object.prototype.toString.call(w)", "'[object inner]'"); | |
| 68 delete Window.prototype[Symbol.toStringTag]; | |
| 69 | |
| 70 debug(""); | |
| 71 debug("Testing remote iframe"); | |
| 72 w = document.querySelectorAll('iframe')[1].contentWindow; | |
| 73 | |
| 74 shouldThrow("w + ''", "'SecurityError: Blocked a frame with origin \"http:// 127.0.0.1:8000\" from accessing a cross-origin frame.'"); | |
| 75 shouldThrow("w.toString()", "'SecurityError: Blocked a frame with origin \"h ttp://127.0.0.1:8000\" from accessing a cross-origin frame.'"); | |
| 76 shouldThrow("Object.prototype.toString.call(w)", "'SecurityError: Blocked a frame with origin \"http://127.0.0.1:8000\" from accessing a cross-origin frame. '"); | |
| 77 | |
| 78 if (window.testRunner) | |
| 79 testRunner.notifyDone(); | |
| 80 }; | |
| 81 | |
| 82 </script> | |
| 83 | |
| 84 <iframe src="resources/cross-frame-window-to-string-test.html"></iframe> | |
| 85 <iframe src="http://localhost:8000/security/resources/cross-frame-window-to-stri ng-test.html"></iframe> | |
| 86 <pre id="console"></pre> | |
| OLD | NEW |