Closed Bug 1456973 Opened 6 years ago Closed 6 years ago

Add explicit ToNumber in wrappedCompareFn in TypedArraySort

Categories

(Core :: JavaScript: Standard Library, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- fixed

People

(Reporter: anba, Assigned: khyperia)

References

Details

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/36dec78aecc40539ecc8d78e91612e38810f963c/js/src/builtin/TypedArray.js#1213
---
// Step a.
var v = comparefn(x, y);
---

should instead read:

---
// Step a.
var v = +comparefn(x, y);
---



Test case:
---
var ta = new Int32Array(4);
var ab = ta.buffer;

ta.sort(function(a, b) {
  print("COMPARE");
  detachArrayBuffer(ab);
  return {
    [Symbol.toPrimitive]() { print("TO_PRIMITIVE"); }
  };
});
---

Expected: Prints "COMPARE" and "TO_PRIMITIVE"
Actual: Prints only "COMPARE"
Priority: -- → P1
Blocks: 1291005
Priority: P1 → P2
Assignee: nobody → khyperia
Status: NEW → ASSIGNED
Attachment #9002825 - Flags: review?(jdemooij)
Comment on attachment 9002825 [details] [diff] [review]
Add explicit ToNumber in wrappedCompareFn in TypedArraySort.

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

Stealing review.

r=me, but this test belongs in test262. Now is a good time to figure out js/src/tests/test262-export.py.
Attachment #9002825 - Flags: review?(jdemooij) → review+
Keywords: checkin-needed
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4e65beb5c226
Add explicit ToNumber in wrappedCompareFn in TypedArraySort. r=jorendorff
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/4e65beb5c226
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: