dom/base/test/test_constructor.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

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

mercurial