GeezerVison is showing github.com — deps: V8: cherry-pick 031b98b25cba · nodejs/node@17a89d1
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: deps/v8/src/execution/isolate.cc +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1909,6 +1909,15 @@ Object Isolate::UnwindAndFindHandler() { |
1909 | 1909 | // Special handling of termination exceptions, uncatchable by JavaScript and |
1910 | 1910 | // Wasm code, we unwind the handlers until the top ENTRY handler is found. |
1911 | 1911 | bool catchable_by_js = is_catchable_by_javascript(exception); |
| 1912 | + if (!catchable_by_js && !context().is_null()) { |
| 1913 | + // Because the array join stack will not pop the elements when throwing the |
| 1914 | + // uncatchable terminate exception, we need to clear the array join stack to |
| 1915 | + // avoid leaving the stack in an invalid state. |
| 1916 | + // See also CycleProtectedArrayJoin. |
| 1917 | + raw_native_context().set_array_join_stack( |
| 1918 | + ReadOnlyRoots(this).undefined_value()); |
| 1919 | + } |
| 1920 | + |
1912 | 1921 | int visited_frames = 0; |
1913 | 1922 |
|
1914 | 1923 | // Compute handler and stack unwinding information by performing a full walk |
|
Collapse file
Copy file name to clipboard +48Lines changed: 48 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +Tests that Runtime.evaluate with REPL mode correctly handles Array.prototype.join. |
| 2 | +{ |
| 3 | + id : <messageId> |
| 4 | + result : { |
| 5 | + result : { |
| 6 | + className : Array |
| 7 | + description : Array(1) |
| 8 | + objectId : <objectId> |
| 9 | + subtype : array |
| 10 | + type : object |
| 11 | + } |
| 12 | + } |
| 13 | +} |
| 14 | +{ |
| 15 | + id : <messageId> |
| 16 | + result : { |
| 17 | + exceptionDetails : { |
| 18 | + columnNumber : -1 |
| 19 | + exception : { |
| 20 | + className : EvalError |
| 21 | + description : EvalError: Possible side-effect in debug-evaluate |
| 22 | + objectId : <objectId> |
| 23 | + subtype : error |
| 24 | + type : object |
| 25 | + } |
| 26 | + exceptionId : <exceptionId> |
| 27 | + lineNumber : -1 |
| 28 | + scriptId : <scriptId> |
| 29 | + text : Uncaught |
| 30 | + } |
| 31 | + result : { |
| 32 | + className : EvalError |
| 33 | + description : EvalError: Possible side-effect in debug-evaluate |
| 34 | + objectId : <objectId> |
| 35 | + subtype : error |
| 36 | + type : object |
| 37 | + } |
| 38 | + } |
| 39 | +} |
| 40 | +{ |
| 41 | + id : <messageId> |
| 42 | + result : { |
| 43 | + result : { |
| 44 | + type : string |
| 45 | + value : /a/ |
| 46 | + } |
| 47 | + } |
| 48 | +} |
Collapse file
Copy file name to clipboard +32Lines changed: 32 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Copyright 2022 the V8 project authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +let {Protocol} = InspectorTest.start( |
| 6 | + 'Tests that Runtime.evaluate with REPL mode correctly handles \ |
| 7 | +Array.prototype.join.'); |
| 8 | + |
| 9 | +Protocol.Runtime.enable(); |
| 10 | +(async function () { |
| 11 | + await evaluateReplWithSideEffects('a=[/a/]') |
| 12 | + await evaluateRepl('a.toString()'); |
| 13 | + await evaluateReplWithSideEffects('a.toString()'); |
| 14 | + |
| 15 | + InspectorTest.completeTest(); |
| 16 | +})(); |
| 17 | + |
| 18 | +async function evaluateRepl(expression) { |
| 19 | + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ |
| 20 | + expression: expression, |
| 21 | + replMode: true, |
| 22 | + throwOnSideEffect: true |
| 23 | + })); |
| 24 | +} |
| 25 | + |
| 26 | +async function evaluateReplWithSideEffects(expression) { |
| 27 | + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ |
| 28 | + expression: expression, |
| 29 | + replMode: true, |
| 30 | + throwOnSideEffect: false |
| 31 | + })); |
| 32 | +} |