pub struct BaoWebViewState {
pub url: Option<Url>,
pub title: Option<String>,
pub load_status: LoadStatus,
pub frame_ready: bool,
pub dom_proxies_dirty: bool,
pub console_log_tx: Option<Sender<ConsoleMessage>>,
pub event_tx: Option<Sender<ServoEvent>>,
pub worker_scope_config: WorkerScopeConfig,
/* private fields */
}Fields§
§url: Option<Url>§title: Option<String>§load_status: LoadStatus§frame_ready: bool§dom_proxies_dirty: boolSet to true after navigation completes (LoadStatus::Complete). evaluate_js checks this flag and refreshes stale DOM proxies before executing scripts.
console_log_tx: Option<Sender<ConsoleMessage>>Channel for forwarding per-webview console messages to CDP Log domain.
event_tx: Option<Sender<ServoEvent>>Channel for forwarding structured ServoEvent to the EventSubscriber path (Path B). When set, events are also pushed here in addition to console_log_tx. @trace REQ-CDP-006 [entity:ServoDelegateHooks]
worker_scope_config: WorkerScopeConfigWorker scope config for propagating stealth-consistent properties to new Workers. Populated from the page’s StealthProfile when the page is created. @trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope] [criterion:12..17]
Implementations§
Source§impl BaoWebViewState
impl BaoWebViewState
Sourcepub fn track_worker(&mut self, handle: WorkerHandle)
pub fn track_worker(&mut self, handle: WorkerHandle)
Track a newly created Worker for this webview.
Called when servo’s Worker::Constructor completes (DF-WK-1). The WorkerHandle is wrapped in an AutoCloseWorker guard that ensures termination on page unload or panic unwinding.
@trace REQ-BRW-004 [entity:Worker] [criterion:10]
Sourcepub fn track_worker_guard(&mut self, guard: AutoCloseWorker)
pub fn track_worker_guard(&mut self, guard: AutoCloseWorker)
Track a newly created Worker with a pre-allocated AutoCloseWorker.
@trace REQ-BRW-004 [entity:Worker] [criterion:10]
Sourcepub fn terminate_all_workers(&mut self)
pub fn terminate_all_workers(&mut self)
Auto-terminate all active Workers on page unload (crash-safe).
SPEC criterion #10: “页面卸载时自动终止所有 Worker (GlobalScope::track_worker + AutoCloseWorker)”. Called from notify_load_status_changed when a new navigation starts (LoadStatus::Started after a previous Complete).
SPEC criterion #18: “三路径 teardown 均 crash-safe: worker 线程 JSContext 干净销毁 + 线程 join 无悬挂 + REALM_PROFILES 条目注销
- 无 EBUSY 类 mutex destroy SIGSEGV“
This method performs crash-safe teardown for each Worker:
- Sets the closing flag (signals the worker event loop to exit)
- Unregisters each Worker’s stealth profile from REALM_PROFILES
- Marks each Worker as terminated
- Drops WebWorker instances (their Drop impl joins the thread)
Also clears all Worker channel bridges — dropping the channels signals worker threads that the parent has disconnected (DF-WK-4/5). Also clears script loading states and marks any in-progress loads as cancelled (DF-WK-2).
@trace REQ-BRW-004 [entity:Worker] [criterion:10] [criterion:6] [criterion:18] @trace REQ-BRW-004 [entity:Worker] [DF-WK-2]
Sourcepub fn reap_terminated_workers(&mut self)
pub fn reap_terminated_workers(&mut self)
Remove fully-terminated Workers from the tracking list.
Called after spin_event_loop to clean up Workers whose threads have exited (terminated flag set by Worker teardown). Also reaps their channel bridges and script load states.
@trace REQ-BRW-004 [entity:Worker] [criterion:6] @trace REQ-BRW-004 [entity:Worker] [DF-WK-2]
Sourcepub fn active_worker_count(&self) -> usize
pub fn active_worker_count(&self) -> usize
Returns the number of active (non-terminated) Workers.
@trace REQ-BRW-004 [entity:Worker]
Sourcepub fn terminate_worker_via_path(
&mut self,
worker_id: &WorkerId,
path: WorkerTeardownPath,
) -> Option<WorkerTeardownResult>
pub fn terminate_worker_via_path( &mut self, worker_id: &WorkerId, path: WorkerTeardownPath, ) -> Option<WorkerTeardownResult>
Terminate a specific Worker via the given teardown path (crash-safe).
This is the single-Worker teardown method implementing SPEC criterion #18
for the worker.terminate() and self.close() paths. The PageUnload
path is handled by terminate_all_workers.
Crash-safe teardown protocol:
- Set the closing flag (signals the worker event loop to exit)
- Unregister the Worker’s stealth profile from REALM_PROFILES
- Mark the Worker as terminated
- Drop the WebWorker instance (its Drop impl joins the thread)
Returns the WorkerTeardownResult for observability, or None if the Worker was not found.
@trace REQ-BRW-004 [entity:Worker] [criterion:4] [criterion:5] [criterion:18]
Sourcepub fn register_dedicated_worker_scope(
&mut self,
worker_id: WorkerId,
scope: DedicatedWorkerGlobalScopeState,
)
pub fn register_dedicated_worker_scope( &mut self, worker_id: WorkerId, scope: DedicatedWorkerGlobalScopeState, )
Register a DedicatedWorkerGlobalScope state under the given WorkerId.
Called when a Worker is created (DF-WK-1), populating the scope state for CDP observability and stealth consistency verification.
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope]
Sourcepub fn register_web_worker(&mut self, worker_id: WorkerId, handle: WorkerHandle)
pub fn register_web_worker(&mut self, worker_id: WorkerId, handle: WorkerHandle)
Register a WorkerHandle reference for the given WorkerId (DEC-WK-001).
The WorkerHandle tracks the Worker’s closing/terminated flags + global_addr for REALM_PROFILES cleanup. Storing it here keeps the handle alive for CDP observability + page-unload termination tracking. The actual Worker thread lifecycle is owned by servo.
@trace REQ-BRW-004 [entity:Worker] [criterion:1] [criterion:18]
Sourcepub fn web_worker(&self, worker_id: &WorkerId) -> Option<&WorkerHandle>
pub fn web_worker(&self, worker_id: &WorkerId) -> Option<&WorkerHandle>
Get a reference to a WorkerHandle by WorkerId.
@trace REQ-BRW-004 [entity:Worker]
Sourcepub fn dedicated_worker_scope(
&self,
worker_id: &WorkerId,
) -> Option<&DedicatedWorkerGlobalScopeState>
pub fn dedicated_worker_scope( &self, worker_id: &WorkerId, ) -> Option<&DedicatedWorkerGlobalScopeState>
Get a reference to a DedicatedWorkerGlobalScope state.
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope]
Sourcepub fn dedicated_worker_scope_mut(
&mut self,
worker_id: &WorkerId,
) -> Option<&mut DedicatedWorkerGlobalScopeState>
pub fn dedicated_worker_scope_mut( &mut self, worker_id: &WorkerId, ) -> Option<&mut DedicatedWorkerGlobalScopeState>
Get a mutable reference to a DedicatedWorkerGlobalScope state.
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope]
Sourcepub fn remove_dedicated_worker_scope(
&mut self,
worker_id: &WorkerId,
) -> Option<DedicatedWorkerGlobalScopeState>
pub fn remove_dedicated_worker_scope( &mut self, worker_id: &WorkerId, ) -> Option<DedicatedWorkerGlobalScopeState>
Remove a DedicatedWorkerGlobalScope state (called when a Worker is reaped).
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope]
Sourcepub fn dedicated_worker_scope_count(&self) -> usize
pub fn dedicated_worker_scope_count(&self) -> usize
Returns the number of tracked DedicatedWorkerGlobalScope states.
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope]
Sourcepub fn dedicated_worker_scopes(&self) -> Vec<&DedicatedWorkerGlobalScopeState>
pub fn dedicated_worker_scopes(&self) -> Vec<&DedicatedWorkerGlobalScopeState>
Returns a snapshot of all DedicatedWorkerGlobalScope states.
Used for CDP observability (Runtime domain) and stealth consistency verification (criterion #12-17).
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope]
Sourcepub fn dedicated_worker_scope_by_url(
&self,
url: &str,
) -> Option<&DedicatedWorkerGlobalScopeState>
pub fn dedicated_worker_scope_by_url( &self, url: &str, ) -> Option<&DedicatedWorkerGlobalScopeState>
Look up a DedicatedWorkerGlobalScope state by the Worker’s script URL (CDP worker targetId — the WorkerId is the script URL).
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope] [criterion:19]
Sourcepub fn register_worker_script_load_state(
&mut self,
worker_id: WorkerId,
state: WorkerScriptLoadState,
)
pub fn register_worker_script_load_state( &mut self, worker_id: WorkerId, state: WorkerScriptLoadState, )
Register a script loading state for a Worker.
Called when a Worker is created with a URL-based script source. Tracks the loading progress for CDP observability.
@trace REQ-BRW-004 [entity:Worker] [DF-WK-2]
Sourcepub fn update_worker_script_load_state(
&mut self,
worker_id: &WorkerId,
state: WorkerScriptLoadState,
)
pub fn update_worker_script_load_state( &mut self, worker_id: &WorkerId, state: WorkerScriptLoadState, )
Update the script loading state for a Worker.
Called as the Worker script loading progresses through stages (Pending → Fetching → Validating → Decoding → Compiling → Ready/Failed).
@trace REQ-BRW-004 [entity:Worker] [DF-WK-2]
Sourcepub fn worker_script_load_state(
&self,
worker_id: &WorkerId,
) -> Option<&WorkerScriptLoadState>
pub fn worker_script_load_state( &self, worker_id: &WorkerId, ) -> Option<&WorkerScriptLoadState>
Get the script loading state for a Worker.
@trace REQ-BRW-004 [entity:Worker] [DF-WK-2]
Sourcepub fn remove_worker_script_load_state(
&mut self,
worker_id: &WorkerId,
) -> Option<WorkerScriptLoadState>
pub fn remove_worker_script_load_state( &mut self, worker_id: &WorkerId, ) -> Option<WorkerScriptLoadState>
Remove the script loading state for a Worker (called when reaped).
@trace REQ-BRW-004 [entity:Worker] [DF-WK-2]
Sourcepub fn worker_script_load_state_count(&self) -> usize
pub fn worker_script_load_state_count(&self) -> usize
Returns the number of tracked Worker script loading states.
@trace REQ-BRW-004 [entity:Worker] [DF-WK-2]
Sourcepub fn worker_lifecycle_states(&self) -> Vec<(WorkerId, WorkerLifecycleState)>
pub fn worker_lifecycle_states(&self) -> Vec<(WorkerId, WorkerLifecycleState)>
Returns a snapshot of all active Workers’ lifecycle states.
Used for CDP observability and debugging.
@trace REQ-BRW-004 [entity:Worker] [criterion:18]
Sourcepub fn set_worker_scope_config(&mut self, config: WorkerScopeConfig)
pub fn set_worker_scope_config(&mut self, config: WorkerScopeConfig)
Set the Worker scope config from the page’s StealthProfile.
Called when a page is created with a StealthProfile to ensure Workers spawned from that page inherit the same stealth properties.
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope] [criterion:12..17]
Sourcepub fn forward_worker_message_event(&self, event: WorkerMessageEvent)
pub fn forward_worker_message_event(&self, event: WorkerMessageEvent)
Forward a Worker postMessage event to the CDP event path.
DF-WK-4 / DF-WK-5: When event_tx is set, push a ServoEvent::Console for CDP observability. Supports both metadata-only events (from servo internal message handling) and full structured-clone events (from bao channel bridge).
@trace REQ-BRW-004 [entity:Worker] [criterion:6] [DF-WK-4] [DF-WK-5]
Sourcepub fn forward_worker_structured_message(&self, msg: &WorkerStructuredMessage)
pub fn forward_worker_structured_message(&self, msg: &WorkerStructuredMessage)
Forward a Worker structured-clone message to the CDP event path.
DF-WK-4 / DF-WK-5: When event_tx is set, push a ServoEvent::Console for CDP observability with payload metadata. Includes message_id for trace correlation and payload size.
@trace REQ-BRW-004 [entity:Worker] [criterion:6] [DF-WK-4] [DF-WK-5]
Sourcepub fn forward_worker_error_event(&self, event: WorkerErrorEvent)
pub fn forward_worker_error_event(&self, event: WorkerErrorEvent)
Forward a Worker error event to the CDP event path.
SPEC criterion #9: “onerror 事件正确传播到主线程 (ErrorEvent 包含 message/filename/lineno/colno)”. When event_tx is set, push a ServoEvent::PageError for CDP observability (maps to Runtime.exceptionThrown).
@trace REQ-BRW-004 [entity:Worker] [criterion:9]
Sourcepub fn register_worker_channel(&mut self, bridge: WorkerChannelBridge)
pub fn register_worker_channel(&mut self, bridge: WorkerChannelBridge)
Register a channel bridge for a Worker’s postMessage channel.
Called when a Worker is created and its channel bridge is set up. The bridge enables page→worker (DF-WK-4) and worker→page (DF-WK-5) structured-clone message passing.
@trace REQ-BRW-004 [entity:Worker] [criterion:6] DF-WK-4 / DF-WK-5
Sourcepub fn create_worker_channel(
&mut self,
worker_id: WorkerId,
) -> WorkerChannelEndpoints
pub fn create_worker_channel( &mut self, worker_id: WorkerId, ) -> WorkerChannelEndpoints
Create and register a channel bridge for a Worker.
Convenience method that creates the bridge and endpoints, registers the bridge, and returns the endpoints for the worker thread.
@trace REQ-BRW-004 [entity:Worker] [criterion:6] DF-WK-4 / DF-WK-5
Sourcepub fn remove_worker_channel(
&mut self,
worker_id: &WorkerId,
) -> Option<WorkerChannelBridge>
pub fn remove_worker_channel( &mut self, worker_id: &WorkerId, ) -> Option<WorkerChannelBridge>
Remove a Worker’s channel bridge (e.g., after termination).
@trace REQ-BRW-004 [entity:Worker] [criterion:6]
Sourcepub fn worker_channel(
&self,
worker_id: &WorkerId,
) -> Option<&WorkerChannelBridge>
pub fn worker_channel( &self, worker_id: &WorkerId, ) -> Option<&WorkerChannelBridge>
Get a reference to a Worker’s channel bridge.
@trace REQ-BRW-004 [entity:Worker] [criterion:6]
Sourcepub fn post_to_worker(
&self,
worker_id: &WorkerId,
payload: StructuredClonePayload,
) -> Result<(), String>
pub fn post_to_worker( &self, worker_id: &WorkerId, payload: StructuredClonePayload, ) -> Result<(), String>
Post a structured-clone message to a Worker (DF-WK-4).
Sends the payload through the Worker’s channel bridge. Returns Err if the worker is not found or the channel is closed.
@trace REQ-BRW-004 [entity:Worker] [criterion:6] DF-WK-4
Sourcepub fn drain_all_worker_messages(
&self,
) -> (Vec<WorkerStructuredMessage>, Vec<WorkerId>)
pub fn drain_all_worker_messages( &self, ) -> (Vec<WorkerStructuredMessage>, Vec<WorkerId>)
Drain all pending worker→page messages from all Workers (DF-WK-5).
Called during spin_event_loop to process all queued messages from workers. Each message is forwarded to CDP for observability. Returns all available messages and a set of WorkerIds whose channels are disconnected (worker thread has exited).
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope] [criterion:6] DF-WK-5 @trace REQ-BRW-004 [criterion:18] crash-safe teardown detection
Sourcepub fn drain_and_forward_worker_messages(&self) -> Vec<WorkerId>
pub fn drain_and_forward_worker_messages(&self) -> Vec<WorkerId>
Drain worker→page messages and forward each to CDP (DF-WK-5).
Convenience method combining drain_all_worker_messages with forward_worker_structured_message for each message. Returns the set of WorkerIds whose channels are disconnected.
@trace REQ-BRW-004 [entity:DedicatedWorkerGlobalScope] [criterion:6] DF-WK-5 @trace REQ-BRW-004 [criterion:18] crash-safe teardown detection
Sourcepub fn reap_terminated_worker_channels(&mut self)
pub fn reap_terminated_worker_channels(&mut self)
Remove channel bridges for all terminated Workers.
Called after reap_terminated_workers to clean up channel state for Workers that have fully exited.
@trace REQ-BRW-004 [entity:Worker] [criterion:6]
Sourcepub fn worker_channel_count(&self) -> usize
pub fn worker_channel_count(&self) -> usize
Returns the number of registered Worker channel bridges.
@trace REQ-BRW-004 [entity:Worker] [criterion:6]
Track a SharedWorker port reference for this webview.
DF-WK-7: When a page creates a SharedWorker, the constellation routes to the same worker thread if (url, name) matches. The page receives a MessagePort via the connect event. This method tracks the port reference so it can be disconnected on page unload.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Disconnect all SharedWorker ports on page unload.
Unlike DedicatedWorkers (which are terminated), SharedWorkers survive page unload. Only the per-page MessagePorts are disconnected by dropping the SharedWorkerPortRef (which decrements the connected-pages counter in the SharedWorkerHandle).
Also clears the per-page SharedWorker channel bridges — dropping the channels signals the worker thread that the page has disconnected (DF-WK-7). SharedWorkerGlobalScope states are NOT cleared here — they belong to the global registry in BaoServoDelegate and survive page unload.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Returns the number of active SharedWorker port references.
@trace REQ-BRW-004 [entity:SharedWorker]
Forward a SharedWorker connect event to the CDP event path.
DF-WK-7: When a page connects to a SharedWorker (either creating a new
one or reusing an existing one), the worker fires a connect event.
This method forwards the metadata for CDP observability.
@trace REQ-BRW-004 [entity:SharedWorker] [entity:SharedWorkerGlobalScope] DF-WK-7
Register a SharedWorker channel bridge for this webview.
DF-WK-7: Each SharedWorker gets a channel bridge that aggregates per-page port channels. This method registers the bridge so messages can be drained during spin_event_loop.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Create a new SharedWorker channel bridge and register it.
Convenience method that creates the bridge and registers it. Returns a mutable reference to the bridge for adding ports.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Add a port to an existing SharedWorker channel bridge.
DF-WK-7: When a page connects to a SharedWorker, a new port channel is created. Returns the port endpoints for the worker thread. If no bridge exists for the SharedWorkerId, one is created first.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Get a reference to a SharedWorker channel bridge.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Remove a SharedWorker channel bridge.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Drain all pending SharedWorker→page messages from all SharedWorkers (DF-WK-7).
Called during spin_event_loop to process all queued messages from SharedWorkers across all connected pages. Each message is forwarded to CDP for observability. Returns messages and any disconnected SharedWorkerIds.
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope] DF-WK-7 @trace REQ-BRW-004 [criterion:18] crash-safe teardown detection
Drain SharedWorker messages and forward each to CDP (DF-WK-7).
Returns the set of disconnected SharedWorkerIds.
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope] DF-WK-7 @trace REQ-BRW-004 [criterion:18] crash-safe teardown detection
Post a message to a SharedWorker via a specific port index.
Convenience method combining shared_worker_channel lookup with post_to_worker_from_port.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Clean up SharedWorker channel ports for disconnected workers.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Returns the total number of SharedWorker port channels.
@trace REQ-BRW-004 [entity:SharedWorker]
Register a SharedWorkerGlobalScope state under the given SharedWorkerId.
Called when a SharedWorker is created, populating the scope state for CDP observability and stealth consistency verification (CRIT-STL-WK).
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope]
Get a reference to a SharedWorkerGlobalScope state.
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope]
Get a mutable reference to a SharedWorkerGlobalScope state.
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope]
Remove a SharedWorkerGlobalScope state (called when a SharedWorker is reaped).
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope]
Returns the number of tracked SharedWorkerGlobalScope states.
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope]
Returns a snapshot of all SharedWorkerGlobalScope states.
Used for CDP observability (Runtime domain) and stealth consistency verification (criterion #12-17).
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope]
Look up a SharedWorkerGlobalScope state by the Worker’s script URL (CDP worker targetId — first match when several share a script URL).
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope] [criterion:19]
Set the SharedWorker scope config from the first connecting page’s StealthProfile.
DF-WK-9: SharedWorkerGlobalScope inherits the first connecting page’s StealthProfile and it remains fixed for the worker’s lifetime (per DEC-WK-007).
@trace REQ-BRW-004 [entity:SharedWorkerGlobalScope] [criterion:12..17] DF-WK-9
Sourcepub fn set_controlling_service_worker(&mut self, handle: ServiceWorkerHandle)
pub fn set_controlling_service_worker(&mut self, handle: ServiceWorkerHandle)
Set the controlling ServiceWorker for this webview’s page.
A page can be controlled by at most one ServiceWorker at a time. Per DF-WK-8: When a ServiceWorker becomes activated and its scope matches the page’s URL, it becomes the controller for that page.
@trace REQ-BRW-004 [entity:ServiceWorker] [criterion:19] DF-WK-8
Sourcepub fn clear_controlling_service_worker(&mut self)
pub fn clear_controlling_service_worker(&mut self)
Clear the controlling ServiceWorker reference for this webview.
Called on page unload or when the ServiceWorker is unregistered. Per SPEC criterion #19: “SW 持久生命周期(跨页存活)下 profile 继承注册页 且 terminate 后正确注销” — the ServiceWorker itself survives (tracked in BaoServoDelegate registry), only the per-page reference is cleared.
@trace REQ-BRW-004 [entity:ServiceWorker] [criterion:19]
Sourcepub fn controlling_service_worker(&self) -> Option<&ServiceWorkerHandle>
pub fn controlling_service_worker(&self) -> Option<&ServiceWorkerHandle>
Get a reference to the controlling ServiceWorker, if any.
@trace REQ-BRW-004 [entity:ServiceWorker]
Sourcepub fn is_controlled_by_service_worker(&self) -> bool
pub fn is_controlled_by_service_worker(&self) -> bool
Check if this page is controlled by a ServiceWorker.
@trace REQ-BRW-004 [entity:ServiceWorker]
Sourcepub fn is_url_in_service_worker_scope(&self, url: &str) -> bool
pub fn is_url_in_service_worker_scope(&self, url: &str) -> bool
Check if a URL falls within the controlling ServiceWorker’s scope.
Per DF-WK-8: “scope 匹配的导航/fetch 经 SW 拦截”. Returns false if no ServiceWorker is controlling this page.
@trace REQ-BRW-004 [entity:ServiceWorker] [criterion:19] DF-WK-8
Sourcepub fn register_service_worker_scope(
&mut self,
scope: ServiceWorkerGlobalScopeState,
)
pub fn register_service_worker_scope( &mut self, scope: ServiceWorkerGlobalScopeState, )
Register a ServiceWorkerGlobalScope state for the controlling ServiceWorker.
@trace REQ-BRW-004 [entity:ServiceWorkerGlobalScope] DF-WK-8 / DF-WK-10
Sourcepub fn service_worker_scope(&self) -> Option<&ServiceWorkerGlobalScopeState>
pub fn service_worker_scope(&self) -> Option<&ServiceWorkerGlobalScopeState>
Get a reference to the ServiceWorkerGlobalScope state.
@trace REQ-BRW-004 [entity:ServiceWorkerGlobalScope]
Sourcepub fn service_worker_scope_mut(
&mut self,
) -> Option<&mut ServiceWorkerGlobalScopeState>
pub fn service_worker_scope_mut( &mut self, ) -> Option<&mut ServiceWorkerGlobalScopeState>
Get a mutable reference to the ServiceWorkerGlobalScope state.
@trace REQ-BRW-004 [entity:ServiceWorkerGlobalScope]
Sourcepub fn remove_service_worker_scope(
&mut self,
) -> Option<ServiceWorkerGlobalScopeState>
pub fn remove_service_worker_scope( &mut self, ) -> Option<ServiceWorkerGlobalScopeState>
Remove the ServiceWorkerGlobalScope state.
@trace REQ-BRW-004 [entity:ServiceWorkerGlobalScope]
Sourcepub fn forward_service_worker_fetch_event(&self, event: ServiceWorkerFetchEvent)
pub fn forward_service_worker_fetch_event(&self, event: ServiceWorkerFetchEvent)
Forward a ServiceWorker fetch interception event to the CDP event path.
Per SPEC criterion #19: “CDP Network 域可观测 SW 发起的请求/响应”. When a ServiceWorker intercepts a fetch, this method forwards the metadata for CDP Network domain observability.
@trace REQ-BRW-004 [entity:ServiceWorker] [criterion:19] DF-WK-8
Sourcepub fn set_service_worker_scope_config(
&mut self,
config: &ServiceWorkerScopeConfig,
)
pub fn set_service_worker_scope_config( &mut self, config: &ServiceWorkerScopeConfig, )
Set the ServiceWorker scope config from the registering page’s StealthProfile.
DF-WK-10: ServiceWorkerGlobalScope inherits the registering page’s profile. Per SPEC criterion #19: SW-intercepted fetch uses the same stealth profile.
@trace REQ-BRW-004 [entity:ServiceWorkerGlobalScope] [criterion:19] DF-WK-10
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BaoWebViewState
impl !Sync for BaoWebViewState
impl RefUnwindSafe for BaoWebViewState
impl Send for BaoWebViewState
impl Unpin for BaoWebViewState
impl UnsafeUnpin for BaoWebViewState
impl UnwindSafe for BaoWebViewState
Blanket Implementations§
Source§impl<T> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more