summaryrefslogtreecommitdiff
path: root/cli/inspector.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/inspector.rs')
-rw-r--r--cli/inspector.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/cli/inspector.rs b/cli/inspector.rs
index 3cc3bf566..1a916c7c7 100644
--- a/cli/inspector.rs
+++ b/cli/inspector.rs
@@ -826,6 +826,7 @@ pub struct InspectorSession {
v8_session: v8::UniqueRef<v8::inspector::V8InspectorSession>,
response_tx_map: HashMap<i32, oneshot::Sender<serde_json::Value>>,
next_message_id: i32,
+ notification_queue: Vec<Value>,
}
impl Deref for InspectorSession {
@@ -868,8 +869,12 @@ impl v8::inspector::ChannelImpl for InspectorSession {
fn send_notification(
&mut self,
- _message: v8::UniquePtr<v8::inspector::StringBuffer>,
+ message: v8::UniquePtr<v8::inspector::StringBuffer>,
) {
+ let raw_message = message.unwrap().string().to_string();
+ let message = serde_json::from_str(&raw_message).unwrap();
+
+ self.notification_queue.push(message);
}
fn flush_protocol_notifications(&mut self) {}
@@ -890,15 +895,22 @@ impl InspectorSession {
let response_tx_map = HashMap::new();
let next_message_id = 0;
+ let notification_queue = Vec::new();
+
Self {
v8_channel,
v8_session,
response_tx_map,
next_message_id,
+ notification_queue,
}
})
}
+ pub fn notifications(&mut self) -> Vec<Value> {
+ self.notification_queue.split_off(0)
+ }
+
pub async fn post_message(
&mut self,
method: &str,