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

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

mercurial