#[repr(C)]pub(crate) struct GlobalScope {Show 40 fields
eventtarget: EventTarget,
crypto: MutNullableDom<Crypto>,
task_manager: OnceCell<TaskManager>,
message_port_state: DomRefCell<MessagePortState>,
broadcast_channel_state: DomRefCell<BroadcastChannelState>,
blob_state: DomRefCell<HashMapTracedValues<BlobId, BlobInfo>>,
registration_map: DomRefCell<HashMapTracedValues<ServiceWorkerRegistrationId, Dom<ServiceWorkerRegistration>>>,
worker_map: DomRefCell<HashMapTracedValues<ServiceWorkerId, Dom<ServiceWorker>>>,
pipeline_id: PipelineId,
devtools_wants_updates: Cell<bool>,
console_timers: DomRefCell<HashMap<DOMString, Instant>>,
module_map: DomRefCell<HashMapTracedValues<ServoUrl, Rc<ModuleTree>>>,
inline_module_map: DomRefCell<HashMap<ScriptId, Rc<ModuleTree>>>,
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
mem_profiler_chan: ProfilerChan,
time_profiler_chan: ProfilerChan,
script_to_constellation_chan: ScriptToConstellationChan,
in_error_reporting_mode: Cell<bool>,
resource_threads: ResourceThreads,
timers: OnceCell<OneshotTimers>,
origin: MutableOrigin,
creation_url: Option<ServoUrl>,
permission_state_invocation_results: DomRefCell<HashMap<PermissionName, PermissionState>>,
microtask_queue: Rc<MicrotaskQueue>,
list_auto_close_worker: DomRefCell<Vec<AutoCloseWorker>>,
event_source_tracker: DOMTracker<EventSource>,
uncaught_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>,
consumed_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>,
user_agent: Cow<'static, str>,
gpu_id_hub: Arc<IdentityHub>,
gpu_devices: DomRefCell<HashMapTracedValues<WebGPUDevice, WeakRef<GPUDevice>>>,
frozen_supported_performance_entry_types: CachedFrozenArray,
https_state: Cell<HttpsState>,
console_group_stack: DomRefCell<Vec<DOMString>>,
console_count_map: DomRefCell<HashMap<DOMString, usize>>,
dynamic_modules: DomRefCell<DynamicModuleList>,
inherited_secure_context: Option<bool>,
unminified_js_dir: Option<String>,
byte_length_queuing_strategy_size_function: OnceCell<Rc<Function>>,
count_queuing_strategy_size_function: OnceCell<Rc<Function>>,
}
Fields§
§eventtarget: EventTarget
§crypto: MutNullableDom<Crypto>
§task_manager: OnceCell<TaskManager>
A TaskManager
for this GlobalScope
.
message_port_state: DomRefCell<MessagePortState>
The message-port router id for this global, if it is managing ports.
broadcast_channel_state: DomRefCell<BroadcastChannelState>
The broadcast channels state this global, if it is managing any.
blob_state: DomRefCell<HashMapTracedValues<BlobId, BlobInfo>>
The blobs managed by this global, if any.
registration_map: DomRefCell<HashMapTracedValues<ServiceWorkerRegistrationId, Dom<ServiceWorkerRegistration>>>
§worker_map: DomRefCell<HashMapTracedValues<ServiceWorkerId, Dom<ServiceWorker>>>
§pipeline_id: PipelineId
Pipeline id associated with this global.
devtools_wants_updates: Cell<bool>
A flag to indicate whether the developer tools has requested live updates from the worker.
console_timers: DomRefCell<HashMap<DOMString, Instant>>
Timers (milliseconds) used by the Console API.
module_map: DomRefCell<HashMapTracedValues<ServoUrl, Rc<ModuleTree>>>
module map is used when importing JavaScript modules https://html.spec.whatwg.org/multipage/#concept-settings-object-module-map
inline_module_map: DomRefCell<HashMap<ScriptId, Rc<ModuleTree>>>
§devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>
For providing instructions to an optional devtools server.
mem_profiler_chan: ProfilerChan
For sending messages to the memory profiler.
time_profiler_chan: ProfilerChan
For sending messages to the time profiler.
script_to_constellation_chan: ScriptToConstellationChan
A handle for communicating messages to the constellation thread.
in_error_reporting_mode: Cell<bool>
§resource_threads: ResourceThreads
Associated resource threads for use by DOM objects like XMLHttpRequest, including resource_thread, filemanager_thread and storage_thread
timers: OnceCell<OneshotTimers>
The mechanism by which time-outs and intervals are scheduled. https://html.spec.whatwg.org/multipage/#timers
origin: MutableOrigin
The origin of the globalscope
creation_url: Option<ServoUrl>
§permission_state_invocation_results: DomRefCell<HashMap<PermissionName, PermissionState>>
A map for storing the previous permission state read results.
microtask_queue: Rc<MicrotaskQueue>
The microtask queue associated with this global.
It is refcounted because windows in the same script thread share the same microtask queue.
list_auto_close_worker: DomRefCell<Vec<AutoCloseWorker>>
Vector storing closing references of all workers
event_source_tracker: DOMTracker<EventSource>
Vector storing references of all eventsources.
uncaught_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>
Storage for watching rejected promises waiting for some client to consume their rejection. Promises in this list have been rejected in the last turn of the event loop without the rejection being handled. Note that this can contain nullptrs in place of promises removed because they’re consumed before it’d be reported.
https://html.spec.whatwg.org/multipage/#about-to-be-notified-rejected-promises-list
consumed_rejections: DomRefCell<Vec<Box<Heap<*mut JSObject>>>>
Promises in this list have previously been reported as rejected (because they were in the above list), but the rejection was handled in the last turn of the event loop.
https://html.spec.whatwg.org/multipage/#outstanding-rejected-promises-weak-set
user_agent: Cow<'static, str>
An optional string allowing the user agent to be set for testing.
gpu_id_hub: Arc<IdentityHub>
Identity Manager for WebGPU resources
gpu_devices: DomRefCell<HashMapTracedValues<WebGPUDevice, WeakRef<GPUDevice>>>
WebGPU devices
frozen_supported_performance_entry_types: CachedFrozenArray
§https_state: Cell<HttpsState>
currect https state (from previous request)
console_group_stack: DomRefCell<Vec<DOMString>>
The stack of active group labels for the Console APIs.
console_count_map: DomRefCell<HashMap<DOMString, usize>>
The count map for the Console APIs.
dynamic_modules: DomRefCell<DynamicModuleList>
List of ongoing dynamic module imports.
inherited_secure_context: Option<bool>
Is considered in a secure context
unminified_js_dir: Option<String>
Directory to store unminified scripts for this window if unminify-js opt is enabled.
byte_length_queuing_strategy_size_function: OnceCell<Rc<Function>>
The byte length queuing strategy size function that will be initialized once
size
getter of ByteLengthQueuingStrategy
is called.
https://streams.spec.whatwg.org/#byte-length-queuing-strategy-size-function
count_queuing_strategy_size_function: OnceCell<Rc<Function>>
The count queuing strategy size function that will be initialized once
size
getter of CountQueuingStrategy
is called.
https://streams.spec.whatwg.org/#count-queuing-strategy-size-function
Implementations§
source§impl GlobalScope
impl GlobalScope
sourcepub(crate) fn webview_id(&self) -> Option<WebViewId>
pub(crate) fn webview_id(&self) -> Option<WebViewId>
A sender to the event loop of this global scope. This either sends to the Worker event loop
or the ScriptThread event loop in the case of a Window
. This can be None
for dedicated
workers that are not currently handling a message.
pub(crate) fn new_inherited( pipeline_id: PipelineId, devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>, mem_profiler_chan: ProfilerChan, time_profiler_chan: ProfilerChan, script_to_constellation_chan: ScriptToConstellationChan, resource_threads: ResourceThreads, origin: MutableOrigin, creation_url: Option<ServoUrl>, microtask_queue: Rc<MicrotaskQueue>, user_agent: Cow<'static, str>, gpu_id_hub: Arc<IdentityHub>, inherited_secure_context: Option<bool>, unminify_js: bool, ) -> Self
sourcefn port_router_id(&self) -> Option<MessagePortRouterId>
fn port_router_id(&self) -> Option<MessagePortRouterId>
The message-port router Id of the global, if any
sourcefn is_managing_port(&self, port_id: &MessagePortId) -> bool
fn is_managing_port(&self, port_id: &MessagePortId) -> bool
Is this global managing a given port?
fn timers(&self) -> &OneshotTimers
sourcepub(crate) fn get_serviceworker_registration(
&self,
script_url: &ServoUrl,
scope: &ServoUrl,
registration_id: ServiceWorkerRegistrationId,
installing_worker: Option<ServiceWorkerId>,
_waiting_worker: Option<ServiceWorkerId>,
_active_worker: Option<ServiceWorkerId>,
) -> Root<Dom<ServiceWorkerRegistration>>
pub(crate) fn get_serviceworker_registration( &self, script_url: &ServoUrl, scope: &ServoUrl, registration_id: ServiceWorkerRegistrationId, installing_worker: Option<ServiceWorkerId>, _waiting_worker: Option<ServiceWorkerId>, _active_worker: Option<ServiceWorkerId>, ) -> Root<Dom<ServiceWorkerRegistration>>
sourcepub(crate) fn get_serviceworker(
&self,
script_url: &ServoUrl,
scope: &ServoUrl,
worker_id: ServiceWorkerId,
) -> Root<Dom<ServiceWorker>>
pub(crate) fn get_serviceworker( &self, script_url: &ServoUrl, scope: &ServoUrl, worker_id: ServiceWorkerId, ) -> Root<Dom<ServiceWorker>>
sourcefn complete_port_transfer(
&self,
port_id: MessagePortId,
tasks: VecDeque<PortMessageTask>,
)
fn complete_port_transfer( &self, port_id: MessagePortId, tasks: VecDeque<PortMessageTask>, )
Complete the transfer of a message-port.
sourcepub(crate) fn perform_a_dom_garbage_collection_checkpoint(&self)
pub(crate) fn perform_a_dom_garbage_collection_checkpoint(&self)
Clean-up DOM related resources
sourcepub(crate) fn remove_web_messaging_and_dedicated_workers_infra(&self)
pub(crate) fn remove_web_messaging_and_dedicated_workers_infra(&self)
Remove the routers for ports and broadcast-channels. Drain the list of workers.
sourcefn remove_message_ports_router(&self)
fn remove_message_ports_router(&self)
Update our state to un-managed, and tell the constellation to drop the sender to our message-port router.
sourcefn remove_broadcast_channel_router(&self)
fn remove_broadcast_channel_router(&self)
Update our state to un-managed, and tell the constellation to drop the sender to our broadcast router.
sourcepub(crate) fn entangle_ports(&self, port1: MessagePortId, port2: MessagePortId)
pub(crate) fn entangle_ports(&self, port1: MessagePortId, port2: MessagePortId)
sourcepub(crate) fn note_entangled_port_removed(&self, port_id: &MessagePortId)
pub(crate) fn note_entangled_port_removed(&self, port_id: &MessagePortId)
Note that the entangled port of port_id
has been removed in another global.
sourcepub(crate) fn mark_port_as_transferred(
&self,
port_id: &MessagePortId,
) -> MessagePortImpl
pub(crate) fn mark_port_as_transferred( &self, port_id: &MessagePortId, ) -> MessagePortImpl
Handle the transfer of a port in the current task.
sourcepub(crate) fn start_message_port(&self, port_id: &MessagePortId)
pub(crate) fn start_message_port(&self, port_id: &MessagePortId)
sourcepub(crate) fn close_message_port(&self, port_id: &MessagePortId)
pub(crate) fn close_message_port(&self, port_id: &MessagePortId)
sourcepub(crate) fn post_messageport_msg(
&self,
port_id: MessagePortId,
task: PortMessageTask,
)
pub(crate) fn post_messageport_msg( &self, port_id: MessagePortId, task: PortMessageTask, )
sourcefn re_route_port_task(&self, port_id: MessagePortId, task: PortMessageTask)
fn re_route_port_task(&self, port_id: MessagePortId, task: PortMessageTask)
If we don’t know about the port, send the message to the constellation for routing.
sourcepub(crate) fn schedule_broadcast(&self, msg: BroadcastMsg, channel_id: &Uuid)
pub(crate) fn schedule_broadcast(&self, msg: BroadcastMsg, channel_id: &Uuid)
https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage Step 7 and following steps.
sourcepub(crate) fn broadcast_message_event(
&self,
event: BroadcastMsg,
channel_id: Option<&Uuid>,
)
pub(crate) fn broadcast_message_event( &self, event: BroadcastMsg, channel_id: Option<&Uuid>, )
https://html.spec.whatwg.org/multipage/#dom-broadcastchannel-postmessage Step 7 and following steps.
sourcepub(crate) fn route_task_to_port(
&self,
port_id: MessagePortId,
task: PortMessageTask,
can_gc: CanGc,
)
pub(crate) fn route_task_to_port( &self, port_id: MessagePortId, task: PortMessageTask, can_gc: CanGc, )
Route the task to be handled by the relevant port.
sourcepub(crate) fn maybe_add_pending_ports(&self)
pub(crate) fn maybe_add_pending_ports(&self)
Check all ports that have been transfer-received in the previous task, and complete their transfer if they haven’t been re-transferred.
sourcepub(crate) fn perform_a_message_port_garbage_collection_checkpoint(&self)
pub(crate) fn perform_a_message_port_garbage_collection_checkpoint(&self)
sourcepub(crate) fn perform_a_broadcast_channel_garbage_collection_checkpoint(&self)
pub(crate) fn perform_a_broadcast_channel_garbage_collection_checkpoint(&self)
Remove broadcast-channels that are closed. TODO: Also remove them if they do not have an event-listener. see https://github.com/servo/servo/issues/25772
sourcepub(crate) fn track_broadcast_channel(&self, dom_channel: &BroadcastChannel)
pub(crate) fn track_broadcast_channel(&self, dom_channel: &BroadcastChannel)
Start tracking a broadcast-channel.
sourcepub(crate) fn track_message_port(
&self,
dom_port: &MessagePort,
port_impl: Option<MessagePortImpl>,
)
pub(crate) fn track_message_port( &self, dom_port: &MessagePort, port_impl: Option<MessagePortImpl>, )
Start tracking a message-port
sourcepub(crate) fn serialize_blob(&self, blob_id: &BlobId) -> BlobImpl
pub(crate) fn serialize_blob(&self, blob_id: &BlobId) -> BlobImpl
https://html.spec.whatwg.org/multipage/#serialization-steps defined at https://w3c.github.io/FileAPI/#blob-section. Get the snapshot state and underlying bytes of the blob.
fn track_blob_info(&self, blob_info: BlobInfo, blob_id: BlobId)
sourcepub(crate) fn track_blob(&self, dom_blob: &Blob, blob_impl: BlobImpl)
pub(crate) fn track_blob(&self, dom_blob: &Blob, blob_impl: BlobImpl)
Start tracking a blob
sourcepub(crate) fn track_file(&self, file: &File, blob_impl: BlobImpl)
pub(crate) fn track_file(&self, file: &File, blob_impl: BlobImpl)
Start tracking a file
sourcefn perform_a_blob_garbage_collection_checkpoint(&self)
fn perform_a_blob_garbage_collection_checkpoint(&self)
Clean-up any file or blob that is unreachable from script, unless it has an oustanding blob url. https://w3c.github.io/FileAPI/#lifeTime
sourcepub(crate) fn clean_up_all_file_resources(&self)
pub(crate) fn clean_up_all_file_resources(&self)
Clean-up all file related resources on document unload. https://w3c.github.io/FileAPI/#lifeTime
fn decrement_file_ref(&self, id: Uuid)
sourcepub(crate) fn get_blob_bytes(&self, blob_id: &BlobId) -> Result<Vec<u8>, ()>
pub(crate) fn get_blob_bytes(&self, blob_id: &BlobId) -> Result<Vec<u8>, ()>
Get a slice to the inner data of a Blob, In the case of a File-backed blob, this might incur synchronous read and caching.
sourcefn get_blob_bytes_non_sliced(&self, blob_id: &BlobId) -> Result<Vec<u8>, ()>
fn get_blob_bytes_non_sliced(&self, blob_id: &BlobId) -> Result<Vec<u8>, ()>
Get bytes from a non-sliced blob
sourcefn get_blob_bytes_or_file_id(&self, blob_id: &BlobId) -> BlobResult
fn get_blob_bytes_or_file_id(&self, blob_id: &BlobId) -> BlobResult
Get a slice to the inner data of a Blob, if it’s a memory blob, or it’s file-id and file-size otherwise.
Note: this is almost a duplicate of get_blob_bytes
,
tweaked for integration with streams.
TODO: merge with get_blob_bytes
by way of broader integration with blob streams.
sourcefn get_blob_bytes_non_sliced_or_file_id(&self, blob_id: &BlobId) -> BlobResult
fn get_blob_bytes_non_sliced_or_file_id(&self, blob_id: &BlobId) -> BlobResult
Get bytes from a non-sliced blob if in memory, or it’s file-id and file-size.
Note: this is almost a duplicate of get_blob_bytes_non_sliced
,
tweaked for integration with streams.
TODO: merge with get_blob_bytes
by way of broader integration with blob streams.
sourcepub(crate) fn get_blob_type_string(&self, blob_id: &BlobId) -> String
pub(crate) fn get_blob_type_string(&self, blob_id: &BlobId) -> String
Get a copy of the type_string of a blob.
sourcepub(crate) fn get_blob_size(&self, blob_id: &BlobId) -> u64
pub(crate) fn get_blob_size(&self, blob_id: &BlobId) -> u64
pub(crate) fn get_blob_url_id(&self, blob_id: &BlobId) -> Uuid
sourcefn create_sliced_url_id(
&self,
blob_info: &mut BlobInfo,
parent_file_id: &Uuid,
rel_pos: &RelativePos,
parent_len: u64,
) -> Uuid
fn create_sliced_url_id( &self, blob_info: &mut BlobInfo, parent_file_id: &Uuid, rel_pos: &RelativePos, parent_len: u64, ) -> Uuid
Get a FileID representing sliced parent-blob content
sourcepub(crate) fn promote(&self, blob_info: &mut BlobInfo, set_valid: bool) -> Uuid
pub(crate) fn promote(&self, blob_info: &mut BlobInfo, set_valid: bool) -> Uuid
Promote non-Slice blob:
- Memory-based: The bytes in data slice will be transferred to file manager thread.
- File-based: If set_valid, then activate the FileID so it can serve as URL Depending on set_valid, the returned FileID can be part of valid or invalid Blob URL.
fn send_to_file_manager(&self, msg: FileManagerThreadMsg)
fn read_file(&self, id: Uuid) -> Result<Vec<u8>, ()>
sourcepub(crate) fn get_blob_stream(
&self,
blob_id: &BlobId,
can_gc: CanGc,
) -> Result<Root<Dom<ReadableStream>>, Error>
pub(crate) fn get_blob_stream( &self, blob_id: &BlobId, can_gc: CanGc, ) -> Result<Root<Dom<ReadableStream>>, Error>
pub(crate) fn read_file_async( &self, id: Uuid, promise: Rc<Promise>, callback: Box<dyn Fn(Rc<Promise>, Result<Vec<u8>, Error>) + Send>, )
fn send_msg(&self, id: Uuid) -> IpcReceiver<FileManagerResult<ReadFileProgress>>
fn read_msg( receiver: IpcReceiver<FileManagerResult<ReadFileProgress>>, ) -> Result<Vec<u8>, ()>
pub(crate) fn permission_state_invocation_results( &self, ) -> &DomRefCell<HashMap<PermissionName, PermissionState>>
pub(crate) fn track_worker( &self, closing: Arc<AtomicBool>, join_handle: JoinHandle<()>, control_sender: Sender<DedicatedWorkerControlMsg>, context: ThreadSafeJSContext, )
pub(crate) fn track_event_source(&self, event_source: &EventSource)
pub(crate) fn close_event_sources(&self) -> bool
sourcepub(crate) fn from_reflector<T: DomObject>(
reflector: &T,
_realm: &AlreadyInRealm,
) -> Root<Dom<Self>>
pub(crate) fn from_reflector<T: DomObject>( reflector: &T, _realm: &AlreadyInRealm, ) -> Root<Dom<Self>>
Returns the global scope of the realm that the given DOM object’s reflector was created in.
sourcepub(crate) unsafe fn from_object(obj: *mut JSObject) -> Root<Dom<Self>>
pub(crate) unsafe fn from_object(obj: *mut JSObject) -> Root<Dom<Self>>
Returns the global scope of the realm that the given JS object was created in.
sourcepub(crate) unsafe fn from_context(
cx: *mut JSContext,
_realm: InRealm<'_>,
) -> Root<Dom<Self>>
pub(crate) unsafe fn from_context( cx: *mut JSContext, _realm: InRealm<'_>, ) -> Root<Dom<Self>>
Returns the global scope for the given JSContext
sourcepub(crate) fn from_safe_context(
cx: SafeJSContext,
realm: InRealm<'_>,
) -> Root<Dom<Self>>
pub(crate) fn from_safe_context( cx: SafeJSContext, realm: InRealm<'_>, ) -> Root<Dom<Self>>
Returns the global scope for the given SafeJSContext
sourcepub(crate) unsafe fn from_object_maybe_wrapped(
obj: *mut JSObject,
cx: *mut JSContext,
) -> Root<Dom<Self>>
pub(crate) unsafe fn from_object_maybe_wrapped( obj: *mut JSObject, cx: *mut JSContext, ) -> Root<Dom<Self>>
Returns the global object of the realm that the given JS object was created in, after unwrapping any wrappers.
pub(crate) fn add_uncaught_rejection(&self, rejection: HandleObject)
pub(crate) fn remove_uncaught_rejection(&self, rejection: HandleObject)
pub(crate) fn get_uncaught_rejections( &self, ) -> &DomRefCell<Vec<Box<Heap<*mut JSObject>>>>
pub(crate) fn add_consumed_rejection(&self, rejection: HandleObject)
pub(crate) fn remove_consumed_rejection(&self, rejection: HandleObject)
pub(crate) fn get_consumed_rejections( &self, ) -> &DomRefCell<Vec<Box<Heap<*mut JSObject>>>>
pub(crate) fn set_module_map(&self, url: ServoUrl, module: ModuleTree)
pub(crate) fn get_module_map( &self, ) -> &DomRefCell<HashMapTracedValues<ServoUrl, Rc<ModuleTree>>>
pub(crate) fn set_inline_module_map( &self, script_id: ScriptId, module: ModuleTree, )
pub(crate) fn get_inline_module_map( &self, ) -> &DomRefCell<HashMap<ScriptId, Rc<ModuleTree>>>
pub(crate) fn get_cx() -> SafeJSContext
pub(crate) fn crypto(&self) -> Root<Dom<Crypto>>
pub(crate) fn live_devtools_updates(&self) -> bool
pub(crate) fn set_devtools_wants_updates(&self, value: bool)
pub(crate) fn time(&self, label: DOMString) -> Result<(), ()>
sourcepub(crate) fn time_log(&self, label: &str) -> Result<u64, ()>
pub(crate) fn time_log(&self, label: &str) -> Result<u64, ()>
Computes the delta time since a label has been created
Returns an error if the label does not exist.
sourcepub(crate) fn time_end(&self, label: &str) -> Result<u64, ()>
pub(crate) fn time_end(&self, label: &str) -> Result<u64, ()>
Computes the delta time since a label has been created and stops tracking the label.
Returns an error if the label does not exist.
sourcepub(crate) fn devtools_chan(
&self,
) -> Option<&IpcSender<ScriptToDevtoolsControlMsg>>
pub(crate) fn devtools_chan( &self, ) -> Option<&IpcSender<ScriptToDevtoolsControlMsg>>
Get an &IpcSender<ScriptToDevtoolsControlMsg>
to send messages
to the devtools thread when available.
pub(crate) fn issue_page_warning(&self, warning: &str)
sourcepub(crate) fn mem_profiler_chan(&self) -> &ProfilerChan
pub(crate) fn mem_profiler_chan(&self) -> &ProfilerChan
Get a sender to the memory profiler thread.
sourcepub(crate) fn time_profiler_chan(&self) -> &ProfilerChan
pub(crate) fn time_profiler_chan(&self) -> &ProfilerChan
Get a sender to the time profiler thread.
sourcepub(crate) fn script_to_constellation_chan(&self) -> &ScriptToConstellationChan
pub(crate) fn script_to_constellation_chan(&self) -> &ScriptToConstellationChan
Get a sender to the constellation thread.
pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg)
pub(crate) fn send_to_constellation(&self, msg: ScriptMsg)
sourcepub(crate) fn pipeline_id(&self) -> PipelineId
pub(crate) fn pipeline_id(&self) -> PipelineId
Get the PipelineId
for this global scope.
sourcepub(crate) fn origin(&self) -> &MutableOrigin
pub(crate) fn origin(&self) -> &MutableOrigin
Get the origin for this global scope
sourcepub(crate) fn creation_url(&self) -> &Option<ServoUrl>
pub(crate) fn creation_url(&self) -> &Option<ServoUrl>
Get the creation_url for this global scope
pub(crate) fn image_cache(&self) -> Arc<dyn ImageCache>
sourcepub(crate) fn schedule_timer(&self, request: TimerEventRequest)
pub(crate) fn schedule_timer(&self, request: TimerEventRequest)
Schedule a TimerEventRequest
on this GlobalScope
’s timers::TimerScheduler
.
Every Worker has its own scheduler, which handles events in the Worker event loop,
but Window
s use a shared scheduler associated with their ScriptThread
.
sourcepub(crate) fn policy_container(&self) -> PolicyContainer
pub(crate) fn policy_container(&self) -> PolicyContainer
sourcepub(crate) fn api_base_url(&self) -> ServoUrl
pub(crate) fn api_base_url(&self) -> ServoUrl
Get the base url for this global scope.
sourcepub(crate) fn get_referrer_policy(&self) -> ReferrerPolicy
pub(crate) fn get_referrer_policy(&self) -> ReferrerPolicy
Get the Referrer Policy for this global scope.
sourcepub(crate) fn get_referrer(&self) -> Referrer
pub(crate) fn get_referrer(&self) -> Referrer
Determine the Referrer for a request whose Referrer is “client”
sourcepub(crate) fn as_window(&self) -> &Window
pub(crate) fn as_window(&self) -> &Window
Extract a Window
, panic if the global object is not a Window
.
sourcepub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy
pub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy
Returns a policy that should be used for fetches initiated from this global.
sourcepub(crate) fn report_an_error(
&self,
error_info: ErrorInfo,
value: HandleValue<'_>,
can_gc: CanGc,
)
pub(crate) fn report_an_error( &self, error_info: ErrorInfo, value: HandleValue<'_>, can_gc: CanGc, )
sourcepub(crate) fn resource_threads(&self) -> &ResourceThreads
pub(crate) fn resource_threads(&self) -> &ResourceThreads
Get the &ResourceThreads
for this global scope.
sourcepub(crate) fn core_resource_thread(&self) -> CoreResourceThread
pub(crate) fn core_resource_thread(&self) -> CoreResourceThread
Get the CoreResourceThread
for this global scope.
sourcepub(crate) fn event_loop_sender(&self) -> Option<ScriptEventLoopSender>
pub(crate) fn event_loop_sender(&self) -> Option<ScriptEventLoopSender>
A sender to the event loop of this global scope. This either sends to the Worker event loop
or the ScriptThread event loop in the case of a Window
. This can be None
for dedicated
workers that are not currently handling a message.
sourcepub(crate) fn task_manager(&self) -> &TaskManager
pub(crate) fn task_manager(&self) -> &TaskManager
A reference to the TaskManager
used to schedule tasks for this GlobalScope
.
sourcepub(crate) fn evaluate_js_on_global_with_result(
&self,
code: &str,
rval: MutableHandleValue<'_>,
fetch_options: ScriptFetchOptions,
script_base_url: ServoUrl,
can_gc: CanGc,
) -> bool
pub(crate) fn evaluate_js_on_global_with_result( &self, code: &str, rval: MutableHandleValue<'_>, fetch_options: ScriptFetchOptions, script_base_url: ServoUrl, can_gc: CanGc, ) -> bool
Evaluate JS code on this global scope.
sourcepub(crate) fn evaluate_script_on_global_with_result(
&self,
code: &SourceCode,
filename: &str,
rval: MutableHandleValue<'_>,
line_number: u32,
fetch_options: ScriptFetchOptions,
script_base_url: ServoUrl,
can_gc: CanGc,
) -> bool
pub(crate) fn evaluate_script_on_global_with_result( &self, code: &SourceCode, filename: &str, rval: MutableHandleValue<'_>, line_number: u32, fetch_options: ScriptFetchOptions, script_base_url: ServoUrl, can_gc: CanGc, ) -> bool
Evaluate a JS script on this global scope.
sourcepub(crate) fn schedule_callback(
&self,
callback: OneshotTimerCallback,
duration: Duration,
) -> OneshotTimerHandle
pub(crate) fn schedule_callback( &self, callback: OneshotTimerCallback, duration: Duration, ) -> OneshotTimerHandle
pub(crate) fn unschedule_callback(&self, handle: OneshotTimerHandle)
sourcepub(crate) fn set_timeout_or_interval(
&self,
callback: TimerCallback,
arguments: Vec<HandleValue<'_>>,
timeout: Duration,
is_interval: IsInterval,
) -> i32
pub(crate) fn set_timeout_or_interval( &self, callback: TimerCallback, arguments: Vec<HandleValue<'_>>, timeout: Duration, is_interval: IsInterval, ) -> i32
pub(crate) fn clear_timeout_or_interval(&self, handle: i32)
pub(crate) fn queue_function_as_microtask(&self, callback: Rc<VoidFunction>)
pub(crate) fn is_js_evaluation_allowed(&self, cx: SafeJSContext) -> bool
pub(crate) fn create_image_bitmap( &self, image: ImageBitmapSource, options: &ImageBitmapOptions, can_gc: CanGc, ) -> Rc<Promise>
pub(crate) fn fire_timer(&self, handle: TimerEventId, can_gc: CanGc)
pub(crate) fn resume(&self)
pub(crate) fn suspend(&self)
pub(crate) fn slow_down_timers(&self)
pub(crate) fn speed_up_timers(&self)
fn timer_source(&self) -> TimerSource
sourcepub(crate) fn can_continue_running(&self) -> bool
pub(crate) fn can_continue_running(&self) -> bool
Returns a boolean indicating whether the event-loop where this global is running on can continue running JS.
sourcepub(crate) fn perform_a_microtask_checkpoint(&self, can_gc: CanGc)
pub(crate) fn perform_a_microtask_checkpoint(&self, can_gc: CanGc)
Perform a microtask checkpoint.
sourcepub(crate) fn enqueue_microtask(&self, job: Microtask)
pub(crate) fn enqueue_microtask(&self, job: Microtask)
Enqueue a microtask for subsequent execution.
sourcepub(crate) fn new_script_pair(
&self,
) -> (ScriptEventLoopSender, ScriptEventLoopReceiver)
pub(crate) fn new_script_pair( &self, ) -> (ScriptEventLoopSender, ScriptEventLoopReceiver)
Create a new sender/receiver pair that can be used to implement an on-demand event loop. Used for implementing web APIs that require blocking semantics without resorting to nested event loops.
sourcepub(crate) fn microtask_queue(&self) -> &Rc<MicrotaskQueue>
pub(crate) fn microtask_queue(&self) -> &Rc<MicrotaskQueue>
Returns the microtask queue of this global.
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 the event-loop where this global scope is running on. Returns a boolean indicating whether further events should be processed.
pub(crate) fn runtime_handle(&self) -> ParentRuntime
pub(crate) fn performance(&self) -> Root<Dom<Performance>>
sourcepub(crate) fn supported_performance_entry_types(
&self,
cx: SafeJSContext,
retval: MutableHandleValue<'_>,
)
pub(crate) fn supported_performance_entry_types( &self, cx: SafeJSContext, retval: MutableHandleValue<'_>, )
pub(crate) fn get_user_agent(&self) -> Cow<'static, str>
pub(crate) fn get_https_state(&self) -> HttpsState
pub(crate) fn set_https_state(&self, https_state: HttpsState)
sourcepub(crate) fn is_secure_context(&self) -> bool
pub(crate) fn is_secure_context(&self) -> bool
sourcepub(crate) fn get_csp_list(&self) -> Option<CspList>
pub(crate) fn get_csp_list(&self) -> Option<CspList>
pub(crate) fn status_code(&self) -> Option<u16>
pub(crate) fn wgpu_id_hub(&self) -> Arc<IdentityHub>
pub(crate) fn add_gpu_device(&self, device: &GPUDevice)
pub(crate) fn remove_gpu_device(&self, device: WebGPUDevice)
pub(crate) fn gpu_device_lost( &self, device: WebGPUDevice, reason: DeviceLostReason, msg: String, )
pub(crate) fn handle_uncaptured_gpu_error( &self, device: WebGPUDevice, error: Error, can_gc: CanGc, )
pub(crate) fn handle_gamepad_event(&self, gamepad_event: GamepadEvent)
sourcefn handle_gamepad_connect(
&self,
_index: usize,
name: String,
axis_bounds: (f64, f64),
button_bounds: (f64, f64),
supported_haptic_effects: GamepadSupportedHapticEffects,
)
fn handle_gamepad_connect( &self, _index: usize, name: String, axis_bounds: (f64, f64), button_bounds: (f64, f64), supported_haptic_effects: GamepadSupportedHapticEffects, )
sourcepub(crate) fn handle_gamepad_disconnect(&self, index: usize)
pub(crate) fn handle_gamepad_disconnect(&self, index: usize)
pub(crate) fn current_group_label(&self) -> Option<DOMString>
pub(crate) fn push_console_group(&self, group: DOMString)
pub(crate) fn pop_console_group(&self)
pub(crate) fn increment_console_count(&self, label: &DOMString) -> usize
pub(crate) fn reset_console_count(&self, label: &DOMString) -> Result<(), ()>
pub(crate) fn dynamic_module_list(&self) -> RefMut<'_, DynamicModuleList>
pub(crate) fn structured_clone( &self, cx: SafeJSContext, value: HandleValue<'_>, options: RootedTraceableBox<StructuredSerializeOptions>, retval: MutableHandleValue<'_>, ) -> Result<(), Error>
pub(crate) fn fetch<Listener: FetchResponseListener + PreInvoke + Send + 'static>( &self, request_builder: RequestBuilder, context: Arc<Mutex<Listener>>, task_source: SendableTaskSource, )
pub(crate) fn fetch_with_network_listener<Listener: FetchResponseListener + PreInvoke + Send + 'static>( &self, request_builder: RequestBuilder, network_listener: NetworkListener<Listener>, )
pub(crate) fn unminified_js_dir(&self) -> Option<String>
pub(crate) fn set_byte_length_queuing_strategy_size( &self, function: Rc<Function>, )
pub(crate) fn get_byte_length_queuing_strategy_size( &self, ) -> Option<Rc<Function>>
pub(crate) fn set_count_queuing_strategy_size(&self, function: Rc<Function>)
pub(crate) fn get_count_queuing_strategy_size(&self) -> Option<Rc<Function>>
Trait Implementations§
§impl Castable for GlobalScope
impl Castable for GlobalScope
source§impl DomObject for GlobalScope
impl DomObject for GlobalScope
source§impl HasParent for GlobalScope
impl HasParent for GlobalScope
source§fn as_parent(&self) -> &EventTarget
fn as_parent(&self) -> &EventTarget
This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is
type Parent = EventTarget
source§impl IDLInterface for GlobalScope
impl IDLInterface for GlobalScope
source§impl MallocSizeOf for GlobalScope
impl MallocSizeOf for GlobalScope
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl MutDomObject for GlobalScope
impl MutDomObject for GlobalScope
source§impl PartialEq for GlobalScope
impl PartialEq for GlobalScope
source§impl ToJSValConvertible for GlobalScope
impl ToJSValConvertible for GlobalScope
source§impl Traceable for GlobalScope
impl Traceable for GlobalScope
impl DerivedFrom<EventTarget> for GlobalScope
impl DerivedFrom<GlobalScope> for DedicatedWorkerGlobalScope
impl DerivedFrom<GlobalScope> for DissimilarOriginWindow
impl DerivedFrom<GlobalScope> for GlobalScope
impl DerivedFrom<GlobalScope> for PaintWorkletGlobalScope
impl DerivedFrom<GlobalScope> for ServiceWorkerGlobalScope
impl DerivedFrom<GlobalScope> for TestWorkletGlobalScope
impl DerivedFrom<GlobalScope> for Window
impl DerivedFrom<GlobalScope> for WorkerGlobalScope
impl DerivedFrom<GlobalScope> for WorkletGlobalScope
impl Eq for GlobalScope
Auto Trait Implementations§
impl !Freeze for GlobalScope
impl !RefUnwindSafe for GlobalScope
impl !Send for GlobalScope
impl !Sync for GlobalScope
impl Unpin for GlobalScope
impl !UnwindSafe for GlobalScope
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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