Closed Bug 1354529 Opened 8 years ago Closed 8 years ago

Generator functions created through GeneratorFunction are incorrectly created as constructors

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Derived from https://github.com/tc39/test262/blob/master/test/built-ins/GeneratorFunction/instance-construct-throws.js: --- var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; var instance = GeneratorFunction(); new instance(); --- Expected: Throws TypeError Actual: No TypeError
Attached patch bug1354529.patchSplinter Review
I don't think it matters whether async functions and async generators use INTERPRETED_LAMBDA_GENERATOR_OR_ASYNC or INTERPRETED_LAMBDA due to the wrapping. Is that correct?
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8855779 - Flags: review?(arai.unmht)
Comment on attachment 8855779 [details] [diff] [review] bug1354529.patch Review of attachment 8855779 [details] [diff] [review]: ----------------------------------------------------------------- thanks! (In reply to André Bargull from comment #1) > I don't think it matters whether async functions and async generators use > INTERPRETED_LAMBDA_GENERATOR_OR_ASYNC or INTERPRETED_LAMBDA due to the > wrapping. Is that correct? correct. just to be sure, this is tested by the test262 (maybe added in the next update?), right?
Attachment #8855779 - Flags: review?(arai.unmht) → review+
(In reply to Tooru Fujisawa [:arai] from comment #2) > (In reply to André Bargull from comment #1) > > I don't think it matters whether async functions and async generators use > > INTERPRETED_LAMBDA_GENERATOR_OR_ASYNC or INTERPRETED_LAMBDA due to the > > wrapping. Is that correct? > > correct. Great! > > just to be sure, this is tested by the test262 (maybe added in the next > update?), right? Yes, this is tested by https://github.com/tc39/test262/blob/master/test/built-ins/GeneratorFunction/instance-construct-throws.js (which is not yet in our local test262 copy). I've verified this test fails without the patch, and passes when the patch is applied.
Pushed by ihsiao@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/448b205d97fd Don't set constructor-flag for generator functions created through GeneratorFunction intrinsic. r=arai
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: