Closed
Bug 924059
Opened 12 years ago
Closed 11 years ago
ArrayIterator.prototype.next method domain fixups
Categories
(Core :: JavaScript Engine, defect)
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"]()'))
Reporter | ||
Updated•12 years ago
|
Summary: ArrayIterator.prototype.next method range fixups → ArrayIterator.prototype.next method domain fixups
![]() |
Assignee | |
Comment 2•11 years ago
|
||
I've spun off bug 1111170 on the cross-compartment bits and will focus this on the proto issue.
![]() |
Assignee | |
Comment 3•11 years ago
|
||
Attachment #8535982 -
Flags: review?(jwalden+bmo)
![]() |
Assignee | |
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment 4•11 years ago
|
||
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+
![]() |
Assignee | |
Comment 5•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/33a749faaa04 with those changes.
Comment 6•11 years ago
|
||
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.
Description
•