Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,14 @@ void PerIsolateMessageListener(Local<Message> message, Local<Value> error) {
filename,
message->GetLineNumber(env->context()).FromMaybe(-1),
msg);
USE(ProcessEmitWarningGeneric(env, warning, "V8"));
if (!env->can_call_into_js()) {
std::string warning_str = warning;
env->SetImmediate([warning_str](Environment* env) {
USE(ProcessEmitWarningGeneric(env, warning_str, "V8"));
});
} else {
USE(ProcessEmitWarningGeneric(env, warning, "V8"));
}
break;
}
case Isolate::MessageErrorLevel::kMessageError:
Expand Down
30 changes: 30 additions & 0 deletions test/parallel/test-repl-asm-warning.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';
const common = require('../common');
const { startNewREPLServer } = require('../common/repl');

common.skipIfInspectorDisabled();

// Regression test for https://github.com/nodejs/node/issues/63473
// V8 warnings emitted during REPL inspector preview inside
// DisallowJavascriptExecutionScope should not crash the process.

const { replServer, input } = startNewREPLServer({
terminal: true,
preview: true,
});

try {
input.run([
'function AsmModule() {',
" 'use asm';",
' function add(a, b) {',
' a = a | 0;',
' b = b | 0;',
' return a + b;',
' }',
'}',
'AsmModule();',
]);
} finally {
replServer.close();
}
Loading