Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: LayoutTests/http/tests/security/cross-frame-window-to-tostring.html

Issue 1138583002: Make Window.prototype.toString return [object Window] at all times. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix one test line Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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]'");
jsbell 2015/05/11 16:18:09 These could use shouldBeEqualToString to avoid dou
14 shouldBe("window.toString()", "'[object Window]'");
15 shouldBe("Object.prototype.toString.call(window)", "'[object Window]'");
16 shouldBe("Window.prototype + ''", "'[object WindowPrototype]'");
17 shouldBe("Window.prototype.toString()", "'[object WindowPrototype]'");
18 shouldBe("Object.prototype.toString.call(Window.prototype)", "'[object Windo wPrototype]'");
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 WindowPrototype]'");
28 shouldBe("Window.prototype.toString()", "'[object WindowPrototype]'");
29 shouldBe("Object.prototype.toString.call(Window.prototype)", "'[object Windo wPrototype]'");
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698