Closed Bug 1317309 Opened 3 years ago Closed 3 years ago

Throw a TypeError when passing a symbol value to RegExp and RegExp.prototype.compile

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox52 --- wontfix
firefox53 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Test case:
---
RegExp(Symbol())
---

Expected: Throws a TypeError
Actual: No exception thrown
Attached patch bug1317309.patchSplinter Review
It looks like ToAtom was overlooked when Symbols were added to the runtime.
Attachment #8810531 - Flags: review?(till)
Comment on attachment 8810531 [details] [diff] [review]
bug1317309.patch

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

Good catch, thanks.

::: js/src/jsatom.cpp
@@ +515,5 @@
> +                                      JSMSG_SYMBOL_TO_STRING);
> +        }
> +        return nullptr;
> +    }
> +    MOZ_ASSERT(v.isUndefined());

It'd sure be nice to be able to enforce exhaustive matching for Value types.
Attachment #8810531 - Flags: review?(till) → review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4419ad4be612
Throw a TypeError when passing a Symbol value to ToAtom. r=till
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/4419ad4be612
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Will ride the train from 53
You need to log in before you can comment on or make changes to this bug.