Skip to content
Merged
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: 9 additions & 0 deletions src/V8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ unsafe extern "C" {
fn v8__V8__Dispose() -> bool;
fn v8__V8__DisposePlatform();
fn v8__V8__SetFatalErrorHandler(that: V8FatalErrorCallback);
fn v8__V8__EnableWebAssemblyTrapHandler(use_v8_signal_handler: bool) -> bool;
}

pub type V8FatalErrorCallback = unsafe extern "C" fn(
Expand Down Expand Up @@ -281,6 +282,14 @@ pub fn set_fatal_error_handler(that: impl MapFnTo<V8FatalErrorCallback>) {
}
}

/// Activate trap-based bounds checking for WebAssembly.
///
/// If `use_v8_signal_handler` is true, V8 installs its own signal handler.
/// Otherwise, V8 relies on the embedder to invoke its trap handler.
pub fn enable_web_assembly_trap_handler(use_v8_signal_handler: bool) -> bool {
unsafe { v8__V8__EnableWebAssemblyTrapHandler(use_v8_signal_handler) }
}

#[cfg(test)]
mod test_sandbox_use {
// __IsSandboxEnabled is used for testing that sandbox is actually
Expand Down
4 changes: 4 additions & 0 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ void v8__V8__SetFatalErrorHandler(v8::V8FatalErrorCallback that) {
v8::V8::SetFatalErrorHandler(that);
}

bool v8__V8__EnableWebAssemblyTrapHandler(bool use_v8_signal_handler) {
return v8::V8::EnableWebAssemblyTrapHandler(use_v8_signal_handler);
}

v8::Isolate* v8__Isolate__New(const v8::Isolate::CreateParams& params) {
return v8::Isolate::New(params);
}
Expand Down
Loading