mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-25 00:29:14 -05:00
Add binding for Isolate::get_entered_or_microtask_context() (#245)
A test will be added later.
This commit is contained in:
parent
2286052468
commit
5e55cc5a5c
2 changed files with 19 additions and 0 deletions
|
@ -114,6 +114,10 @@ v8::Context* v8__Isolate__GetCurrentContext(v8::Isolate* isolate) {
|
||||||
return local_to_ptr(isolate->GetCurrentContext());
|
return local_to_ptr(isolate->GetCurrentContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v8::Context* v8__Isolate__GetEnteredOrMicrotaskContext(v8::Isolate* isolate) {
|
||||||
|
return local_to_ptr(isolate->GetEnteredOrMicrotaskContext());
|
||||||
|
}
|
||||||
|
|
||||||
void v8__Isolate__SetData(v8::Isolate* isolate, uint32_t slot, void* data) {
|
void v8__Isolate__SetData(v8::Isolate* isolate, uint32_t slot, void* data) {
|
||||||
isolate->SetData(slot, data);
|
isolate->SetData(slot, data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,9 @@ extern "C" {
|
||||||
fn v8__Isolate__Enter(this: *mut Isolate);
|
fn v8__Isolate__Enter(this: *mut Isolate);
|
||||||
fn v8__Isolate__Exit(this: *mut Isolate);
|
fn v8__Isolate__Exit(this: *mut Isolate);
|
||||||
fn v8__Isolate__GetCurrentContext(this: *mut Isolate) -> *mut Context;
|
fn v8__Isolate__GetCurrentContext(this: *mut Isolate) -> *mut Context;
|
||||||
|
fn v8__Isolate__GetEnteredOrMicrotaskContext(
|
||||||
|
this: *mut Isolate,
|
||||||
|
) -> *mut Context;
|
||||||
fn v8__Isolate__SetCaptureStackTraceForUncaughtExceptions(
|
fn v8__Isolate__SetCaptureStackTraceForUncaughtExceptions(
|
||||||
this: *mut Isolate,
|
this: *mut Isolate,
|
||||||
caputre: bool,
|
caputre: bool,
|
||||||
|
@ -197,6 +200,18 @@ impl Isolate {
|
||||||
unsafe { Local::from_raw(v8__Isolate__GetCurrentContext(self)).unwrap() }
|
unsafe { Local::from_raw(v8__Isolate__GetCurrentContext(self)).unwrap() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns either the last context entered through V8's C++ API, or the
|
||||||
|
/// context of the currently running microtask while processing microtasks.
|
||||||
|
/// If a context is entered while executing a microtask, that context is
|
||||||
|
/// returned.
|
||||||
|
pub fn get_entered_or_microtask_context<'sc>(
|
||||||
|
&mut self,
|
||||||
|
) -> Local<'sc, Context> {
|
||||||
|
unsafe {
|
||||||
|
Local::from_raw(v8__Isolate__GetEnteredOrMicrotaskContext(self)).unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Tells V8 to capture current stack trace when uncaught exception occurs
|
/// Tells V8 to capture current stack trace when uncaught exception occurs
|
||||||
/// and report it to the message listeners. The option is off by default.
|
/// and report it to the message listeners. The option is off by default.
|
||||||
pub fn set_capture_stack_trace_for_uncaught_exceptions(
|
pub fn set_capture_stack_trace_for_uncaught_exceptions(
|
||||||
|
|
Loading…
Reference in a new issue