Closed
Bug 1197095
Opened 10 years ago
Closed 10 years ago
ForOfIterator passes undefined to next() calls
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla45
People
(Reporter: anba, Assigned: mrrrgn)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
|
2.22 KB,
patch
|
Details | Diff | Splinter Review |
Test case:
---
new Map({
[Symbol.iterator]() {
return this;
},
next() {
print("args.length", arguments.length);
return {done: true};
}
});
---
Expected: Prints "args.length 0"
Actual: Prints "args.length 1"
Updated•10 years ago
|
Assignee: nobody → evilpies
| Assignee | ||
Comment 2•10 years ago
|
||
So, this change was extremely tiny but seems to do the trick without breaking tests.
Attachment #8695084 -
Flags: review?(evilpies)
| Assignee | ||
Comment 3•10 years ago
|
||
Had left a random commented out line of source in the old patch.
Attachment #8695084 -
Attachment is obsolete: true
Attachment #8695084 -
Flags: review?(evilpies)
Attachment #8695127 -
Flags: review?(evilpies)
Comment 4•10 years ago
|
||
Comment on attachment 8695127 [details] [diff] [review]
forof.diff
Review of attachment 8695127 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/tests/ecma_6/Map/iterable.js
@@ +12,5 @@
> + };
> + return iterator;
> + }
> +};
> +
I would do more similar to Andre's testcase
let length;
let iterator = {
[Symbol.iterator]() { return this; }
next() { length = arguments.length; return {done: true}; }
}
let m = new Map(iterable);
assertEq(length, 0);
The only kind of important thing here is to test length after we invoked Map, otherwise the test would still succeed even when for whatever reason we stop calling next.
Attachment #8695127 -
Flags: review?(evilpies) → review+
| Assignee | ||
Comment 6•10 years ago
|
||
With amended test, as per evilpie's suggestion. Thx for the review. :)
Attachment #8695127 -
Attachment is obsolete: true
Comment 7•10 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox45:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in
before you can comment on or make changes to this bug.
Description
•