Don't allow legacy generator yield in method definitions

RESOLVED FIXED in Firefox 51

Status

()

defect
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: anba, Assigned: efaust, NeedInfo)

Tracking

(Blocks 1 bug, {dev-doc-complete, site-compat})

Trunk
mozilla51
Points:
---

Firefox Tracking Flags

(firefox43 affected, firefox51 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

4 years ago
Tests:
---
js> (new (class {constructor(){ yield 2 }})).next()
2

js> ({m(){ yield 2 }}).m().next()
2

js> Object.getOwnPropertyDescriptor({get m() { yield 2 }}, "m").get().next()
2
---

Expected: Throws SyntaxError
Actual: Parsed as legacy generator
(Reporter)

Updated

4 years ago
(Assignee)

Comment 1

3 years ago
Posted patch Fix (obsolete) — Splinter Review
OK, so, this is pretty stupid, since this is not exposed to the web by default, but in case people are explicitly setting version numbers, we should not allow this. Here's a fix.
Assignee: nobody → efaustbmo
Status: NEW → ASSIGNED
Attachment #8766978 - Flags: review?(shu)
(Assignee)

Comment 2

3 years ago
Posted patch FixSplinter Review
Oops, helps if the tests actually fail in the before vs after trial.
Attachment #8766978 - Attachment is obsolete: true
Attachment #8766978 - Flags: review?(shu)
Attachment #8766985 - Flags: review?(shu)

Updated

3 years ago
Attachment #8766985 - Flags: review?(shu) → review+

Comment 3

3 years ago
Pushed by efaustbmo@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/fab721467f68
Don't allow method definitions to be legacy generators. (r=shu)

Comment 5

3 years ago
Pushed by efaustbmo@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/79b119d86a4c
Don't allow method definitions to be legacy generators. (r=shu, r=evilpie, r=jaws)

Comment 6

3 years ago
Pushed by kwierso@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/28ff935d4af9
Fix up mochitest(cl) failures r=mconley

Comment 7

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/79b119d86a4c
https://hg.mozilla.org/mozilla-central/rev/28ff935d4af9
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.