ChakraCore icon indicating copy to clipboard operation
ChakraCore copied to clipboard

Throwing an error causes ToString call on a property, and that property is a Symbol.

Open akroshg opened this issue 10 years ago • 3 comments

eg.

var a = undefined
a[Object(Symbol())] = 10;

as ais undefined we throw a type error. While throwing, we are trying to get string from that property to populate error information, which makes ToStringcall to that property (in this scenario that property is Symbol). Is this implicit ToStringcall on Symbolcorrect and as per spec? Look for JavascriptError::ThrowTypeError(scriptContext, JSERR_Property_CannotSet_NullOrUndefined, GetPropertyDisplayNameForError(index, scriptContext)); in the code base.

akroshg avatar Mar 03 '16 02:03 akroshg

This issue raised from #422.

akroshg avatar Mar 03 '16 02:03 akroshg

The spec doesn't talk about how error message text is generated - so an observable toString on that property is probably not something that's expected.

ljharb avatar Mar 03 '16 04:03 ljharb

Fixed by #540

boingoing avatar Mar 11 '16 23:03 boingoing