mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1793959 - Add ThrowMsgKind::DecoratorInvalidReturnType; r=mgaudet
We'll need to be able to throw a TypeError if the decorator returns something other than a callable or undefined. Differential Revision: https://phabricator.services.mozilla.com/D162140
This commit is contained in:
parent
2755bc5a1c
commit
3a86e5a300
@ -799,4 +799,7 @@ MSG_DEF(JSMSG_SHADOW_REALM_EXPORT_NOT_STRING, 0, JSEXN_TYPEERR, "exportName m
|
||||
MSG_DEF(JSMSG_SHADOW_REALM_IMPORTVALUE_FAILED, 0, JSEXN_TYPEERR, "import value failed")
|
||||
MSG_DEF(JSMSG_SHADOW_REALM_VALUE_NOT_EXPORTED, 0, JSEXN_TYPEERR, "value not exported")
|
||||
|
||||
// Decorators
|
||||
MSG_DEF(JSMSG_DECORATOR_INVALID_RETURN_TYPE, 0, JSEXN_TYPEERR, "Invalid value returned from decorator: decorators can only return undefined or a callable")
|
||||
|
||||
//clang-format on
|
||||
|
@ -28,6 +28,8 @@ JSErrNum js::ThrowMsgKindToErrNum(ThrowMsgKind kind) {
|
||||
return JSMSG_SET_MISSING_PRIVATE;
|
||||
case ThrowMsgKind::AssignToPrivateMethod:
|
||||
return JSMSG_ASSIGN_TO_PRIVATE_METHOD;
|
||||
case ThrowMsgKind::DecoratorInvalidReturnType:
|
||||
return JSMSG_DECORATOR_INVALID_RETURN_TYPE;
|
||||
}
|
||||
|
||||
MOZ_CRASH("Unexpected message kind");
|
||||
|
@ -23,6 +23,8 @@ enum class ThrowMsgKind : uint8_t {
|
||||
MissingPrivateOnGet,
|
||||
MissingPrivateOnSet,
|
||||
AssignToPrivateMethod,
|
||||
// Decorators:
|
||||
DecoratorInvalidReturnType,
|
||||
};
|
||||
|
||||
JSErrNum ThrowMsgKindToErrNum(ThrowMsgKind kind);
|
||||
|
Loading…
Reference in New Issue
Block a user