summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Error/prototype-properties.js
blob: 16264bc56d013bd43cb900610283dadb8599f3b1 (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
const nativeErrors = [
    InternalError,
    EvalError,
    RangeError,
    ReferenceError,
    SyntaxError,
    TypeError,
    URIError
];

const expectedOwnKeys = "toSource" in Object.prototype
                        ? "toSource,toString,message,name,stack,constructor"
                        : "toString,message,name,stack,constructor";
assertEq(Reflect.ownKeys(Error.prototype).toString(), expectedOwnKeys);
assertEq(Error.prototype.name, "Error");
assertEq(Error.prototype.message, "");

for (const error of nativeErrors) {
    assertEq(Reflect.ownKeys(error.prototype).toString(), "message,name,constructor");
    assertEq(error.prototype.name, error.name);
    assertEq(error.prototype.message, "");
    assertEq(error.prototype.constructor, error);
}

if (typeof reportCompare === "function")
    reportCompare(0, 0);