#[repr(C)]pub(crate) struct WorkerGlobalScope {Show 22 fields
globalscope: GlobalScope,
worker_name: DOMString,
worker_type: WorkerType,
worker_id: WorkerId,
worker_url: DomRefCell<ServoUrl>,
closing: Arc<AtomicBool>,
execution_ready: AtomicBool,
runtime: DomRefCell<Option<Runtime>>,
location: MutNullableDom<WorkerLocation>,
navigator: MutNullableDom<WorkerNavigator>,
policy_container: DomRefCell<PolicyContainer>,
_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
devtools_receiver: Option<Receiver<DevtoolScriptControlMsg>>,
navigation_start: CrossProcessInstant,
performance: MutNullableDom<Performance>,
indexeddb: MutNullableDom<IDBFactory>,
trusted_types: MutNullableDom<TrustedTypePolicyFactory>,
timer_scheduler: RefCell<TimerScheduler>,
insecure_requests_policy: InsecureRequestsPolicy,
reporting_observer_list: DomRefCell<Vec<DomRoot<ReportingObserver>>>,
report_list: DomRefCell<Vec<Report>>,
endpoints_list: DomRefCell<Vec<ReportingEndpoint>>,
}Fields§
§globalscope: GlobalScope§worker_name: DOMString§worker_type: WorkerType§worker_id: WorkerId§worker_url: DomRefCell<ServoUrl>§closing: Arc<AtomicBool>§execution_ready: AtomicBool§runtime: DomRefCell<Option<Runtime>>§location: MutNullableDom<WorkerLocation>§policy_container: DomRefCell<PolicyContainer>§_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>A Sender for sending messages to devtools. This is unused but is stored here to
keep the channel alive.
devtools_receiver: Option<Receiver<DevtoolScriptControlMsg>>A Receiver for receiving messages from devtools.
performance: MutNullableDom<Performance>§indexeddb: MutNullableDom<IDBFactory>§trusted_types: MutNullableDom<TrustedTypePolicyFactory>§timer_scheduler: RefCell<TimerScheduler>A TimerScheduler used to schedule timers for this WorkerGlobalScope.
Timers are handled in the service worker event loop.
insecure_requests_policy: InsecureRequestsPolicy§reporting_observer_list: DomRefCell<Vec<DomRoot<ReportingObserver>>>§report_list: DomRefCell<Vec<Report>>§endpoints_list: DomRefCell<Vec<ReportingEndpoint>>Implementations§
Source§impl WorkerGlobalScope
impl WorkerGlobalScope
pub(crate) fn new_inherited( init: WorkerGlobalScopeInit, worker_name: DOMString, worker_type: WorkerType, worker_url: ServoUrl, runtime: Runtime, devtools_receiver: Receiver<DevtoolScriptControlMsg>, closing: Arc<AtomicBool>, gpu_id_hub: Arc<IdentityHub>, insecure_requests_policy: InsecureRequestsPolicy, font_context: Option<Arc<FontContext>>, ) -> Self
Sourcepub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy
pub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy
Returns a policy value that should be used by fetches initiated by this worker.
Sourcepub(crate) fn clear_js_runtime(&self)
pub(crate) fn clear_js_runtime(&self)
Clear various items when the worker event-loop shuts-down.
pub(crate) fn runtime_handle(&self) -> ParentRuntime
pub(crate) fn devtools_receiver( &self, ) -> Option<&Receiver<DevtoolScriptControlMsg>>
pub(crate) fn get_cx(&self) -> JSContext
pub(crate) fn is_closing(&self) -> bool
pub(crate) fn is_execution_ready(&self) -> bool
pub(crate) fn get_url(&self) -> Ref<'_, ServoUrl>
pub(crate) fn set_url(&self, url: ServoUrl)
pub(crate) fn worker_name(&self) -> DOMString
pub(crate) fn worker_id(&self) -> WorkerId
pub(crate) fn pipeline_id(&self) -> PipelineId
pub(crate) fn policy_container(&self) -> Ref<'_, PolicyContainer>
pub(crate) fn set_csp_list(&self, csp_list: Option<CspList>)
pub(crate) fn set_referrer_policy(&self, referrer_policy: ReferrerPolicy)
pub(crate) fn append_reporting_observer( &self, reporting_observer: DomRoot<ReportingObserver>, )
pub(crate) fn remove_reporting_observer( &self, reporting_observer: &ReportingObserver, )
pub(crate) fn registered_reporting_observers( &self, ) -> Vec<DomRoot<ReportingObserver>> ⓘ
pub(crate) fn append_report(&self, report: Report)
pub(crate) fn buffered_reports(&self) -> Vec<Report>
pub(crate) fn set_endpoints_list( &self, endpoints: Option<Vec<ReportingEndpoint>>, )
Sourcepub(crate) fn timer_scheduler(&self) -> RefMut<'_, TimerScheduler>
pub(crate) fn timer_scheduler(&self) -> RefMut<'_, TimerScheduler>
Get a mutable reference to the TimerScheduler for this [ServiceWorkerGlobalScope].
Return a copy to the shared task canceller that is used to cancel all tasks when this worker is closing.
Sourcefn initialize_policy_container_for_worker_global_scope(
&self,
metadata: &Metadata,
parent_policy_container: &PolicyContainer,
)
fn initialize_policy_container_for_worker_global_scope( &self, metadata: &Metadata, parent_policy_container: &PolicyContainer, )
Sourcefn on_complete(
&self,
script: Option<Cow<'_, str>>,
worker: Trusted<Worker>,
can_gc: CanGc,
)
fn on_complete( &self, script: Option<Cow<'_, str>>, worker: Trusted<Worker>, can_gc: CanGc, )
onComplete algorithm defined inside https://html.spec.whatwg.org/multipage/#run-a-worker
Source§impl WorkerGlobalScope
impl WorkerGlobalScope
pub(crate) fn execute_script(&self, source: DOMString, can_gc: CanGc)
pub(crate) fn new_script_pair( &self, ) -> (ScriptEventLoopSender, ScriptEventLoopReceiver)
Sourcepub(crate) fn process_event(&self, msg: CommonScriptMsg) -> bool
pub(crate) fn process_event(&self, msg: CommonScriptMsg) -> bool
Process a single event as if it were the next event in the queue for this worker event-loop. Returns a boolean indicating whether further events should be processed.
pub(crate) fn close(&self)
Trait Implementations§
§impl Castable for WorkerGlobalScope
impl Castable for WorkerGlobalScope
Source§impl DomObject for WorkerGlobalScope
impl DomObject for WorkerGlobalScope
Source§impl HasParent for WorkerGlobalScope
impl HasParent for WorkerGlobalScope
Source§fn as_parent(&self) -> &GlobalScope
fn as_parent(&self) -> &GlobalScope
This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is
type Parent = GlobalScope
Source§impl IDLInterface for WorkerGlobalScope
impl IDLInterface for WorkerGlobalScope
Source§impl MallocSizeOf for WorkerGlobalScope
impl MallocSizeOf for WorkerGlobalScope
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for WorkerGlobalScope
impl MutDomObject for WorkerGlobalScope
Source§impl PartialEq for WorkerGlobalScope
impl PartialEq for WorkerGlobalScope
Source§impl Traceable for WorkerGlobalScope
impl Traceable for WorkerGlobalScope
Source§impl WorkerGlobalScopeMethods<DomTypeHolder> for WorkerGlobalScope
impl WorkerGlobalScopeMethods<DomTypeHolder> for WorkerGlobalScope
Source§fn Self_(&self) -> DomRoot<WorkerGlobalScope>
fn Self_(&self) -> DomRoot<WorkerGlobalScope>
Source§fn Location(&self) -> DomRoot<WorkerLocation>
fn Location(&self) -> DomRoot<WorkerLocation>
Source§fn ImportScripts(
&self,
url_strings: Vec<TrustedScriptURLOrUSVString<DomTypeHolder>>,
can_gc: CanGc,
) -> ErrorResult
fn ImportScripts( &self, url_strings: Vec<TrustedScriptURLOrUSVString<DomTypeHolder>>, can_gc: CanGc, ) -> ErrorResult
Source§fn SetTimeout(
&self,
_cx: JSContext,
callback: TrustedScriptOrStringOrFunction<DomTypeHolder>,
timeout: i32,
args: Vec<HandleValue<'_>>,
can_gc: CanGc,
) -> Fallible<i32>
fn SetTimeout( &self, _cx: JSContext, callback: TrustedScriptOrStringOrFunction<DomTypeHolder>, timeout: i32, args: Vec<HandleValue<'_>>, can_gc: CanGc, ) -> Fallible<i32>
Source§fn ClearTimeout(&self, handle: i32)
fn ClearTimeout(&self, handle: i32)
Source§fn SetInterval(
&self,
_cx: JSContext,
callback: TrustedScriptOrStringOrFunction<DomTypeHolder>,
timeout: i32,
args: Vec<HandleValue<'_>>,
can_gc: CanGc,
) -> Fallible<i32>
fn SetInterval( &self, _cx: JSContext, callback: TrustedScriptOrStringOrFunction<DomTypeHolder>, timeout: i32, args: Vec<HandleValue<'_>>, can_gc: CanGc, ) -> Fallible<i32>
Source§fn ClearInterval(&self, handle: i32)
fn ClearInterval(&self, handle: i32)
Source§fn QueueMicrotask(&self, callback: Rc<VoidFunction<DomTypeHolder>>)
fn QueueMicrotask(&self, callback: Rc<VoidFunction<DomTypeHolder>>)
Source§fn CreateImageBitmap(
&self,
image: ImageBitmapSource<DomTypeHolder>,
options: &ImageBitmapOptions,
can_gc: CanGc,
) -> Rc<Promise>
fn CreateImageBitmap( &self, image: ImageBitmapSource<DomTypeHolder>, options: &ImageBitmapOptions, can_gc: CanGc, ) -> Rc<Promise>
Source§fn CreateImageBitmap_(
&self,
image: ImageBitmapSource<DomTypeHolder>,
sx: i32,
sy: i32,
sw: i32,
sh: i32,
options: &ImageBitmapOptions,
can_gc: CanGc,
) -> Rc<Promise>
fn CreateImageBitmap_( &self, image: ImageBitmapSource<DomTypeHolder>, sx: i32, sy: i32, sw: i32, sh: i32, options: &ImageBitmapOptions, can_gc: CanGc, ) -> Rc<Promise>
Source§fn Fetch(
&self,
input: RequestOrUSVString<DomTypeHolder>,
init: RootedTraceableBox<RequestInit<DomTypeHolder>>,
comp: InRealm<'_>,
can_gc: CanGc,
) -> Rc<Promise>
fn Fetch( &self, input: RequestOrUSVString<DomTypeHolder>, init: RootedTraceableBox<RequestInit<DomTypeHolder>>, comp: InRealm<'_>, can_gc: CanGc, ) -> Rc<Promise>
Source§fn Performance(&self) -> DomRoot<Performance>
fn Performance(&self) -> DomRoot<Performance>
Source§fn IsSecureContext(&self) -> bool
fn IsSecureContext(&self) -> bool
Source§fn StructuredClone(
&self,
cx: JSContext,
value: HandleValue<'_>,
options: RootedTraceableBox<StructuredSerializeOptions>,
can_gc: CanGc,
retval: MutableHandleValue<'_>,
) -> Fallible<()>
fn StructuredClone( &self, cx: JSContext, value: HandleValue<'_>, options: RootedTraceableBox<StructuredSerializeOptions>, can_gc: CanGc, retval: MutableHandleValue<'_>, ) -> Fallible<()>
Source§fn TrustedTypes(&self, can_gc: CanGc) -> DomRoot<TrustedTypePolicyFactory>
fn TrustedTypes(&self, can_gc: CanGc) -> DomRoot<TrustedTypePolicyFactory>
fn GetOnerror(&self) -> Option<Rc<OnErrorEventHandlerNonNull<DomTypeHolder>>>
fn SetOnerror( &self, listener: Option<Rc<OnErrorEventHandlerNonNull<DomTypeHolder>>>, )
fn GetOnlanguagechange(&self) -> Option<Rc<EventHandlerNonNull<DomTypeHolder>>>
fn SetOnlanguagechange( &self, listener: Option<Rc<EventHandlerNonNull<DomTypeHolder>>>, )
fn GetOnoffline(&self) -> Option<Rc<EventHandlerNonNull<DomTypeHolder>>>
fn SetOnoffline(&self, listener: Option<Rc<EventHandlerNonNull<DomTypeHolder>>>)
fn GetOnonline(&self) -> Option<Rc<EventHandlerNonNull<DomTypeHolder>>>
fn SetOnonline(&self, listener: Option<Rc<EventHandlerNonNull<DomTypeHolder>>>)
fn GetOnrejectionhandled( &self, ) -> Option<Rc<EventHandlerNonNull<DomTypeHolder>>>
fn SetOnrejectionhandled( &self, listener: Option<Rc<EventHandlerNonNull<DomTypeHolder>>>, )
fn GetOnunhandledrejection( &self, ) -> Option<Rc<EventHandlerNonNull<DomTypeHolder>>>
fn SetOnunhandledrejection( &self, listener: Option<Rc<EventHandlerNonNull<DomTypeHolder>>>, )
impl DerivedFrom<EventTarget> for WorkerGlobalScope
impl DerivedFrom<GlobalScope> for WorkerGlobalScope
impl DerivedFrom<WorkerGlobalScope> for DedicatedWorkerGlobalScope
impl DerivedFrom<WorkerGlobalScope> for ServiceWorkerGlobalScope
impl DerivedFrom<WorkerGlobalScope> for WorkerGlobalScope
impl Eq for WorkerGlobalScope
Auto Trait Implementations§
impl !Freeze for WorkerGlobalScope
impl !RefUnwindSafe for WorkerGlobalScope
impl !Send for WorkerGlobalScope
impl !Sync for WorkerGlobalScope
impl Unpin for WorkerGlobalScope
impl !UnwindSafe for WorkerGlobalScope
Blanket Implementations§
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
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
GlobalScope] of the realm that the DomObject was created in. If this
object is a Node, this will be different from it’s owning Document if adopted by. For
Nodes it’s almost always better to use NodeTraits::owning_global.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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