pub struct ServiceWorkerScopeConfig {
pub stealth_profile: Option<StealthProfile>,
pub user_agent: String,
pub platform: String,
pub hardware_concurrency: usize,
pub language: String,
pub languages: Vec<String>,
pub registering_page_url: String,
}Expand description
Configuration for initializing a ServiceWorker’s ServiceWorkerGlobalScope with stealth-consistent properties from the registering page.
DF-WK-10: “ServiceWorkerGlobalScope 首次解析 stealth getter → 按 D7 机制从 bao-stealth REALM_PROFILES 继承注册页 profile” SPEC criterion #19: “SW 持久生命周期(跨页存活)下 profile 继承注册页且 terminate 后正确注销”
Unlike DedicatedWorker (one parent page) and SharedWorker (first connecting page), ServiceWorker inherits from the REGISTERING page — the page that called navigator.serviceWorker.register(url, {scope}). The profile is fixed for the ServiceWorker’s lifetime (per DEC-WK-007).
@trace REQ-BRW-004 [entity:ServiceWorkerGlobalScope] [criterion:19] DF-WK-10
Fields§
§stealth_profile: Option<StealthProfile>The StealthProfile to apply in the ServiceWorker’s global scope. Set from the registering page’s profile and fixed for lifetime. Per SPEC criterion #19: SW-intercepted fetch uses the same stealth profile. @trace REQ-BRW-004 [criterion:19] CRIT-STL-WK ServiceWorker stealth boundary
user_agent: StringNavigator userAgent — must match registering page’s value. @trace REQ-BRW-004 [entity:WorkerNavigator] [criterion:12]
platform: StringNavigator platform — must match registering page’s value. @trace REQ-BRW-004 [entity:WorkerNavigator] [criterion:12]
hardware_concurrency: usizeNavigator hardwareConcurrency — must match registering page’s value. @trace REQ-BRW-004 [entity:WorkerNavigator] [criterion:12]
language: StringNavigator language — must match registering page’s value. @trace REQ-BRW-004 [entity:WorkerNavigator] [criterion:12]
languages: Vec<String>Navigator languages — must match registering page’s value. @trace REQ-BRW-004 [entity:WorkerNavigator] [criterion:12]
registering_page_url: StringThe registering page’s URL — used for CDP observability and profile inheritance tracking. @trace REQ-BRW-004 [entity:ServiceWorker] DF-WK-10
Trait Implementations§
Source§impl Clone for ServiceWorkerScopeConfig
impl Clone for ServiceWorkerScopeConfig
Source§fn clone(&self) -> ServiceWorkerScopeConfig
fn clone(&self) -> ServiceWorkerScopeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServiceWorkerScopeConfig
impl Debug for ServiceWorkerScopeConfig
Source§impl Default for ServiceWorkerScopeConfig
impl Default for ServiceWorkerScopeConfig
Source§impl From<&StealthProfile> for ServiceWorkerScopeConfig
impl From<&StealthProfile> for ServiceWorkerScopeConfig
Source§fn from(profile: &StealthProfile) -> Self
fn from(profile: &StealthProfile) -> Self
Convert a StealthProfile into a ServiceWorkerScopeConfig for Service Worker inheritance.
DF-WK-10: ServiceWorkerGlobalScope inherits the registering page’s profile. Per SPEC criterion #19: SW-intercepted fetch must use the same stealth profile. @trace REQ-BRW-004 [entity:ServiceWorkerGlobalScope] [criterion:19] DF-WK-10
Auto Trait Implementations§
impl !Freeze for ServiceWorkerScopeConfig
impl RefUnwindSafe for ServiceWorkerScopeConfig
impl Send for ServiceWorkerScopeConfig
impl Sync for ServiceWorkerScopeConfig
impl Unpin for ServiceWorkerScopeConfig
impl UnsafeUnpin for ServiceWorkerScopeConfig
impl UnwindSafe for ServiceWorkerScopeConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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