dom/base/test/test_window_named_frame_enumeration.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_window_named_frame_enumeration.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=1019417
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 1019417</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="application/javascript">
    1.15 +
    1.16 +  /** Test for Bug 1019417 **/
    1.17 +  SimpleTest.waitForExplicitFinish();
    1.18 +  addLoadEvent(function() {
    1.19 +    var names1 = Object.getOwnPropertyNames(window);
    1.20 +    var names2 = [];
    1.21 +    var gsp = Object.getPrototypeOf(Window.prototype);
    1.22 +    var names3 = Object.getOwnPropertyNames(gsp);
    1.23 +    for (var i in window) {
    1.24 +      names2.push(i);
    1.25 +    }
    1.26 +
    1.27 +    is(names1.indexOf(""), -1,
    1.28 +       "Frame with no name or empty name should not be in our own prop list");
    1.29 +    is(names2.indexOf(""), -1,
    1.30 +       "Frame with no name or empty name should not be in our enumeration list");
    1.31 +    is(names3.indexOf(""), -1,
    1.32 +       "Frame with no name or empty name should not be in GSP own prop list");
    1.33 +    is(names1.indexOf("x"), -1,
    1.34 +       "Frame with about:blank loaded should not be in our own prop list");
    1.35 +    isnot(names2.indexOf("x"), -1,
    1.36 +          "Frame with about:blank loaded should be in our enumeration list");
    1.37 +    isnot(names3.indexOf("x"), -1,
    1.38 +          "Frame with about:blank loaded should be in GSP own prop list");
    1.39 +    is(names1.indexOf("y"), -1,
    1.40 +       "Frame with same-origin loaded should not be in our own prop list");
    1.41 +    isnot(names2.indexOf("y"), -1,
    1.42 +          "Frame with same-origin loaded should be in our enumeration list");
    1.43 +    isnot(names3.indexOf("y"), -1,
    1.44 +          "Frame with same-origin loaded should be in GSP own prop list");
    1.45 +    is(names1.indexOf("z"), -1,
    1.46 +       "Frame with cross-origin loaded should not be in our own prop list");
    1.47 +    isnot(names2.indexOf("z"), -1,
    1.48 +          "Frame with cross-origin loaded should be in our enumeration list");
    1.49 +    isnot(names3.indexOf("z"), -1,
    1.50 +          "Frame with cross-origin loaded should be in GSPown prop list");
    1.51 +    is(names1.indexOf("sameorigin"), -1,
    1.52 +          "Frame with same-origin changed name should not be in our own prop list");
    1.53 +    isnot(names2.indexOf("sameorigin"), -1,
    1.54 +          "Frame with same-origin changed name should be in our enumeration list");
    1.55 +    isnot(names3.indexOf("sameorigin"), -1,
    1.56 +          "Frame with same-origin changed name should be in GSP own prop list");
    1.57 +    is(names1.indexOf("crossorigin"), -1,
    1.58 +       "Frame with cross-origin changed name should not be in our own prop list");
    1.59 +    is(names2.indexOf("crossorigin"), -1,
    1.60 +       "Frame with cross-origin changed name should not be in our enumeration list");
    1.61 +    is(names3.indexOf("crossorigin"), -1,
    1.62 +       "Frame with cross-origin changed name should not be in GSP own prop list");
    1.63 +
    1.64 +    ise(Object.getOwnPropertyDescriptor(gsp, ""), undefined,
    1.65 +        "Should not have empty string as a named frame");
    1.66 +    isnot(Object.getOwnPropertyDescriptor(gsp, "x"), undefined,
    1.67 +        "Should have about:blank subframe as a named frame");
    1.68 +    isnot(Object.getOwnPropertyDescriptor(gsp, "y"), undefined,
    1.69 +        "Should have same-origin subframe as a named frame");
    1.70 +    isnot(Object.getOwnPropertyDescriptor(gsp, "z"), undefined,
    1.71 +        "Should have cross-origin subframe as a named frame");
    1.72 +    isnot(Object.getOwnPropertyDescriptor(gsp, "sameorigin"), undefined,
    1.73 +          "Should have same-origin changed name as a named frame");
    1.74 +    ise(Object.getOwnPropertyDescriptor(gsp, "crossorigin"), undefined,
    1.75 +        "Should not have cross-origin-origin changed name as a named frame");
    1.76 +    SimpleTest.finish();
    1.77 +  });
    1.78 +  </script>
    1.79 +</head>
    1.80 +<body>
    1.81 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1019417">Mozilla Bug 1019417</a>
    1.82 +<p id="display"></p>
    1.83 +<div id="content" style="display: none">
    1.84 +<iframe></iframe>
    1.85 +<iframe name=""></iframe>
    1.86 +<iframe name="x"></iframe>
    1.87 +<iframe name="y"
    1.88 +        src="http://mochi.test:8888/tests/dom/base/test/file_empty.html"></iframe>
    1.89 +<iframe name="z"
    1.90 +        src="http://example.com/tests/dom/base/test/file_empty.html"></iframe>
    1.91 +<iframe name="v"
    1.92 +        src="http://mochi.test:8888/tests/dom/base/test/file_setname.html?sameorigin"></iframe>
    1.93 +<iframe name="w"
    1.94 +        src="http://example.com/tests/dom/base/test/file_setname.html?crossorigin"></iframe>
    1.95 +</div>
    1.96 +<pre id="test">
    1.97 +</pre>
    1.98 +</body>
    1.99 +</html>

mercurial