[init] Error cause should not present on Error.prototype

According to the spec https://tc39.github.io/proposal-error-cause,
the property 'cause' should not present on Error.prototype.

Bug: v8:12006
Change-Id: Ib1601769793b808c5f5a7065effcc77d1def4cbb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3037911
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75872}
This commit is contained in:
legendecas 2021-07-19 23:05:48 +08:00 committed by V8 LUCI CQ
parent bd3d9e4aad
commit 606e9087b1
2 changed files with 2 additions and 5 deletions

View File

@ -1436,11 +1436,6 @@ static void InstallError(Isolate* isolate, Handle<JSObject> global,
JSObject::AddProperty(isolate, prototype, factory->message_string(),
factory->empty_string(), DONT_ENUM);
if (FLAG_harmony_error_cause) {
JSObject::AddProperty(isolate, prototype, factory->cause_string(),
factory->undefined_value(), DONT_ENUM);
}
if (context_index == Context::ERROR_FUNCTION_INDEX) {
Handle<JSFunction> to_string_fun =
SimpleInstallFunction(isolate, prototype, "toString",

View File

@ -19,6 +19,8 @@
(function () {
const err = Error('message');
assertEquals(undefined, err.cause);
assertFalse('cause' in err);
assertFalse('cause' in Error.prototype);
})();
// Chained errors