summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Error/prototype-properties.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/Error/prototype-properties.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/tests/non262/Error/prototype-properties.js b/js/src/tests/non262/Error/prototype-properties.js
new file mode 100644
index 0000000000..16264bc56d
--- /dev/null
+++ b/js/src/tests/non262/Error/prototype-properties.js
@@ -0,0 +1,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);