denoland / rusty_v8

Rust bindings for the V8 JavaScript engine
https://crates.io/crates/v8
MIT License
3.09k stars 300 forks source link

`v8::MessageCallback` registered but not called #1422

Closed littledivy closed 4 months ago

littledivy commented 4 months ago

the handler is registered and default output supressed but it's never called by V8.

extern "C" fn message_handler(
  msg: v8::Local<v8::Message>,
  _: v8::Local<v8::Value>,
) {
  let scope = &mut unsafe { v8::CallbackScope::new(msg) };
  let msg_str = msg.get(scope).to_rust_string_lossy(scope);
  println!("{}", msg_str);
}

isolate.add_message_listener(message_handler);

https://source.chromium.org/chromium/chromium/src/+/main:v8/src/execution/messages.cc;l=168-187;drc=0cfb1b06652d6572895919e6564563a6761ca6fd