Closed Bug 1644878 Opened 5 years ago Closed 5 years ago

Map.prototype.entries receiver check error message needs improvement

Categories

(Core :: JavaScript Engine, enhancement, P5)

77 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: ljharb, Assigned: evilpies)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15

Steps to reproduce:

Map.prototype.entries.call(true)

Actual results:

throws an error with the message "std_Map_iterator method called on incompatible boolean".

Expected results:

A human-readable message (no underscores, no "std" C++ colloquialisms).

Chrome prints "Method Map.prototype.entries called on incompatible receiver true", Safari prints "Map.prototype.entries requires that |this| be Map". Both are much clearer, and it'd be nice if Firefox picked one of them :-)

Blocks: jserror
Severity: -- → N/A
Priority: -- → P5
Assignee: nobody → evilpies

Thanks! To be honest I don't think I really like either of these messages. Ours is of course worse, because we don't even mention Map.prototype. This is sadly a general problem with how the infamous CallNonGenericMethod function works. I am only going to fix the leakage of our internal self-hosted function name here. This also applies to Set methods. I suspect we have other instances of this problem.

I think we were defining those methods in self-hosted JS, because that automatically gives
us the property that they all have the same identity. This causes bad error messages.
Instead redefine them in the finishInit ClassSpec hook. We still have the "wrong" methods
in the 'methods' array so that JSXray tests continue to pass.

Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/c68fe15a81fc Don't define Map/Set identical iterator methods in self-hosted JS. r=arai
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: