dom/tests/mochitest/general/file_moving_nodeList.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 <html>
     2     <head>
     3         <script>
     4             document.childNodes.expando = "foo";
     6             function getNodeList() {
     7                 return document.childNodes;
     8             }
     9             function getOptions() {
    10                 return document.createElement("select").options;
    11             }
    13             function tryToUseNodeList(nodeList, ok) {
    14                 function expectException(op, reason) {
    15                     try {
    16                         var result = op();
    17                         ok(false, "should have thrown an exception, got: " + result);
    18                     } catch (e) {
    19                         ok(/Permission denied/.test(e.toString()), reason);
    20                     }
    21                 }
    23                 expectException(function() { nodeList.length = 2; }, "should not be able to set attributes");
    24                 expectException(function() { nodeList.item(0); }, "should not have access to any functions");
    25                 expectException(function() { nodeList.foo = "foo"; }, "should not be able to add expandos");
    26             }
    27         </script>
    28     </head>
    29     <body>
    30     </body>
    31 </html>

mercurial