Closed Bug 1197094 Opened 10 years ago Closed 10 years ago

ForOfIterator calls ToObject on iterable

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox43 --- affected
firefox45 --- fixed

People

(Reporter: anba, Assigned: mrrrgn)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Test case: --- Object.defineProperty(Number.prototype, Symbol.iterator, { value() { "use strict"; print("typeof", typeof this); return { next() { return {done: true}; } }; } }); new Map(0); --- Expected: Prints "typeof number" Actual: Prints "typeof object"
Assignee: nobody → winter2718
A nice gimme to end the week with.
Attached patch forofobj.diffSplinter Review
Attachment #8696100 - Flags: review?(evilpies)
Comment on attachment 8696100 [details] [diff] [review] forofobj.diff Review of attachment 8696100 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/vm/ForOfIterator.cpp @@ +57,4 @@ > > RootedValue callee(cx); > RootedId iteratorId(cx, SYMBOL_TO_JSID(cx->wellKnownSymbols().iterator)); > if (!GetProperty(cx, iterableObj, iterableObj, iteratorId, &callee)) I wonder if we need to change this to iterable as well in the future.
Attachment #8696100 - Flags: review?(evilpies) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: