tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DOMException-constants.any.js (1512B)


      1 // META: global=window,dedicatedworker,shadowrealm
      2 
      3 'use strict';
      4 
      5 test(function() {
      6  // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27732
      7  var constants = [
      8    "INDEX_SIZE_ERR",
      9    "DOMSTRING_SIZE_ERR",
     10    "HIERARCHY_REQUEST_ERR",
     11    "WRONG_DOCUMENT_ERR",
     12    "INVALID_CHARACTER_ERR",
     13    "NO_DATA_ALLOWED_ERR",
     14    "NO_MODIFICATION_ALLOWED_ERR",
     15    "NOT_FOUND_ERR",
     16    "NOT_SUPPORTED_ERR",
     17    "INUSE_ATTRIBUTE_ERR",
     18    "INVALID_STATE_ERR",
     19    "SYNTAX_ERR",
     20    "INVALID_MODIFICATION_ERR",
     21    "NAMESPACE_ERR",
     22    "INVALID_ACCESS_ERR",
     23    "VALIDATION_ERR",
     24    "TYPE_MISMATCH_ERR",
     25    "SECURITY_ERR",
     26    "NETWORK_ERR",
     27    "ABORT_ERR",
     28    "URL_MISMATCH_ERR",
     29    "QUOTA_EXCEEDED_ERR",
     30    "TIMEOUT_ERR",
     31    "INVALID_NODE_TYPE_ERR",
     32    "DATA_CLONE_ERR"
     33  ]
     34  var objects = [
     35    [DOMException, "DOMException constructor object"],
     36    [DOMException.prototype, "DOMException prototype object"]
     37  ]
     38  constants.forEach(function(name, i) {
     39    objects.forEach(function(o) {
     40      var object = o[0], description = o[1];
     41      test(function() {
     42        assert_equals(object[name], i + 1, name)
     43        assert_own_property(object, name)
     44        var pd = Object.getOwnPropertyDescriptor(object, name)
     45        assert_false("get" in pd, "get")
     46        assert_false("set" in pd, "set")
     47        assert_false(pd.writable, "writable")
     48        assert_true(pd.enumerable, "enumerable")
     49        assert_false(pd.configurable, "configurable")
     50      }, "Constant " + name + " on " + description)
     51    })
     52  })
     53 })