Open Bug 1356642 Opened 8 years ago Updated 1 year ago

Exceptions thrown when GetMethod's V is not an object are a bit confusing

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox55 --- affected

People

(Reporter: bzbarsky, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: triage-deferred)

Testcase: Array.from(); The exception message is "V is undefined". A reasonable person will ask "what the heck is V?" The answer is that we https://tc39.github.io/ecma262/#sec-array.from calls https://tc39.github.io/ecma262/#sec-getmethod with its first arg, and that function names its first arg "V". But the caller of Array.from() doesn't so much know about all that... Perhaps we should have GetMethod callers check for the undefined case, or whatever cases would end up serializing "V" into the exception message, and report a more useful exception.
The exception here used to be "can't convert undefined to object" at some point, which at least made more sense from the caller's point of view... Including the variable name helps in general, but not in the self-hosted case. :(
We should probably check for script->selfHosted() in DecompileExpressionFromStack and |return true;| in that case...
Keywords: triage-deferred
Priority: -- → P3
Severity: normal → S3

Yeah, now we report Uncaught TypeError: can't access property Symbol.iterator, items is undefined

Blocks: sm-runtime
You need to log in before you can comment on or make changes to this bug.