script::dom::globalscope

Struct GlobalScope

source
#[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>§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.

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

§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.

https://console.spec.whatwg.org/#count

§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

source

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.

source

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

source

fn port_router_id(&self) -> Option<MessagePortRouterId>

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

source

fn is_managing_port(&self, port_id: &MessagePortId) -> bool

Is this global managing a given port?

source

fn timers(&self) -> &OneshotTimers

source

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>>

source

pub(crate) fn get_serviceworker( &self, script_url: &ServoUrl, scope: &ServoUrl, worker_id: ServiceWorkerId, ) -> Root<Dom<ServiceWorker>>

source

fn complete_port_transfer( &self, port_id: MessagePortId, tasks: VecDeque<PortMessageTask>, )

Complete the transfer of a message-port.

source

pub(crate) fn perform_a_dom_garbage_collection_checkpoint(&self)

Clean-up DOM related resources

source

pub(crate) fn remove_web_messaging_and_dedicated_workers_infra(&self)

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

source

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.

source

fn remove_broadcast_channel_router(&self)

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

source

pub(crate) fn entangle_ports(&self, port1: MessagePortId, port2: MessagePortId)

source

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.

source

pub(crate) fn mark_port_as_transferred( &self, port_id: &MessagePortId, ) -> MessagePortImpl

Handle the transfer of a port in the current task.

source

pub(crate) fn start_message_port(&self, port_id: &MessagePortId)

source

pub(crate) fn close_message_port(&self, port_id: &MessagePortId)

source

pub(crate) fn post_messageport_msg( &self, port_id: MessagePortId, task: PortMessageTask, )

source

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.

source

pub(crate) fn schedule_broadcast(&self, msg: BroadcastMsg, channel_id: &Uuid)

source

pub(crate) fn broadcast_message_event( &self, event: BroadcastMsg, channel_id: Option<&Uuid>, )

source

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.

source

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.

source

pub(crate) fn perform_a_message_port_garbage_collection_checkpoint(&self)

source

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

source

pub(crate) fn track_broadcast_channel(&self, dom_channel: &BroadcastChannel)

Start tracking a broadcast-channel.

source

pub(crate) fn track_message_port( &self, dom_port: &MessagePort, port_impl: Option<MessagePortImpl>, )

Start tracking a message-port

source

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.

source

fn track_blob_info(&self, blob_info: BlobInfo, blob_id: BlobId)

source

pub(crate) fn track_blob(&self, dom_blob: &Blob, blob_impl: BlobImpl)

Start tracking a blob

source

pub(crate) fn track_file(&self, file: &File, blob_impl: BlobImpl)

Start tracking a file

source

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

source

pub(crate) fn clean_up_all_file_resources(&self)

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

source

fn decrement_file_ref(&self, id: Uuid)

source

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.

source

fn get_blob_bytes_non_sliced(&self, blob_id: &BlobId) -> Result<Vec<u8>, ()>

Get bytes from a non-sliced blob

source

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.

source

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.

source

pub(crate) fn get_blob_type_string(&self, blob_id: &BlobId) -> String

Get a copy of the type_string of a blob.

source

pub(crate) fn get_blob_size(&self, blob_id: &BlobId) -> u64

source

pub(crate) fn get_blob_url_id(&self, blob_id: &BlobId) -> Uuid

source

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

source

pub(crate) fn promote(&self, blob_info: &mut BlobInfo, set_valid: bool) -> Uuid

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.
source

fn send_to_file_manager(&self, msg: FileManagerThreadMsg)

source

fn read_file(&self, id: Uuid) -> Result<Vec<u8>, ()>

source

pub(crate) fn get_blob_stream( &self, blob_id: &BlobId, can_gc: CanGc, ) -> Result<Root<Dom<ReadableStream>>, Error>

source

pub(crate) fn read_file_async( &self, id: Uuid, promise: Rc<Promise>, callback: Box<dyn Fn(Rc<Promise>, Result<Vec<u8>, Error>) + Send>, )

source

fn send_msg(&self, id: Uuid) -> IpcReceiver<FileManagerResult<ReadFileProgress>>

source

fn read_msg( receiver: IpcReceiver<FileManagerResult<ReadFileProgress>>, ) -> Result<Vec<u8>, ()>

source

pub(crate) fn permission_state_invocation_results( &self, ) -> &DomRefCell<HashMap<PermissionName, PermissionState>>

source

pub(crate) fn track_worker( &self, closing: Arc<AtomicBool>, join_handle: JoinHandle<()>, control_sender: Sender<DedicatedWorkerControlMsg>, context: ThreadSafeJSContext, )

source

pub(crate) fn track_event_source(&self, event_source: &EventSource)

source

pub(crate) fn close_event_sources(&self) -> bool

source

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.

source

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.

source

pub(crate) unsafe fn from_context( cx: *mut JSContext, _realm: InRealm<'_>, ) -> Root<Dom<Self>>

Returns the global scope for the given JSContext

source

pub(crate) fn from_safe_context( cx: SafeJSContext, realm: InRealm<'_>, ) -> Root<Dom<Self>>

Returns the global scope for the given SafeJSContext

source

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.

source

pub(crate) fn add_uncaught_rejection(&self, rejection: HandleObject)

source

pub(crate) fn remove_uncaught_rejection(&self, rejection: HandleObject)

source

pub(crate) fn get_uncaught_rejections( &self, ) -> &DomRefCell<Vec<Box<Heap<*mut JSObject>>>>

source

pub(crate) fn add_consumed_rejection(&self, rejection: HandleObject)

source

pub(crate) fn remove_consumed_rejection(&self, rejection: HandleObject)

source

pub(crate) fn get_consumed_rejections( &self, ) -> &DomRefCell<Vec<Box<Heap<*mut JSObject>>>>

source

pub(crate) fn set_module_map(&self, url: ServoUrl, module: ModuleTree)

source

pub(crate) fn get_module_map( &self, ) -> &DomRefCell<HashMapTracedValues<ServoUrl, Rc<ModuleTree>>>

source

pub(crate) fn set_inline_module_map( &self, script_id: ScriptId, module: ModuleTree, )

source

pub(crate) fn get_inline_module_map( &self, ) -> &DomRefCell<HashMap<ScriptId, Rc<ModuleTree>>>

source

pub(crate) fn get_cx() -> SafeJSContext

source

pub(crate) fn crypto(&self) -> Root<Dom<Crypto>>

source

pub(crate) fn live_devtools_updates(&self) -> bool

source

pub(crate) fn set_devtools_wants_updates(&self, value: bool)

source

pub(crate) fn time(&self, label: DOMString) -> Result<(), ()>

source

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.

source

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.

source

pub(crate) fn devtools_chan( &self, ) -> Option<&IpcSender<ScriptToDevtoolsControlMsg>>

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

source

pub(crate) fn issue_page_warning(&self, warning: &str)

source

pub(crate) fn mem_profiler_chan(&self) -> &ProfilerChan

Get a sender to the memory profiler thread.

source

pub(crate) fn time_profiler_chan(&self) -> &ProfilerChan

Get a sender to the time profiler thread.

source

pub(crate) fn script_to_constellation_chan(&self) -> &ScriptToConstellationChan

Get a sender to the constellation thread.

source

pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg)

source

pub(crate) fn send_to_constellation(&self, msg: ScriptMsg)

source

pub(crate) fn pipeline_id(&self) -> PipelineId

Get the PipelineId for this global scope.

source

pub(crate) fn origin(&self) -> &MutableOrigin

Get the origin for this global scope

source

pub(crate) fn creation_url(&self) -> &Option<ServoUrl>

Get the creation_url for this global scope

source

pub(crate) fn image_cache(&self) -> Arc<dyn ImageCache>

source

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 Windows use a shared scheduler associated with their ScriptThread.

source

pub(crate) fn policy_container(&self) -> PolicyContainer

source

pub(crate) fn api_base_url(&self) -> ServoUrl

Get the base url for this global scope.

source

pub(crate) fn get_url(&self) -> ServoUrl

Get the URL for this global scope.

source

pub(crate) fn get_referrer_policy(&self) -> ReferrerPolicy

Get the Referrer Policy for this global scope.

source

pub(crate) fn get_referrer(&self) -> Referrer

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

source

pub(crate) fn as_window(&self) -> &Window

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

source

pub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy

Returns a policy that should be used for fetches initiated from this global.

source

pub(crate) fn report_an_error( &self, error_info: ErrorInfo, value: HandleValue<'_>, can_gc: CanGc, )

source

pub(crate) fn resource_threads(&self) -> &ResourceThreads

Get the &ResourceThreads for this global scope.

source

pub(crate) fn core_resource_thread(&self) -> CoreResourceThread

Get the CoreResourceThread for this global scope.

source

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.

source

pub(crate) fn task_manager(&self) -> &TaskManager

A reference to the TaskManager used to schedule tasks for this GlobalScope.

source

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.

source

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.

source

pub(crate) fn schedule_callback( &self, callback: OneshotTimerCallback, duration: Duration, ) -> OneshotTimerHandle

source

pub(crate) fn unschedule_callback(&self, handle: OneshotTimerHandle)

source

pub(crate) fn set_timeout_or_interval( &self, callback: TimerCallback, arguments: Vec<HandleValue<'_>>, timeout: Duration, is_interval: IsInterval, ) -> i32

source

pub(crate) fn clear_timeout_or_interval(&self, handle: i32)

source

pub(crate) fn queue_function_as_microtask(&self, callback: Rc<VoidFunction>)

source

pub(crate) fn is_js_evaluation_allowed(&self, cx: SafeJSContext) -> bool

source

pub(crate) fn create_image_bitmap( &self, image: ImageBitmapSource, options: &ImageBitmapOptions, can_gc: CanGc, ) -> Rc<Promise>

source

pub(crate) fn fire_timer(&self, handle: TimerEventId, can_gc: CanGc)

source

pub(crate) fn resume(&self)

source

pub(crate) fn suspend(&self)

source

pub(crate) fn slow_down_timers(&self)

source

pub(crate) fn speed_up_timers(&self)

source

fn timer_source(&self) -> TimerSource

source

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.

source

pub(crate) fn perform_a_microtask_checkpoint(&self, can_gc: CanGc)

Perform a microtask checkpoint.

source

pub(crate) fn enqueue_microtask(&self, job: Microtask)

Enqueue a microtask for subsequent execution.

source

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.

source

pub(crate) fn microtask_queue(&self) -> &Rc<MicrotaskQueue>

Returns the microtask queue of this global.

source

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.

source

pub(crate) fn runtime_handle(&self) -> ParentRuntime

source

pub(crate) fn current() -> Option<Root<Dom<Self>>>

Returns the “current” global object.

source

pub(crate) fn entry() -> Root<Dom<Self>>

Returns the “entry” global object.

source

pub(crate) fn incumbent() -> Option<Root<Dom<Self>>>

Returns the “incumbent” global object.

source

pub(crate) fn performance(&self) -> Root<Dom<Performance>>

source

pub(crate) fn supported_performance_entry_types( &self, cx: SafeJSContext, retval: MutableHandleValue<'_>, )

source

pub(crate) fn get_user_agent(&self) -> Cow<'static, str>

source

pub(crate) fn get_https_state(&self) -> HttpsState

source

pub(crate) fn set_https_state(&self, https_state: HttpsState)

source

pub(crate) fn is_secure_context(&self) -> bool

source

pub(crate) fn get_csp_list(&self) -> Option<CspList>

source

pub(crate) fn status_code(&self) -> Option<u16>

source

pub(crate) fn wgpu_id_hub(&self) -> Arc<IdentityHub>

source

pub(crate) fn add_gpu_device(&self, device: &GPUDevice)

source

pub(crate) fn remove_gpu_device(&self, device: WebGPUDevice)

source

pub(crate) fn gpu_device_lost( &self, device: WebGPUDevice, reason: DeviceLostReason, msg: String, )

source

pub(crate) fn handle_uncaptured_gpu_error( &self, device: WebGPUDevice, error: Error, can_gc: CanGc, )

source

pub(crate) fn handle_gamepad_event(&self, gamepad_event: GamepadEvent)

source

fn handle_gamepad_connect( &self, _index: usize, name: String, axis_bounds: (f64, f64), button_bounds: (f64, f64), supported_haptic_effects: GamepadSupportedHapticEffects, )

source

pub(crate) fn handle_gamepad_disconnect(&self, index: usize)

source

pub(crate) fn receive_new_gamepad_button_or_axis( &self, index: usize, update_type: GamepadUpdateType, )

source

pub(crate) fn current_group_label(&self) -> Option<DOMString>

source

pub(crate) fn push_console_group(&self, group: DOMString)

source

pub(crate) fn pop_console_group(&self)

source

pub(crate) fn increment_console_count(&self, label: &DOMString) -> usize

source

pub(crate) fn reset_console_count(&self, label: &DOMString) -> Result<(), ()>

source

pub(crate) fn dynamic_module_list(&self) -> RefMut<'_, DynamicModuleList>

source

pub(crate) fn structured_clone( &self, cx: SafeJSContext, value: HandleValue<'_>, options: RootedTraceableBox<StructuredSerializeOptions>, retval: MutableHandleValue<'_>, ) -> Result<(), Error>

source

pub(crate) fn fetch<Listener: FetchResponseListener + PreInvoke + Send + 'static>( &self, request_builder: RequestBuilder, context: Arc<Mutex<Listener>>, task_source: SendableTaskSource, )

source

pub(crate) fn fetch_with_network_listener<Listener: FetchResponseListener + PreInvoke + Send + 'static>( &self, request_builder: RequestBuilder, network_listener: NetworkListener<Listener>, )

source

pub(crate) fn unminified_js_dir(&self) -> Option<String>

source

pub(crate) fn set_byte_length_queuing_strategy_size( &self, function: Rc<Function>, )

source

pub(crate) fn get_byte_length_queuing_strategy_size( &self, ) -> Option<Rc<Function>>

source

pub(crate) fn set_count_queuing_strategy_size(&self, function: Rc<Function>)

source

pub(crate) fn get_count_queuing_strategy_size(&self) -> Option<Rc<Function>>

Trait Implementations§

§

impl Castable for GlobalScope

source§

fn is<T>(&self) -> bool
where T: DerivedFrom<Self>,

Check whether a DOM object implements one of its deriving interfaces.
source§

fn upcast<T>(&self) -> &T
where T: Castable, Self: DerivedFrom<T>,

Cast a DOM object upwards to one of the interfaces it derives from.
source§

fn downcast<T>(&self) -> Option<&T>
where T: DerivedFrom<Self>,

Cast a DOM object downwards to one of the interfaces it might implement.
source§

impl DomObject for GlobalScope

source§

fn reflector(&self) -> &Reflector

Returns the receiver’s reflector.
source§

impl GlobalScopeHelpers<DomTypeHolder> for GlobalScope

source§

unsafe fn from_context( cx: *mut JSContext, realm: InRealm<'_>, ) -> Root<Dom<Self>>

source§

impl HasParent for GlobalScope

source§

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

source§

type Parent = EventTarget

source§

impl IDLInterface for GlobalScope

source§

fn derives(class: &'static DOMClass) -> bool

Returns whether the given DOM class derives that interface.
source§

impl MallocSizeOf for GlobalScope

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

impl MutDomObject for GlobalScope

source§

unsafe fn init_reflector(&self, obj: *mut JSObject)

Initializes the Reflector Read more
source§

impl PartialEq for GlobalScope

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToJSValConvertible for GlobalScope

source§

unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)

Convert self to a JSVal. JSAPI failure causes a panic.
source§

impl Traceable for GlobalScope

source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.
§

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

source§

impl Eq for GlobalScope

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ThisReflector for T
where T: DomObject,

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T