Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(renderer): preserve per-session inspector dispatch order
ldm073aa8520fd41
diff --git a/moli-core/src/page/js_evaluation.rs b/moli-core/src/page/js_evaluation.rsindex 342e6ac6a..a5543eec6 100644--- a/moli-core/src/page/js_evaluation.rs+++ b/moli-core/src/page/js_evaluation.rs@@ -513,6 +513,7 @@ impl Page {raw_json: String,deferred_response: RendererRuntimeInspectorResponseSender,) -> Result<PendingRuntimeInspectorCommandDispatch> {+ let owner_fallback_inspector_session_id = inspector_session_id.clone();let route = self.handle.enqueue_routable_runtime_inspector_command(inspector_session_id,owner_context_resolution_action,@@ -522,7 +523,10 @@ impl Page {let owner_pending = if route.requires_owner_fallback() {let command_id = route.command_id();match self.start_page_command(- RendererPageCommand::DispatchQueuedRuntimeInspectorCommand { command_id },+ RendererPageCommand::DispatchQueuedRuntimeInspectorCommand {+ command_id,+ inspector_session_id: owner_fallback_inspector_session_id,+ },) {Ok(pending) => Some(pending),Err(error) => {diff --git a/moli-renderer-v8/src/runtime/mod.rs b/moli-renderer-v8/src/runtime/mod.rsindex 21daaaca2..1fd78c9f7 100644--- a/moli-renderer-v8/src/runtime/mod.rs+++ b/moli-renderer-v8/src/runtime/mod.rs@@ -54,6 +54,7 @@ mod owner_local;mod owner_local_store;mod owner_maintenance;mod page;+mod page_command_residence;mod page_commands;mod page_context_cancel;mod page_css;diff --git a/moli-renderer-v8/src/runtime/owner.rs b/moli-renderer-v8/src/runtime/owner.rsindex 278df865b..ee1851c7c 100644--- a/moli-renderer-v8/src/runtime/owner.rs+++ b/moli-renderer-v8/src/runtime/owner.rs@@ -13,6 +13,7 @@ use super::owner_local_store::{RendererPageCreationResolution, RendererPageLocalEntry, RendererPageLocalEntryCheckoutError,RendererPageScheduledTurn, RendererPageToken, RendererPageTurnAdmission,RendererPageTurnCheckoutError, RendererPendingPageCreation, RendererPreparedDocumentResidence,+ admit_page_command_first_dispatch_on_bound_owner_local_store,advance_document_lifecycle_one_page_turn_via_local_task,advance_dom_stable_wait_turn_on_entry_via_local_task,advance_network_idle_wait_turn_on_entry_via_local_task,@@ -29,6 +30,7 @@ use super::owner_local_store::{claim_due_owner_maintenance_task_on_bound_owner_local_store,commit_page_state_on_entry_via_local_task,commit_page_state_on_entry_via_local_task_with_policy,+ complete_page_command_first_dispatch_on_bound_owner_local_store,dispatch_async_command_on_entry_via_local_task,finalize_pending_page_creation_on_bound_owner_local_store,follow_pending_location_navigation_one_turn_on_entry_via_local_task,@@ -84,7 +86,7 @@ use crate::service_worker_runtime::{use crate::shared_worker_runtime::{SharedWorkerRuntimeOwnerWake, shared_worker_owner_wake_channel,};-use moli_page_types::LayoutPolicy;+use moli_page_types::{DevToolsSessionKey, LayoutPolicy};use std::collections::VecDeque;use tokio::sync::{mpsc, oneshot};@@ -360,7 +362,7 @@ impl std::fmt::Display for LivePageNavigationFailureDisposition {}}-struct RenderRuntimePendingTurn {+pub(super) struct RenderRuntimePendingTurn {/// `None` means the pending turn is detached/background work (originated/// from an idle-tick) and no caller is waiting on a reply.reply_tx: Option<oneshot::Sender<Result<RendererOwnerReply>>>,@@ -369,6 +371,12 @@ struct RenderRuntimePendingTurn {command_admission_output_predecessor: Option<RendererOutputFence>,}+#[derive(Clone, Debug, Eq, PartialEq)]+struct PageCommandFirstDispatchIdentity {+ token: RendererPageToken,+ inspector_session: DevToolsSessionKey,+}+impl RenderRuntimePendingTurn {const fn is_page_owner_turn(&self) -> bool {matches!(&self.turn, RenderRuntimeTurn::RunPageTurn { .. })@@ -384,6 +392,15 @@ impl RenderRuntimePendingTurn {const fn is_owner_maintenance_turn(&self) -> bool {matches!(&self.turn, RenderRuntimeTurn::RunOwnerMaintenance { .. })}++ pub(super) fn reject_page_command_admission(self, page_id: PageId) {+ if let Some(reply_tx) = self.reply_tx {+ let _ = reply_tx.send(Err(anyhow!(+ "renderer page {} was retired while a command waited for first dispatch",+ page_id.as_u64()+ )));+ }+ }}#[derive(Default)]@@ -648,6 +665,20 @@ impl RenderRuntimeTurn {)}+ fn live_page_command_first_dispatch_identity(+ &self,+ ) -> Option<PageCommandFirstDispatchIdentity> {+ match self {+ Self::RunLivePageCommand { token, command, .. } => command+ .first_dispatch_inspector_session()+ .map(|inspector_session| PageCommandFirstDispatchIdentity {+ token: *token,+ inspector_session,+ }),+ _ => None,+ }+ }+/// Return the Page whose committed view this host-facing command needs.////// A same-Page cross-document navigation installs its replacement PageVm@@ -806,6 +837,25 @@ fn owner_command_timing_label(command: &RendererOwnerCommand) -> Option<&'static}}+impl RenderRuntimeDispatchOutcome {+ fn deferred_live_page_command_first_dispatch_identity(+ &self,+ ) -> Option<PageCommandFirstDispatchIdentity> {+ match self {+ Self::ContinueNextTurn(turn)+ | Self::ContinueAfterPageWakeOrDeadline { turn, .. }+ | Self::ContinueAfterPageWake { turn, .. }+ | Self::ContinueCommittedDocumentParserAfterPageWake { turn, .. } => {+ turn.live_page_command_first_dispatch_identity()+ }+ Self::Reply(_)+ | Self::PageCreatedAndContinueNavigation { .. }+ | Self::BackgroundComplete(_)+ | Self::PageCreationNavigationFailurePublished { .. } => None,+ }+ }+}+impl From<Result<RendererOwnerReply>> for RenderRuntimeDispatchOutcome {fn from(value: Result<RendererOwnerReply>) -> Self {Self::Reply(Box::new(value))@@ -2392,6 +2442,41 @@ impl RendererOwnerHandle {}}+ /// The stable Page slot owns each Inspector session's command arrival+ /// order. Only the command that owns its session's first-dispatch lane+ /// enters the owner-wide runnable queue. Other sessions and non-Inspector+ /// Page commands remain independent. The pause bridge is still the+ /// interrupt path used by commands such as `Debugger.resume` once V8 is+ /// paused.+ fn admit_page_command_first_dispatch(+ turn: RenderRuntimePendingTurn,+ pending_turns: &mut RenderRuntimePendingTurnQueue,+ ) {+ let Some(identity) = turn.turn.live_page_command_first_dispatch_identity() else {+ pending_turns.push_back(turn);+ return;+ };+ if let Some(admitted) = admit_page_command_first_dispatch_on_bound_owner_local_store(+ identity.token,+ identity.inspector_session,+ turn,+ ) {+ pending_turns.push_back(admitted);+ }+ }++ fn complete_page_command_first_dispatch(+ identity: &PageCommandFirstDispatchIdentity,+ pending_turns: &mut RenderRuntimePendingTurnQueue,+ ) {+ if let Some(next) = complete_page_command_first_dispatch_on_bound_owner_local_store(+ identity.token,+ &identity.inspector_session,+ ) {+ pending_turns.push_back(next);+ }+ }+pub(crate) async fn run_render_runtime_loop(&self,mut rx: mpsc::UnboundedReceiver<RenderRuntimeEnvelope>,@@ -2492,10 +2577,19 @@ impl RendererOwnerHandle {.as_ref().is_some_and(|tx| tx.is_closed()){+ let first_dispatch_identity = pending_turn+ .turn+ .live_page_command_first_dispatch_identity();self.detach_navigation_or_cancel_pending_turn(pending_turn.turn,&mut pending_turns,);+ if let Some(identity) = first_dispatch_identity.as_ref() {+ Self::complete_page_command_first_dispatch(+ identity,+ &mut pending_turns,+ );+ }continue;}if let Some(token) = pending_turn.turn.committed_page_view_command_token()@@ -2556,9 +2650,14 @@ impl RendererOwnerHandle {continue;}let completed_page_turn_token = pending_turn.page_owner_token();+ let first_dispatch_identity = pending_turn+ .turn+ .live_page_command_first_dispatch_identity();let outcome = self.run_pending_turn_on_owner_local_store(pending_turn.turn).await;+ let deferred_first_dispatch_identity =+ outcome.deferred_live_page_command_first_dispatch_identity();match outcome {RenderRuntimeDispatchOutcome::Reply(result) => {let result = merge_command_admission_output_predecessor(@@ -2743,6 +2842,11 @@ impl RendererOwnerHandle {&mut pending_turns,);}+ if let Some(identity) = first_dispatch_identity.as_ref()+ && deferred_first_dispatch_identity.as_ref() != Some(identity)+ {+ Self::complete_page_command_first_dispatch(identity, &mut pending_turns);+ }continue;}@@ -2937,18 +3041,21 @@ impl RendererOwnerHandle {if envelope.reply_tx.is_closed() {self.detach_navigation_or_cancel_pending_turn(*turn, pending_turns);} else {- pending_turns.push_back(RenderRuntimePendingTurn {- reply_tx: Some(envelope.reply_tx),- turn: *turn,- // This is the command's first owner turn, not a- // continuation returning to the queue. Run it before- // admitting another envelope so a Page wake produced- // by the command cannot inherit an already-pending- // command and then yield to a second one.- allow_command_overtake: false,- command_admission_output_predecessor: command_admission_output_predecessor- .take(),- });+ Self::admit_page_command_first_dispatch(+ RenderRuntimePendingTurn {+ reply_tx: Some(envelope.reply_tx),+ turn: *turn,+ // This is the command's first owner turn, not a+ // continuation returning to the queue. Run it before+ // admitting another envelope so a Page wake produced+ // by the command cannot inherit an already-pending+ // command and then yield to a second one.+ allow_command_overtake: false,+ command_admission_output_predecessor:+ command_admission_output_predecessor.take(),+ },+ pending_turns,+ );}}RenderRuntimeDispatchOutcome::ContinueAfterPageWakeOrDeadline {@@ -3195,7 +3302,11 @@ impl RendererOwnerHandle {pending_turns: &mut RenderRuntimePendingTurnQueue,) {if reply_tx.as_ref().is_some_and(|tx| tx.is_closed()) {+ let first_dispatch_identity = turn.live_page_command_first_dispatch_identity();self.detach_navigation_or_cancel_pending_turn(turn, pending_turns);+ if let Some(identity) = first_dispatch_identity.as_ref() {+ Self::complete_page_command_first_dispatch(identity, pending_turns);+ }return;}parked_turns.push_back(RenderRuntimeParkedTurn {@@ -3620,7 +3731,12 @@ impl RendererOwnerHandle {.as_ref().is_some_and(|tx| tx.is_closed()){+ let first_dispatch_identity =+ parked_turn.turn.live_page_command_first_dispatch_identity();self.detach_navigation_or_cancel_pending_turn(parked_turn.turn, pending_turns);+ if let Some(identity) = first_dispatch_identity.as_ref() {+ Self::complete_page_command_first_dispatch(identity, pending_turns);+ }None} else {let allow_command_overtake = parked_turn.condition.allows_command_overtake();@@ -6938,6 +7054,53 @@ mod tests {);}+ #[test]+ fn first_dispatch_identity_uses_the_exact_renderer_inspector_session() {+ let token = RendererPageToken::new_for_testing(PageId::new_for_testing(8));+ let attached = RenderRuntimeTurn::RunLivePageCommand {+ token,+ command: RendererPageCommand::DispatchQueuedRuntimeInspectorCommand {+ command_id: 1,+ inspector_session_id: Some("SID-aux".to_owned()),+ },+ capture_policy: RendererPageStateCapturePolicy::ProtocolTurn,+ };+ assert_eq!(+ attached.live_page_command_first_dispatch_identity(),+ Some(PageCommandFirstDispatchIdentity {+ token,+ inspector_session: DevToolsSessionKey::Attached("SID-aux".to_owned()),+ })+ );++ let primary = RenderRuntimeTurn::RunLivePageCommand {+ token,+ command: RendererPageCommand::DispatchQueuedRuntimeInspectorCommand {+ command_id: 2,+ inspector_session_id: None,+ },+ capture_policy: RendererPageStateCapturePolicy::ProtocolTurn,+ };+ assert_eq!(+ primary.live_page_command_first_dispatch_identity(),+ Some(PageCommandFirstDispatchIdentity {+ token,+ inspector_session: DevToolsSessionKey::Primary,+ })+ );++ let ordinary_page_command = RenderRuntimeTurn::RunLivePageCommand {+ token,+ command: RendererPageCommand::PageDiagnosticsSnapshot,+ capture_policy: RendererPageStateCapturePolicy::ProtocolTurn,+ };+ assert_eq!(+ ordinary_page_command.live_page_command_first_dispatch_identity(),+ None,+ "non-Inspector Page commands must not join an unrelated session lane"+ );+ }+#[test]fn replacement_view_waiter_ignores_generic_activity_and_wrong_document_settlement() {let condition = RenderRuntimeParkCondition::ReplacementDocumentViewSettlement {diff --git a/moli-renderer-v8/src/runtime/owner_local_store.rs b/moli-renderer-v8/src/runtime/owner_local_store.rsindex 1762659a1..1347685b3 100644--- a/moli-renderer-v8/src/runtime/owner_local_store.rs+++ b/moli-renderer-v8/src/runtime/owner_local_store.rs@@ -17,12 +17,13 @@ use super::navigation::{PageCreationNavigationFailurePublisher, PageCreationResolution, PageCreationRetirement,PageNavigationOwnerFailure, page_creation_navigation_failure_scope,};-use super::owner::RendererCreateStreamingRawPageRequest;+use super::owner::{RenderRuntimePendingTurn, RendererCreateStreamingRawPageRequest};use super::owner_deadline_index::OwnerDeadlineIndex;use super::owner_local::RendererAttachedPage;use super::owner_maintenance::{RendererOwnerMaintenanceTask, RendererPageOwnerMaintenanceResidence,};+use super::page_command_residence::PageCommandFirstDispatchResidence;use super::page_entry_residence::{RendererPageEntryCheckout, RendererPageEntryRestore};use super::page_turn_scheduler::{DocumentLifecycleClassReadiness, PageTurnAdmission, PageTurnClass, PageTurnScheduler,@@ -44,6 +45,7 @@ use crate::script_vm::{RendererPageScriptEnvironment,};use crate::{RendererNavigationReplyPolicy, RendererTopLevelNavigationDispatch};+use moli_page_types::DevToolsSessionKey;use tokio::sync::oneshot;#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]@@ -651,6 +653,8 @@ impl RendererPageScriptEnvironmentPin {struct RendererOwnerLocalPageSlot {owner_slot: RendererPageSlotHandle,turn_scheduler: PageTurnScheduler<RendererPageLocalEntry>,+ page_command_first_dispatch:+ PageCommandFirstDispatchResidence<DevToolsSessionKey, RenderRuntimePendingTurn>,owner_maintenance: RendererPageOwnerMaintenanceResidence,task_sources: RendererPageOwnedTaskSources,lifecycle_gate: Option<LifecycleGate>,@@ -670,6 +674,7 @@ impl RendererOwnerLocalPageSlot {Self {owner_slot,turn_scheduler: PageTurnScheduler::new(entry),+ page_command_first_dispatch: PageCommandFirstDispatchResidence::default(),owner_maintenance: RendererPageOwnerMaintenanceResidence::new(std::time::Instant::now()),task_sources,lifecycle_gate: lifecycle_gate.map(LifecycleGate::new),@@ -730,6 +735,9 @@ impl Drop for RendererOwnerLocalPageSlot {// This is the stable Page lifetime boundary. A replacement PageVm// drops only Document-owned queues; retiring the slot also discards// V8 foreground work and typed Page source payloads.+ for waiting in self.page_command_first_dispatch.drain_waiting() {+ waiting.reject_page_command_admission(self.owner_slot.page_id());+ }self.task_sources.clear();self.script_environment_pin.environment@@ -1549,6 +1557,29 @@ pub(super) fn take_entry_for_command_on_bound_owner_local_store(})}+pub(super) fn admit_page_command_first_dispatch_on_bound_owner_local_store(+ token: RendererPageToken,+ inspector_session: DevToolsSessionKey,+ turn: RenderRuntimePendingTurn,+) -> Option<RenderRuntimePendingTurn> {+ with_bound_render_runtime_owner_local_store_session(|session| {+ session+ .store+ .admit_page_command_first_dispatch(token, inspector_session, turn)+ })+}++pub(super) fn complete_page_command_first_dispatch_on_bound_owner_local_store(+ token: RendererPageToken,+ inspector_session: &DevToolsSessionKey,+) -> Option<RenderRuntimePendingTurn> {+ with_bound_render_runtime_owner_local_store_session(|session| {+ session+ .store+ .complete_page_command_first_dispatch(token, inspector_session)+ })+}+pub(super) fn checkout_entry_for_owner_turn_on_bound_owner_local_store(token: RendererPageToken,) -> RendererPageLocalEntryCheckout {@@ -2873,6 +2904,37 @@ impl RendererOwnerLocalStore {.and_then(RendererPageLocalEntry::uncommitted_page_vm_creation_id)}+ fn admit_page_command_first_dispatch(+ &mut self,+ token: RendererPageToken,+ inspector_session: DevToolsSessionKey,+ turn: RenderRuntimePendingTurn,+ ) -> Option<RenderRuntimePendingTurn> {+ let Some(page_slot) = self+ .page_hosts+ .get_mut(&token.local_host_id)+ .and_then(|host| host.pages.get_mut(&token.page_id))+ else {+ // Let the command run once so the ordinary stale-Page error path+ // remains responsible for its protocol reply.+ return Some(turn);+ };+ page_slot+ .page_command_first_dispatch+ .admit(inspector_session, turn)+ }++ fn complete_page_command_first_dispatch(+ &mut self,+ token: RendererPageToken,+ inspector_session: &DevToolsSessionKey,+ ) -> Option<RenderRuntimePendingTurn> {+ self.page_hosts+ .get_mut(&token.local_host_id)+ .and_then(|host| host.pages.get_mut(&token.page_id))+ .and_then(|slot| slot.page_command_first_dispatch.complete(inspector_session))+ }+fn checkout_entry_for_owner_turn(&mut self,token: RendererPageToken,diff --git a/moli-renderer-v8/src/runtime/page_command_residence.rs b/moli-renderer-v8/src/runtime/page_command_residence.rsnew file mode 100644index 000000000..38b2e8256--- /dev/null+++ b/moli-renderer-v8/src/runtime/page_command_residence.rs@@ -0,0 +1,110 @@+//! Stable per-Page admission state for renderer Inspector commands.+//!+//! A Page entry is temporarily checked out while an owner turn runs, so+//! Inspector-session ordering cannot live in `RendererPageLocalEntry`. This+//! residence stays in the stable Page slot and admits each session's commands+//! in arrival order until they reach their first V8 dispatch. Independent+//! sessions on the same Page have independent lanes.++use std::collections::{BTreeMap, VecDeque};++pub(super) struct PageCommandFirstDispatchResidence<Key, Command> {+ /// Presence of a lane is the stable marker for its active command, which+ /// has already moved to the renderer owner. The deque retains only later+ /// same-session commands.+ lanes: BTreeMap<Key, VecDeque<Command>>,+}++impl<Key, Command> std::fmt::Debug for PageCommandFirstDispatchResidence<Key, Command> {+ fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ formatter+ .debug_struct("PageCommandFirstDispatchResidence")+ .field("active_session_count", &self.lanes.len())+ .field(+ "waiting_count",+ &self.lanes.values().map(VecDeque::len).sum::<usize>(),+ )+ .finish()+ }+}++impl<Key, Command> Default for PageCommandFirstDispatchResidence<Key, Command> {+ fn default() -> Self {+ Self {+ lanes: BTreeMap::new(),+ }+ }+}++impl<Key: Ord, Command> PageCommandFirstDispatchResidence<Key, Command> {+ /// Returns the command when it owns its session's active dispatch slot. A+ /// `None` result means the Page residence retained it behind a predecessor+ /// from the same session.+ pub(super) fn admit(&mut self, key: Key, command: Command) -> Option<Command> {+ match self.lanes.entry(key) {+ std::collections::btree_map::Entry::Vacant(entry) => {+ entry.insert(VecDeque::new());+ Some(command)+ }+ std::collections::btree_map::Entry::Occupied(mut entry) => {+ entry.get_mut().push_back(command);+ None+ }+ }+ }++ /// Releases one session's active command and returns its next FIFO waiter,+ /// which inherits the lane without an intermediate idle state.+ pub(super) fn complete(&mut self, key: &Key) -> Option<Command> {+ debug_assert!(+ self.lanes.contains_key(key),+ "an Inspector session dispatch lane must be active"+ );+ let waiting = self.lanes.get_mut(key)?;+ if let Some(next) = waiting.pop_front() {+ return Some(next);+ }+ self.lanes.remove(key);+ None+ }++ pub(super) fn drain_waiting(&mut self) -> Vec<Command> {+ std::mem::take(&mut self.lanes)+ .into_values()+ .flatten()+ .collect()+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn each_inspector_session_owns_an_independent_fifo_dispatch_lane() {+ let mut first_page = PageCommandFirstDispatchResidence::default();+ let mut other_page = PageCommandFirstDispatchResidence::default();++ assert_eq!(first_page.admit("session-a", "a-first"), Some("a-first"));+ assert_eq!(first_page.admit("session-a", "a-second"), None);+ assert_eq!(+ first_page.admit("session-b", "b-first"),+ Some("b-first"),+ "a parked command must not block a different Inspector session"+ );+ assert_eq!(first_page.admit("session-b", "b-second"), None);++ assert_eq!(other_page.admit("session-a", "other"), Some("other"));+ assert_eq!(other_page.complete(&"session-a"), None);++ assert_eq!(first_page.complete(&"session-b"), Some("b-second"));+ assert_eq!(first_page.complete(&"session-b"), None);+ assert_eq!(first_page.complete(&"session-a"), Some("a-second"));+ assert_eq!(first_page.complete(&"session-a"), None);++ assert_eq!(+ first_page.admit("session-a", "a-after-idle"),+ Some("a-after-idle")+ );+ }+}diff --git a/moli-renderer-v8/src/runtime/page_commands.rs b/moli-renderer-v8/src/runtime/page_commands.rsindex 5bac06c64..cb7b8b8de 100644--- a/moli-renderer-v8/src/runtime/page_commands.rs+++ b/moli-renderer-v8/src/runtime/page_commands.rs@@ -203,7 +203,7 @@ impl PageVm {).map(RendererRuntimeCommandOutput::from_messages).map(RendererPageReply::RuntimeInspectorProtocolMessages),- RendererPageCommand::DispatchQueuedRuntimeInspectorCommand { command_id } => self+ RendererPageCommand::DispatchQueuedRuntimeInspectorCommand { command_id, .. } => self.dispatch_queued_runtime_inspector_command(command_id).map(RendererRuntimeCommandOutput::from_messages).map(RendererPageReply::RuntimeInspectorProtocolMessages),diff --git a/moli-renderer-v8/src/runtime/page_surface.rs b/moli-renderer-v8/src/runtime/page_surface.rsindex c4c7ccd87..11f3e8fbc 100644--- a/moli-renderer-v8/src/runtime/page_surface.rs+++ b/moli-renderer-v8/src/runtime/page_surface.rs@@ -3627,6 +3627,7 @@ pub enum RendererPageCommand {},DispatchQueuedRuntimeInspectorCommand {command_id: u64,+ inspector_session_id: Option<String>,},DispatchRuntimeProtocolMessageWithContextResolution {inspector_session_id: Option<String>,@@ -4168,6 +4169,39 @@ pub enum RendererRuntimeRemoteObjectResolution {}impl RendererPageCommand {+ /// Returns the V8 Inspector session whose message order owns this command's+ /// first-dispatch boundary. Direct Inspector commands and the owner fallback+ /// for pause-routable commands share the same session lane, preventing+ /// same-session overtaking without coupling independent sessions.+ pub(super) fn first_dispatch_inspector_session(&self) -> Option<DevToolsSessionKey> {+ let inspector_session_id = match self {+ Self::DispatchRuntimeProtocolMessage {+ inspector_session_id,+ ..+ }+ | Self::DispatchRuntimeProtocolMessageWithDeferredResponse {+ inspector_session_id,+ ..+ }+ | Self::DispatchQueuedRuntimeInspectorCommand {+ inspector_session_id,+ ..+ }+ | Self::DispatchRuntimeProtocolMessageWithContextResolution {+ inspector_session_id,+ ..+ }+ | Self::DispatchRuntimeProtocolMessageWithContextResolutionAndDeferredResponse {+ inspector_session_id,+ ..+ } => inspector_session_id.as_deref(),+ _ => return None,+ };+ Some(DevToolsSessionKey::from_wire_session_id(+ inspector_session_id,+ ))+ }+pub(crate) fn interruptible_by_javascript_dialog(&self) -> bool {#[cfg(test)]if matches!(self, Self::TakeDocumentLifecycleEvents) {