mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 16:01:52 +00:00

Original commit message:
[runtime] Clear array join stack when throwing uncatchable
... exception.
Array#join depends array_join_stack to avoid infinite loop
and ensures symmetric pushes/pops through catch blocks to
correctly maintain the elements in the join stack.
However, the stack does not pop the elements and leaves in
an invalid state when throwing the uncatchable termination
exception. And the invalid join stack state will affect
subsequent Array#join calls. Because all the terminate
exception will be handled by Isolate::UnwindAndFindHandler,
we could clear the array join stack when unwinding the terminate
exception.
Bug: v8:13259
Change-Id: I23823e823c5fe0b089528c5cf654864cea78ebeb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3878451
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Commit-Queue: 王澳 <wangao.james@bytedance.com>
Cr-Commit-Position: refs/heads/main@{#83465}
Refs: 031b98b25c
Closes: https://github.com/nodejs/node/issues/44417
PR-URL: https://github.com/nodejs/node/pull/45375
Fixes: https://github.com/nodejs/node/issues/44417
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
33 lines
917 B
JavaScript
33 lines
917 B
JavaScript
// Copyright 2022 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
let {Protocol} = InspectorTest.start(
|
|
'Tests that Runtime.evaluate with REPL mode correctly handles \
|
|
Array.prototype.join.');
|
|
|
|
Protocol.Runtime.enable();
|
|
(async function () {
|
|
await evaluateReplWithSideEffects('a=[/a/]')
|
|
await evaluateRepl('a.toString()');
|
|
await evaluateReplWithSideEffects('a.toString()');
|
|
|
|
InspectorTest.completeTest();
|
|
})();
|
|
|
|
async function evaluateRepl(expression) {
|
|
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
|
|
expression: expression,
|
|
replMode: true,
|
|
throwOnSideEffect: true
|
|
}));
|
|
}
|
|
|
|
async function evaluateReplWithSideEffects(expression) {
|
|
InspectorTest.logMessage(await Protocol.Runtime.evaluate({
|
|
expression: expression,
|
|
replMode: true,
|
|
throwOnSideEffect: false
|
|
}));
|
|
}
|