Open Bug 1318723 Opened 9 years ago Updated 1 year ago

Check k >= 2**53-1 in Array.from.

Categories

(Core :: JavaScript Engine, defect, P5)

defect

Tracking

()

Tracking Status
firefox53 --- affected

People

(Reporter: arai, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: triage-deferred)

Currently, step 5.e.i is not implemented (intentionally), since it causes performance regression, and also we won't hit it in almost all cases. > i. If k >= 2**53-1, then > 1. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created > TypeError object, [[Target]]: empty}. > 2. Return ? IteratorClose(iterator, error). If we're using normal Array, the step viii will throw before reaching 2**53-1 elements. > viii. Let defineStatus be CreateDataPropertyOrThrow(A, Pk, mappedValue). The situation happens only if we're using suclassed Array that returns Proxy from ctor that ignores defineProperty, and also passing custom iterator that yield infinitely. class MyArray extends Array { constructor() { return new Proxy({}, { defineProperty() { return true; } }); } } try { MyArray.from({ [Symbol.iterator]() { let v = { value: 1, done: false }; return { next() { return v; } }; } }); } catch (e) { } it will take too long time before hitting 2**53-1-th element So, it's not important to implement the step. We could add it if we can remove the performance impact.
Keywords: triage-deferred
Priority: -- → P3
Priority: P3 → P5
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.