js::ToPrimitiveSlow needs to use isNullOrUndefined() instead of isUndefined() for the Symbol.toPrimitive method

RESOLVED FIXED in Firefox 57

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 months ago
4 months ago

People

(Reporter: anba, Assigned: anba)

Tracking

Trunk
mozilla57
Points:
---

Firefox Tracking Flags

(firefox57 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 months ago
Test case:
---
print("" + {[Symbol.toPrimitive]: null, toString: () => "pass"})
---

Expected: Prints "pass"
Actual: Throws TypeError

https://tc39.github.io/ecma262/#sec-toprimitive uses GetMethod (https://tc39.github.io/ecma262/#sec-getmethod) which returns |undefined| for both, |undefined| and |null|.
(Assignee)

Comment 1

4 months ago
Created attachment 8898294 [details] [diff] [review]
bug1383393.patch

https://tc39.github.io/ecma262/#sec-toprimitive calls https://tc39.github.io/ecma262/#sec-getmethod which returns |undefined| for both, |undefined| and |null|.
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8898294 - Flags: review?(jdemooij)
Comment on attachment 8898294 [details] [diff] [review]
bug1383393.patch

Review of attachment 8898294 [details] [diff] [review]:
-----------------------------------------------------------------

Good find.
Attachment #8898294 - Flags: review?(jdemooij) → review+
(Assignee)

Comment 3

4 months ago
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c94993d0bd5230f391512f0b30ca2642646896e8
Keywords: checkin-needed

Comment 4

4 months ago
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/454e0d9b4ecc
Also ignore null as Symbol.toPrimitive method. r=jandem
Keywords: checkin-needed

Comment 5

4 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/454e0d9b4ecc
Status: ASSIGNED → RESOLVED
Last Resolved: 4 months ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.