summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webidl/ecmascript-binding/es-exceptions/DOMException-constants.any.js
blob: bb846a494eb898aed621181f182c1b125f9aaeae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';

test(function() {
  // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27732
  var constants = [
    "INDEX_SIZE_ERR",
    "DOMSTRING_SIZE_ERR",
    "HIERARCHY_REQUEST_ERR",
    "WRONG_DOCUMENT_ERR",
    "INVALID_CHARACTER_ERR",
    "NO_DATA_ALLOWED_ERR",
    "NO_MODIFICATION_ALLOWED_ERR",
    "NOT_FOUND_ERR",
    "NOT_SUPPORTED_ERR",
    "INUSE_ATTRIBUTE_ERR",
    "INVALID_STATE_ERR",
    "SYNTAX_ERR",
    "INVALID_MODIFICATION_ERR",
    "NAMESPACE_ERR",
    "INVALID_ACCESS_ERR",
    "VALIDATION_ERR",
    "TYPE_MISMATCH_ERR",
    "SECURITY_ERR",
    "NETWORK_ERR",
    "ABORT_ERR",
    "URL_MISMATCH_ERR",
    "QUOTA_EXCEEDED_ERR",
    "TIMEOUT_ERR",
    "INVALID_NODE_TYPE_ERR",
    "DATA_CLONE_ERR"
  ]
  var objects = [
    [DOMException, "DOMException constructor object"],
    [DOMException.prototype, "DOMException prototype object"]
  ]
  constants.forEach(function(name, i) {
    objects.forEach(function(o) {
      var object = o[0], description = o[1];
      test(function() {
        assert_equals(object[name], i + 1, name)
        assert_own_property(object, name)
        var pd = Object.getOwnPropertyDescriptor(object, name)
        assert_false("get" in pd, "get")
        assert_false("set" in pd, "set")
        assert_false(pd.writable, "writable")
        assert_true(pd.enumerable, "enumerable")
        assert_false(pd.configurable, "configurable")
      }, "Constant " + name + " on " + description)
    })
  })
})