Implement %TypedArray%.prototype.{every, some}

RESOLVED FIXED in mozilla37

Status

()

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: 446240525, Assigned: 446240525)

Tracking

({dev-doc-complete})

Trunk
mozilla37
dev-doc-complete
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [DocArea=JS])

Attachments

(1 attachment, 1 obsolete attachment)

Comment hidden (empty)
(Assignee)

Comment 1

4 years ago
Posted patch bug-1116390-v1.patch (obsolete) — Splinter Review
Attachment #8542762 - Flags: review?(evilpies)
Comment on attachment 8542762 [details] [diff] [review]
bug-1116390-v1.patch

Review of attachment 8542762 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/tests/ecma_6/TypedArray/every-and-some.js
@@ +90,5 @@
> +    assertThrowsInstanceOf(() => {
> +        arr.every();
> +    }, TypeError);
> +    var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
> +    invalidCallbacks.every(callback => {

forEach :)

@@ +105,5 @@
> +    // Called from other globals.
> +    if (typeof newGlobal === "function") {
> +        var every = newGlobal()[constructor.name].prototype.every;
> +        var sum = 0;
> +        every.call(new constructor([1, 2, 3]), v => sum += v);

assertEq(..., true)

@@ +139,5 @@
> +    assertEq(new constructor([1, 2, 3]).some(v => v % 2), true);
> +    assertEq(new constructor([0, 2, 4]).some(v => v % 2), false);
> +    assertEq(new constructor([1, 3, 5]).some(v => v > 2), true);
> +    assertEq(new constructor([1, 3, 5]).some(v => v < 0), false);
> +    assertEq(new constructor(10).some(v => v !== 0), false);

Wouldn't this be true?

@@ +213,5 @@
> +    assertThrowsInstanceOf(() => {
> +        arr.some();
> +    }, TypeError);
> +    var invalidCallbacks = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
> +    invalidCallbacks.some(callback => {

forEach

@@ +228,5 @@
> +    // Called from other globals.
> +    if (typeof newGlobal === "function") {
> +        var some = newGlobal()[constructor.name].prototype.some;
> +        var sum = 0;
> +        some.call(new constructor([1, 2, 3]), v => {

assertEq(..., false)
Attachment #8542762 - Flags: review?(evilpies) → review+
(Assignee)

Comment 3

4 years ago
Comment on attachment 8542762 [details] [diff] [review]
bug-1116390-v1.patch

Review of attachment 8542762 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/tests/ecma_6/TypedArray/every-and-some.js
@@ +139,5 @@
> +    assertEq(new constructor([1, 2, 3]).some(v => v % 2), true);
> +    assertEq(new constructor([0, 2, 4]).some(v => v % 2), false);
> +    assertEq(new constructor([1, 3, 5]).some(v => v > 2), true);
> +    assertEq(new constructor([1, 3, 5]).some(v => v < 0), false);
> +    assertEq(new constructor(10).some(v => v !== 0), false);

I guess you mean line 144? Because the `some` method always returns `false` when called on empty arrays.
Comment on attachment 8542762 [details] [diff] [review]
bug-1116390-v1.patch

Review of attachment 8542762 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/tests/ecma_6/TypedArray/every-and-some.js
@@ +139,5 @@
> +    assertEq(new constructor([1, 2, 3]).some(v => v % 2), true);
> +    assertEq(new constructor([0, 2, 4]).some(v => v % 2), false);
> +    assertEq(new constructor([1, 3, 5]).some(v => v > 2), true);
> +    assertEq(new constructor([1, 3, 5]).some(v => v < 0), false);
> +    assertEq(new constructor(10).some(v => v !== 0), false);

Oh, sorry. I read this as new constructor([10])
(Assignee)

Comment 5

4 years ago
Attachment #8542762 - Attachment is obsolete: true
Attachment #8543509 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/c963d611da18
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.