Closed Bug 1199296 Opened 9 years ago Closed 8 years ago

Don't allow legacy generator yield in method definitions

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox43 --- affected
firefox51 --- fixed

People

(Reporter: anba, Assigned: efaust)

References

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(1 file, 1 obsolete file)

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
Attached 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)
Attached 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)
Attachment #8766985 - Flags: review?(shu) → review+
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)
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)
Pushed by kwierso@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/28ff935d4af9
Fix up mochitest(cl) failures r=mconley
https://hg.mozilla.org/mozilla-central/rev/79b119d86a4c
https://hg.mozilla.org/mozilla-central/rev/28ff935d4af9
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.