dom/tests/mochitest/general/file_moving_nodeList.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/general/file_moving_nodeList.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +<html>
     1.5 +    <head>
     1.6 +        <script>
     1.7 +            document.childNodes.expando = "foo";
     1.8 +
     1.9 +            function getNodeList() {
    1.10 +                return document.childNodes;
    1.11 +            }
    1.12 +            function getOptions() {
    1.13 +                return document.createElement("select").options;
    1.14 +            }
    1.15 +
    1.16 +            function tryToUseNodeList(nodeList, ok) {
    1.17 +                function expectException(op, reason) {
    1.18 +                    try {
    1.19 +                        var result = op();
    1.20 +                        ok(false, "should have thrown an exception, got: " + result);
    1.21 +                    } catch (e) {
    1.22 +                        ok(/Permission denied/.test(e.toString()), reason);
    1.23 +                    }
    1.24 +                }
    1.25 +
    1.26 +                expectException(function() { nodeList.length = 2; }, "should not be able to set attributes");
    1.27 +                expectException(function() { nodeList.item(0); }, "should not have access to any functions");
    1.28 +                expectException(function() { nodeList.foo = "foo"; }, "should not be able to add expandos");
    1.29 +            }
    1.30 +        </script>
    1.31 +    </head>
    1.32 +    <body>
    1.33 +    </body>
    1.34 +</html>

mercurial