DOMException should be constructible
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / WebIDL / ecmascript-binding / es-exceptions / DOMException-constants.html
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>DOMException constants</title>
4 <link rel=help href="https://heycam.github.io/webidl/#es-DOMException-constructor-object">
5 <link rel=help href="https://heycam.github.io/webidl/#es-DOMException-prototype-object">
6 <script src="/resources/testharness.js"></script>
7 <script src="/resources/testharnessreport.js"></script>
8 <div id="log"></div>
9 <script>
10 test(function() {
11   // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27732
12   var constants = [
13     "INDEX_SIZE_ERR",
14     "DOMSTRING_SIZE_ERR",
15     "HIERARCHY_REQUEST_ERR",
16     "WRONG_DOCUMENT_ERR",
17     "INVALID_CHARACTER_ERR",
18     "NO_DATA_ALLOWED_ERR",
19     "NO_MODIFICATION_ALLOWED_ERR",
20     "NOT_FOUND_ERR",
21     "NOT_SUPPORTED_ERR",
22     "INUSE_ATTRIBUTE_ERR",
23     "INVALID_STATE_ERR",
24     "SYNTAX_ERR",
25     "INVALID_MODIFICATION_ERR",
26     "NAMESPACE_ERR",
27     "INVALID_ACCESS_ERR",
28     "VALIDATION_ERR",
29     "TYPE_MISMATCH_ERR",
30     "SECURITY_ERR",
31     "NETWORK_ERR",
32     "ABORT_ERR",
33     "URL_MISMATCH_ERR",
34     "QUOTA_EXCEEDED_ERR",
35     "TIMEOUT_ERR",
36     "INVALID_NODE_TYPE_ERR",
37     "DATA_CLONE_ERR"
38   ]
39   var objects = [
40     [DOMException, "DOMException constructor object"],
41     [DOMException.prototype, "DOMException prototype object"]
42   ]
43   constants.forEach(function(name, i) {
44     objects.forEach(function(o) {
45       var object = o[0], description = o[1];
46       test(function() {
47         assert_equals(object[name], i + 1, name)
48         assert_own_property(object, name)
49         var pd = Object.getOwnPropertyDescriptor(object, name)
50         assert_false("get" in pd, "property has getter")
51         assert_false("set" in pd, "property has setter")
52         assert_false(pd.writable, "not writable")
53         assert_true(pd.enumerable, "enumerable")
54         assert_false(pd.configurable, "not configurable")
55       }, "Constant " + name + " on " + description)
56     })
57   })
58 })
59 </script>