Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add v8::V8Inspector::context_destroyed API #1125

Merged
merged 1 commit into from
Nov 22, 2022
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
5 changes: 5 additions & 0 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,11 @@ void v8_inspector__V8Inspector__contextCreated(
ptr_to_local(&context), contextGroupId, humanReadableName));
}

void v8_inspector__V8Inspector__contextDestroyed(
v8_inspector::V8Inspector* self, const v8::Context& context) {
self->contextDestroyed(ptr_to_local(&context));
}

bool v8_inspector__V8InspectorSession__canDispatchMethod(
v8_inspector::StringView method) {
return v8_inspector::V8InspectorSession::canDispatchMethod(method);
Expand Down
8 changes: 8 additions & 0 deletions src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ extern "C" {
contextGroupId: int,
humanReadableName: StringView,
);
fn v8_inspector__V8Inspector__contextDestroyed(
this: *mut V8Inspector,
context: *const Context,
);
}

#[no_mangle]
Expand Down Expand Up @@ -947,6 +951,10 @@ impl V8Inspector {
)
}
}

pub fn context_destroyed(&mut self, context: Local<Context>) {
unsafe { v8_inspector__V8Inspector__contextDestroyed(self, &*context) }
}
}

impl Drop for V8Inspector {
Expand Down
1 change: 1 addition & 0 deletions tests/test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5143,6 +5143,7 @@ fn inspector_dispatch_protocol_message() {
assert_eq!(channel.count_send_response, 1);
assert_eq!(channel.count_send_notification, 0);
assert_eq!(channel.count_flush_protocol_notifications, 0);
inspector.context_destroyed(context);
}

#[test]
Expand Down