Skip to content

Commit

Permalink
Add 'aux_data' to v8::Inspector::contextCreated() (denoland#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Nov 26, 2022
1 parent 7c0b53f commit 06f385a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2444,9 +2444,12 @@ v8_inspector::V8InspectorSession* v8_inspector__V8Inspector__connect(

void v8_inspector__V8Inspector__contextCreated(
v8_inspector::V8Inspector* self, const v8::Context& context,
int contextGroupId, v8_inspector::StringView humanReadableName) {
self->contextCreated(v8_inspector::V8ContextInfo(
ptr_to_local(&context), contextGroupId, humanReadableName));
int contextGroupId, v8_inspector::StringView humanReadableName,
v8_inspector::StringView auxData) {
v8_inspector::V8ContextInfo info(
ptr_to_local(&context), contextGroupId, humanReadableName);
info.auxData = auxData;
self->contextCreated(info);
}

void v8_inspector__V8Inspector__contextDestroyed(
Expand Down
3 changes: 3 additions & 0 deletions src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ extern "C" {
context: *const Context,
contextGroupId: int,
humanReadableName: StringView,
auxData: StringView,
);
fn v8_inspector__V8Inspector__contextDestroyed(
this: *mut V8Inspector,
Expand Down Expand Up @@ -941,13 +942,15 @@ impl V8Inspector {
context: Local<Context>,
context_group_id: i32,
human_readable_name: StringView,
aux_data: StringView,
) {
unsafe {
v8_inspector__V8Inspector__contextCreated(
self,
&*context,
context_group_id,
human_readable_name,
aux_data,
)
}
}
Expand Down
10 changes: 7 additions & 3 deletions tests/test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5124,7 +5124,8 @@ fn inspector_dispatch_protocol_message() {

let name = b"";
let name_view = StringView::from(&name[..]);
inspector.context_created(context, 1, name_view);
let aux_data = StringView::from(&name[..]);
inspector.context_created(context, 1, name_view, aux_data);
let mut channel = ChannelCounter::new();
let state = b"{}";
let state_view = StringView::from(&state[..]);
Expand Down Expand Up @@ -5171,7 +5172,8 @@ fn inspector_schedule_pause_on_next_statement() {

let name = b"";
let name_view = StringView::from(&name[..]);
inspector.context_created(context, 1, name_view);
let aux_data = StringView::from(&name[..]);
inspector.context_created(context, 1, name_view, aux_data);

// In order for schedule_pause_on_next_statement to work, it seems you need
// to first enable the debugger.
Expand Down Expand Up @@ -5265,7 +5267,9 @@ fn inspector_console_api_message() {

let name = b"";
let name_view = StringView::from(&name[..]);
inspector.context_created(context, 1, name_view);
let aux_data = b"{\"isDefault\": true}";
let aux_data_view = StringView::from(&aux_data[..]);
inspector.context_created(context, 1, name_view, aux_data_view);

let source = r#"
console.log("one");
Expand Down

0 comments on commit 06f385a

Please sign in to comment.