| 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 shouldBeEqualToString("window + ''", "[object Window]"); | |
| 14 shouldBeEqualToString("window.toString()", "[object Window]"); | |
| 15 shouldBeEqualToString("Object.prototype.toString.call(window)", "[object Win
dow]"); | |
| 16 shouldBeEqualToString("Window.prototype + ''", "[object WindowPrototype]"); | |
| 17 shouldBeEqualToString("Window.prototype.toString()", "[object WindowPrototyp
e]"); | |
| 18 shouldBeEqualToString("Object.prototype.toString.call(Window.prototype)", "[
object WindowPrototype]"); | |
| 19 | |
| 20 Object.defineProperty(window, Symbol.toStringTag, { | |
| 21 value: 'iii', | |
| 22 configurable: true, | |
| 23 }); | |
| 24 shouldBeEqualToString("window + ''", "[object iii]"); | |
| 25 shouldBeEqualToString("window.toString()", "[object iii]"); | |
| 26 shouldBeEqualToString("Object.prototype.toString.call(window)", "[object iii
]"); | |
| 27 shouldBeEqualToString("Window.prototype + ''", "[object WindowPrototype]"); | |
| 28 shouldBeEqualToString("Window.prototype.toString()", "[object WindowPrototyp
e]"); | |
| 29 shouldBeEqualToString("Object.prototype.toString.call(Window.prototype)", "[
object WindowPrototype]"); | |
| 30 delete window[Symbol.toStringTag]; | |
| 31 | |
| 32 Object.defineProperty(Window.prototype, Symbol.toStringTag, { | |
| 33 value: 'jjj', | |
| 34 configurable: true, | |
| 35 }); | |
| 36 shouldBeEqualToString("window + ''", "[object jjj]"); | |
| 37 shouldBeEqualToString("window.toString()", "[object jjj]"); | |
| 38 shouldBeEqualToString("Object.prototype.toString.call(window)", "[object jjj
]"); | |
| 39 shouldBeEqualToString("Window.prototype + ''", "[object jjj]"); | |
| 40 shouldBeEqualToString("Window.prototype.toString()", "[object jjj]"); | |
| 41 shouldBeEqualToString("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 shouldBeEqualToString("w + ''", "[object inner]"); | |
| 49 shouldBeEqualToString("w.toString()", "[object inner]"); | |
| 50 shouldBeEqualToString("Object.prototype.toString.call(w)", "[object inner]")
; | |
| 51 | |
| 52 Object.defineProperty(w, Symbol.toStringTag, { | |
| 53 value: 'kkk', | |
| 54 configurable: true, | |
| 55 }); | |
| 56 shouldBeEqualToString("w + ''", "[object kkk]"); | |
| 57 shouldBeEqualToString("w.toString()", "[object kkk]"); | |
| 58 shouldBeEqualToString("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 shouldBeEqualToString("w + ''", "[object inner]"); | |
| 66 shouldBeEqualToString("w.toString()", "[object inner]"); | |
| 67 shouldBeEqualToString("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 |