Parents: #475, #493 Related: #750
Problem
ECMA-262 requires Math.sumPrecise to reject an iterator once its processed element count reaches 2^53 - 1. Before consuming that next value, it must create a RangeError and perform IteratorClose. The current implementation increments an unbounded usize counter and has no specified limit, so it omits both the security/performance bound and the required close behavior.
Scope
- Enforce the exact
2^53 - 1bound before accepting another Number. - Close the iterator with the RangeError completion.
- Preserve the original RangeError when
return()throws or otherwise completes abruptly. - Add a narrow internal test seam for the otherwise impractical boundary without changing the public JavaScript API or production limit.
No-workaround rules
- No smaller production cap, iteration timeout, allocation heuristic, source rewriting, skipped IteratorClose, or replacement error from
return(). - No stack, queue, job, Promise, Worker, or Map/Set iterator implementation changes.
Acceptance
- Production uses the exact
2^53 - 1element bound. - The boundary path performs IteratorClose and preserves RangeError precedence.
- Focused units and the complete Test262
Math.sumPrecisesubtree pass with exact nonzero accounting. - Full integration gates pass with 0 unrelated Test262 flips.