#[repr(C)]
pub struct GlobalScope {
Show 38 fields eventtarget: EventTarget, crypto: MutNullableDom<Crypto>, message_port_state: DomRefCell<MessagePortState>, broadcast_channel_state: DomRefCell<BroadcastChannelState>, blob_state: DomRefCell<BlobState>, registration_map: DomRefCell<HashMap<ServiceWorkerRegistrationId, Dom<ServiceWorkerRegistration>>>, worker_map: DomRefCell<HashMap<ServiceWorkerId, Dom<ServiceWorker>>>, pipeline_id: PipelineId, devtools_wants_updates: Cell<bool>, console_timers: DomRefCell<HashMap<DOMString, u64>>, module_map: DomRefCell<HashMap<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, scheduler_chan: IpcSender<TimerSchedulerMsg>, in_error_reporting_mode: Cell<bool>, resource_threads: ResourceThreads, timers: OneshotTimers, init_timers: Cell<bool>, origin: MutableOrigin, creation_url: Option<ServoUrl>, permission_state_invocation_results: DomRefCell<HashMap<String, 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>>>>, is_headless: bool, user_agent: Cow<'static, str>, gpu_id_hub: Arc<Mutex<Identities>>, gpu_devices: DomRefCell<HashMap<WebGPUDevice, Dom<GPUDevice>>>, frozen_supported_performance_entry_types: DomRefCell<Option<Heap<JSVal>>>, https_state: Cell<HttpsState>, console_group_stack: DomRefCell<Vec<DOMString>>, dynamic_modules: DomRefCell<DynamicModuleList>, inherited_secure_context: Option<bool>,
}

Fields

eventtarget: EventTargetcrypto: MutNullableDom<Crypto>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<BlobState>

The blobs managed by this global, if any.

registration_map: DomRefCell<HashMap<ServiceWorkerRegistrationId, Dom<ServiceWorkerRegistration>>>worker_map: DomRefCell<HashMap<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, u64>>

Timers used by the Console API.

module_map: DomRefCell<HashMap<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.

scheduler_chan: IpcSender<TimerSchedulerMsg>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: OneshotTimers

The mechanism by which time-outs and intervals are scheduled. https://html.spec.whatwg.org/multipage/#timers

init_timers: Cell<bool>

Have timers been initialized?

origin: MutableOrigin

The origin of the globalscope

creation_url: Option<ServoUrl>

https://html.spec.whatwg.org/multipage/#concept-environment-creation-url

permission_state_invocation_results: DomRefCell<HashMap<String, 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.

https://html.spec.whatwg.org/multipage/#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

is_headless: bool

True if headless mode.

user_agent: Cow<'static, str>

An optional string allowing the user agent to be set for testing.

gpu_id_hub: Arc<Mutex<Identities>>

Identity Manager for WebGPU resources

gpu_devices: DomRefCell<HashMap<WebGPUDevice, Dom<GPUDevice>>>

WebGPU devices

frozen_supported_performance_entry_types: DomRefCell<Option<Heap<JSVal>>>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.

dynamic_modules: DomRefCell<DynamicModuleList>

List of ongoing dynamic module imports.

inherited_secure_context: Option<bool>

Is considered in a secure context

Implementations

The message-port router Id of the global, if any

Is this global managing a given port?

Setup the IPC-to-event-loop glue for timers to schedule themselves.

Complete the transfer of a message-port.

Clean-up DOM related resources

Remove the routers for ports and broadcast-channels. Drain the list of workers.

Update our state to un-managed, and tell the constellation to drop the sender to our message-port router.

Update our state to un-managed, and tell the constellation to drop the sender to our broadcast router.

Note that the entangled port of port_id has been removed in another global.

Handle the transfer of a port in the current task.

If we don’t know about the port, send the message to the constellation for routing.

Route the task to be handled by the relevant port.

Check all ports that have been transfer-received in the previous task, and complete their transfer if they haven’t been re-transferred.

https://html.spec.whatwg.org/multipage/#ports-and-garbage-collection

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

Start tracking a broadcast-channel.

Start tracking a message-port

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.

Start tracking a blob

Start tracking a file

Clean-up any file or blob that is unreachable from script, unless it has an oustanding blob url. https://w3c.github.io/FileAPI/#lifeTime

Clean-up all file related resources on document unload. https://w3c.github.io/FileAPI/#lifeTime

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.

Get bytes from a non-sliced blob

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.

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.

Get a copy of the type_string of a blob.

https://w3c.github.io/FileAPI/#dfn-size

Get a FileID representing sliced parent-blob content

Promote non-Slice blob:

  1. Memory-based: The bytes in data slice will be transferred to file manager thread.
  2. 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.

Returns the global scope of the realm that the given DOM object’s reflector was created in.

Returns the global scope of the realm that the given JS object was created in.

Returns the global scope for the given JSContext

Returns the global scope for the given SafeJSContext

Returns the global object of the realm that the given JS object was created in, after unwrapping any wrappers.

Get an &IpcSender<ScriptToDevtoolsControlMsg> to send messages to the devtools thread when available.

Get a sender to the memory profiler thread.

Get a sender to the time profiler thread.

Get a sender to the constellation thread.

Get the PipelineId for this global scope.

Get the origin for this global scope

Get the creation_url for this global scope

Get the base url for this global scope.

Get the URL for this global scope.

Determine the Referrer for a request whose Referrer is “client”

Extract a Window, panic if the global object is not a Window.

Get the &ResourceThreads for this global scope.

Get the CoreResourceThread for this global scope.

ScriptChan to send messages to the event loop of this global scope.

TaskSource to send messages to the networking task source of this global scope.

TaskSource to send messages to the port message queue of this global scope.

TaskSource to send messages to the timer queue of this global scope.

TaskSource to send messages to the remote-event task source of this global scope.

TaskSource to send messages to the websocket task source of this global scope.

Evaluate JS code on this global scope.

Evaluate a JS script on this global scope.

Returns a boolean indicating whether the event-loop where this global is running on can continue running JS.

Returns the task canceller of this global to ensure that everything is properly cancelled when the global scope is destroyed.

Perform a microtask checkpoint.

Enqueue a microtask for subsequent execution.

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.

Returns the microtask queue of this global.

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.

Channel to send messages to the file reading task source of this of this global scope.

Returns the “current” global object.

Returns the “entry” global object.

Returns the “incumbent” global object.

Channel to send messages to the performance timeline task source of this global scope.

source

pub fn supported_performance_entry_types(&self, cx: SafeJSContext) -> JSVal

https://www.w3.org/TR/CSP/#get-csp-of-object

Trait Implementations

Check whether a DOM object implements one of its deriving interfaces.
Cast a DOM object upwards to one of the interfaces it derives from.
Cast a DOM object downwards to one of the interfaces it might implement.
Returns the receiver’s reflector.
Returns the global scope of the realm that the DomObject was created in.

This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is

Returns whether the given DOM class derives that interface.
Trace self.
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
Initializes the Reflector
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Convert self to a JSVal. JSAPI failure causes a panic.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert
Convert
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more