Skip to content

Commit 979a6c8

Browse files
committed
Bug 1965844 - Part 3: Don't overwrite a pending exception in Array.prototype.with. r=jandem
Test case in <tc39/test262#4477>. Differential Revision: https://phabricator.services.mozilla.com/D248928
1 parent f46c7ca commit 979a6c8

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

js/src/builtin/Array.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3740,8 +3740,8 @@ static bool array_toSpliced(JSContext* cx, unsigned argc, Value* vp) {
37403740
return true;
37413741
}
37423742

3743-
// https://github.com/tc39/proposal-change-array-by-copy
3744-
// Array.prototype.with()
3743+
// ES2026 draft rev a562082b031d89d00ee667181ce8a6158656bd4b
3744+
// Array.prototype.with ( index, value )
37453745
static bool array_with(JSContext* cx, unsigned argc, Value* vp) {
37463746
AutoJSMethodProfilerEntry pseudoFrame(cx, "Array.prototype", "with");
37473747
CallArgs args = CallArgsFromVp(argc, vp);
@@ -3761,7 +3761,6 @@ static bool array_with(JSContext* cx, unsigned argc, Value* vp) {
37613761
// Step 3. Let relativeIndex be ? ToIntegerOrInfinity(index).
37623762
double relativeIndex;
37633763
if (!ToInteger(cx, args.get(0), &relativeIndex)) {
3764-
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
37653764
return false;
37663765
}
37673766

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// |jit-test| error: RangeError
1+
// |jit-test| error: TypeError
22
[].with(Symbol.hasInstance);

0 commit comments

Comments
 (0)