dom/base/test/test_constructor-assignment.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 <!--
     2   Any copyright is dedicated to the Public Domain.
     3   http://creativecommons.org/publicdomain/zero/1.0/
     4 -->
     5 <!DOCTYPE html>
     6 <html>
     7 <head>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <script type="application/javascript">
    13 function testConstructor(name)
    14 {
    15   window[name] = 17; // resolve through assignment
    18   var desc = Object.getOwnPropertyDescriptor(window, name);
    19   ok(typeof desc === "object" && desc !== null, name + ": property must exist");
    21   is(desc.value, 17, name + ": overwrite didn't work correctly");
    22   is(desc.enumerable, false,
    23      name + ": initial descriptor was non-enumerable, and [[Put]] changes " +
    24      "the property value but not its enumerability");
    25   is(desc.configurable, true,
    26      name + ": initial descriptor was configurable, and [[Put]] changes the " +
    27      "property value but not its configurability");
    28   is(desc.writable, true,
    29      name + ": initial descriptor was writable, and [[Put]] changes the " +
    30      "property value but not its writability");
    31 }
    33 var ctors =
    34   [
    35    "HTMLElement",
    36    "HTMLDivElement",
    37    "HTMLSpanElement",
    38    "HTMLParagraphElement",
    39    "HTMLOptionElement",
    40    "HTMLHtmlElement",
    41    "Element",
    42    "Node",
    43    "Document",
    44    "Image",
    45    "Audio",
    46    "HTMLAudioElement",
    47    "HTMLVideoElement",
    48    "Window",
    49    "XMLHttpRequest",
    50    "Navigator",
    51    "WebSocket",
    52    "Event",
    53    "IDBKeyRange",
    54    "CSSPageRule",
    55    "SVGPatternElement",
    56   ];
    58 ctors.forEach(testConstructor);
    59 </script>
    60 </body>
    61 </html>

mercurial