Fix #884: Proxy: ToPropertyDescriptor assert; when assert not hit, should throw TypeError.#885
Conversation
…ther the underlying object actually has a property (has() can be true, but get() can still fail to find a value).
… if it isn't there, set it to the default value. This causes a semantically correct TypeError to be thrown from ToPropertyDescriptor.
|
@bterlson @digitalinfinity Review please? :) |
|
👍 |
| RT_ERROR_MSG(JSERR_Property_NeedFunction, 5051, "The value of the property '%s' is not a Function object", "Function expected", kjstTypeError, JSERR_NeedFunction) | ||
| RT_ERROR_MSG(JSERR_Property_NeedFunction_NullOrUndefined, 5052, "The value of the property '%s' is null or undefined, not a Function object", "Function expected", kjstTypeError, JSERR_NeedObject) | ||
| RT_ERROR_MSG(JSERR_Property_CannotHaveAccessorsAndValue, 5053, "", "Property cannot have both accessors and a value", kjstTypeError, VBSERR_ActionNotSupported) | ||
| RT_ERROR_MSG(JSERR_Property_CannotHaveAccessorsAndValue, 5053, "", "Invalid property descriptor: cannot both specify accessors and a 'value' attribute", kjstTypeError, VBSERR_ActionNotSupported) |
There was a problem hiding this comment.
cannot specify both
There was a problem hiding this comment.
I was worried about potential confusion here. The term "both" in "specify both accessors" could refer to the two accessors: "get" and "set". The grammar as written is technically correct and avoids that potential confusion.
Also this matches the grammar of v8's error message:
VM79:4 Uncaught TypeError: Invalid property descriptor. Cannot both specify accessors and a value or writable attribute, [object Object](…)
There was a problem hiding this comment.
Huh, its like v8's implementer shared your same concern.
I don't think it is ambiguous because of the and but I'm only one sample point. It's fine.
There was a problem hiding this comment.
I'll try to reword this to avoid both grammatical and semantic ambiguity. :)
|
👍 |
|
@dotnet-bot test this please |
Fixes #884 (see issue for details).
This change is