Closed Bug 924059 Opened 12 years ago Closed 11 years ago

ArrayIterator.prototype.next method domain fixups

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: wingo, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

After bug 919948, there are a couple of bugs in the range of the ArrayIterator prototype "next" function: var iter = []['@@iterator'](); // Should signal TypeError: ArrayIterator next called on incompatible <...> // Instead signals TypeError: a is undefined iter.next.call(iter.__proto__) // Should return { value: undefined, done: true } // Instead signals TypeError: ArrayIterator next called on incompatible [object Array Iterator] iter.next.call(newGlobal().eval('[]["@@iterator"]()'))
Summary: ArrayIterator.prototype.next method range fixups → ArrayIterator.prototype.next method domain fixups
Blocks: 1111164
I've spun off bug 1111170 on the cross-compartment bits and will focus this on the proto issue.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8535982 [details] [diff] [review] Give ArrayIterator and its prototype different JSClasses so we can't confuse them for each other Review of attachment 8535982 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/tests/ecma_6/Array/iterator_edge_cases.js @@ +5,5 @@ > + try { > + iter.next.call(Object.getPrototypeOf(iter)) > + throw new Error("Call did not throw"); > + } catch (e) { > + assertEq(e.name, "TypeError"); |e instanceof TypeError| is slightly better/finer-grained, because of it restricting to just this realm/global. @@ +6,5 @@ > + iter.next.call(Object.getPrototypeOf(iter)) > + throw new Error("Call did not throw"); > + } catch (e) { > + assertEq(e.name, "TypeError"); > + assertEq(e.message, "ArrayIterator next called on incompatible [object Array Iterator]"); *mutters about exact error message testing making js.msg changes obnoxious*
Attachment #8535982 - Flags: review?(jwalden+bmo) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: