dom/base/test/test_window_named_frame_enumeration.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1019417
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test for Bug 1019417</title>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 <script type="application/javascript">
michael@0 12
michael@0 13 /** Test for Bug 1019417 **/
michael@0 14 SimpleTest.waitForExplicitFinish();
michael@0 15 addLoadEvent(function() {
michael@0 16 var names1 = Object.getOwnPropertyNames(window);
michael@0 17 var names2 = [];
michael@0 18 var gsp = Object.getPrototypeOf(Window.prototype);
michael@0 19 var names3 = Object.getOwnPropertyNames(gsp);
michael@0 20 for (var i in window) {
michael@0 21 names2.push(i);
michael@0 22 }
michael@0 23
michael@0 24 is(names1.indexOf(""), -1,
michael@0 25 "Frame with no name or empty name should not be in our own prop list");
michael@0 26 is(names2.indexOf(""), -1,
michael@0 27 "Frame with no name or empty name should not be in our enumeration list");
michael@0 28 is(names3.indexOf(""), -1,
michael@0 29 "Frame with no name or empty name should not be in GSP own prop list");
michael@0 30 is(names1.indexOf("x"), -1,
michael@0 31 "Frame with about:blank loaded should not be in our own prop list");
michael@0 32 isnot(names2.indexOf("x"), -1,
michael@0 33 "Frame with about:blank loaded should be in our enumeration list");
michael@0 34 isnot(names3.indexOf("x"), -1,
michael@0 35 "Frame with about:blank loaded should be in GSP own prop list");
michael@0 36 is(names1.indexOf("y"), -1,
michael@0 37 "Frame with same-origin loaded should not be in our own prop list");
michael@0 38 isnot(names2.indexOf("y"), -1,
michael@0 39 "Frame with same-origin loaded should be in our enumeration list");
michael@0 40 isnot(names3.indexOf("y"), -1,
michael@0 41 "Frame with same-origin loaded should be in GSP own prop list");
michael@0 42 is(names1.indexOf("z"), -1,
michael@0 43 "Frame with cross-origin loaded should not be in our own prop list");
michael@0 44 isnot(names2.indexOf("z"), -1,
michael@0 45 "Frame with cross-origin loaded should be in our enumeration list");
michael@0 46 isnot(names3.indexOf("z"), -1,
michael@0 47 "Frame with cross-origin loaded should be in GSPown prop list");
michael@0 48 is(names1.indexOf("sameorigin"), -1,
michael@0 49 "Frame with same-origin changed name should not be in our own prop list");
michael@0 50 isnot(names2.indexOf("sameorigin"), -1,
michael@0 51 "Frame with same-origin changed name should be in our enumeration list");
michael@0 52 isnot(names3.indexOf("sameorigin"), -1,
michael@0 53 "Frame with same-origin changed name should be in GSP own prop list");
michael@0 54 is(names1.indexOf("crossorigin"), -1,
michael@0 55 "Frame with cross-origin changed name should not be in our own prop list");
michael@0 56 is(names2.indexOf("crossorigin"), -1,
michael@0 57 "Frame with cross-origin changed name should not be in our enumeration list");
michael@0 58 is(names3.indexOf("crossorigin"), -1,
michael@0 59 "Frame with cross-origin changed name should not be in GSP own prop list");
michael@0 60
michael@0 61 ise(Object.getOwnPropertyDescriptor(gsp, ""), undefined,
michael@0 62 "Should not have empty string as a named frame");
michael@0 63 isnot(Object.getOwnPropertyDescriptor(gsp, "x"), undefined,
michael@0 64 "Should have about:blank subframe as a named frame");
michael@0 65 isnot(Object.getOwnPropertyDescriptor(gsp, "y"), undefined,
michael@0 66 "Should have same-origin subframe as a named frame");
michael@0 67 isnot(Object.getOwnPropertyDescriptor(gsp, "z"), undefined,
michael@0 68 "Should have cross-origin subframe as a named frame");
michael@0 69 isnot(Object.getOwnPropertyDescriptor(gsp, "sameorigin"), undefined,
michael@0 70 "Should have same-origin changed name as a named frame");
michael@0 71 ise(Object.getOwnPropertyDescriptor(gsp, "crossorigin"), undefined,
michael@0 72 "Should not have cross-origin-origin changed name as a named frame");
michael@0 73 SimpleTest.finish();
michael@0 74 });
michael@0 75 </script>
michael@0 76 </head>
michael@0 77 <body>
michael@0 78 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1019417">Mozilla Bug 1019417</a>
michael@0 79 <p id="display"></p>
michael@0 80 <div id="content" style="display: none">
michael@0 81 <iframe></iframe>
michael@0 82 <iframe name=""></iframe>
michael@0 83 <iframe name="x"></iframe>
michael@0 84 <iframe name="y"
michael@0 85 src="http://mochi.test:8888/tests/dom/base/test/file_empty.html"></iframe>
michael@0 86 <iframe name="z"
michael@0 87 src="http://example.com/tests/dom/base/test/file_empty.html"></iframe>
michael@0 88 <iframe name="v"
michael@0 89 src="http://mochi.test:8888/tests/dom/base/test/file_setname.html?sameorigin"></iframe>
michael@0 90 <iframe name="w"
michael@0 91 src="http://example.com/tests/dom/base/test/file_setname.html?crossorigin"></iframe>
michael@0 92 </div>
michael@0 93 <pre id="test">
michael@0 94 </pre>
michael@0 95 </body>
michael@0 96 </html>

mercurial