Struct script::dom::globalscope::GlobalScope

source ·
#[repr(C)]
pub struct GlobalScope {
Show 39 fields eventtarget: EventTarget, crypto: MutNullableDom<Crypto>, message_port_state: DomRefCell<MessagePortState>, broadcast_channel_state: DomRefCell<BroadcastChannelState>, blob_state: DomRefCell<BlobState>, 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, 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<IdentityHub>, gpu_devices: DomRefCell<HashMapTracedValues<WebGPUDevice, WeakRef<GPUDevice>>>, frozen_supported_performance_entry_types: DomRefCell<Option<Heap<JSVal>>>, 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>,
}

Fields§

§eventtarget: EventTarget§crypto: 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<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.

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

Identity Manager for WebGPU resources

§gpu_devices: DomRefCell<HashMapTracedValues<WebGPUDevice, WeakRef<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.

§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

Implementations§

source§

impl GlobalScope

source

pub fn new_inherited( pipeline_id: PipelineId, devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>, mem_profiler_chan: ProfilerChan, time_profiler_chan: ProfilerChan, script_to_constellation_chan: ScriptToConstellationChan, scheduler_chan: IpcSender<TimerSchedulerMsg>, resource_threads: ResourceThreads, origin: MutableOrigin, creation_url: Option<ServoUrl>, microtask_queue: Rc<MicrotaskQueue>, is_headless: bool, user_agent: Cow<'static, str>, gpu_id_hub: Arc<IdentityHub>, inherited_secure_context: Option<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 setup_timers(&self)

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

source

pub 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 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 fn perform_a_dom_garbage_collection_checkpoint(&self)

Clean-up DOM related resources

source

pub 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 fn entangle_ports(&self, port1: MessagePortId, port2: MessagePortId)

source

pub 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 fn mark_port_as_transferred( &self, port_id: &MessagePortId, ) -> MessagePortImpl

Handle the transfer of a port in the current task.

source

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

source

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

source

pub 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 fn schedule_broadcast(&self, msg: BroadcastMsg, channel_id: &Uuid)

source

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

source

pub 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 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 fn perform_a_message_port_garbage_collection_checkpoint(&self)

source

pub 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 fn track_broadcast_channel(&self, dom_channel: &BroadcastChannel)

Start tracking a broadcast-channel.

source

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

Start tracking a message-port

source

pub 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 fn track_blob(&self, dom_blob: &Blob, blob_impl: BlobImpl)

Start tracking a blob

source

pub 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 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 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 fn get_blob_type_string(&self, blob_id: &BlobId) -> String

Get a copy of the type_string of a blob.

source

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

source

pub 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 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 fn get_blob_stream( &self, blob_id: &BlobId, can_gc: CanGc, ) -> Root<Dom<ReadableStream>>

source

pub 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 fn permission_state_invocation_results( &self, ) -> &DomRefCell<HashMap<String, PermissionState>>

source

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

source

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

source

pub fn close_event_sources(&self) -> bool

source

pub 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 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 unsafe fn from_context( cx: *mut JSContext, _realm: InRealm<'_>, ) -> Root<Dom<Self>>

Returns the global scope for the given JSContext

source

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

Returns the global scope for the given SafeJSContext

source

pub 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 fn add_uncaught_rejection(&self, rejection: HandleObject)

source

pub fn remove_uncaught_rejection(&self, rejection: HandleObject)

source

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

source

pub fn add_consumed_rejection(&self, rejection: HandleObject)

source

pub fn remove_consumed_rejection(&self, rejection: HandleObject)

source

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

source

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

source

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

source

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

source

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

source

pub fn get_cx() -> SafeJSContext

source

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

source

pub fn live_devtools_updates(&self) -> bool

source

pub fn set_devtools_wants_updates(&self, value: bool)

source

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

source

pub 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 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 fn devtools_chan(&self) -> Option<&IpcSender<ScriptToDevtoolsControlMsg>>

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

source

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

source

pub fn mem_profiler_chan(&self) -> &ProfilerChan

Get a sender to the memory profiler thread.

source

pub fn time_profiler_chan(&self) -> &ProfilerChan

Get a sender to the time profiler thread.

source

pub fn script_to_constellation_chan(&self) -> &ScriptToConstellationChan

Get a sender to the constellation thread.

source

pub fn send_to_embedder(&self, msg: EmbedderMsg)

source

pub fn send_to_constellation(&self, msg: ScriptMsg)

source

pub fn scheduler_chan(&self) -> &IpcSender<TimerSchedulerMsg>

source

pub fn pipeline_id(&self) -> PipelineId

Get the PipelineId for this global scope.

source

pub fn origin(&self) -> &MutableOrigin

Get the origin for this global scope

source

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

Get the creation_url for this global scope

source

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

source

pub fn api_base_url(&self) -> ServoUrl

Get the base url for this global scope.

source

pub fn get_url(&self) -> ServoUrl

Get the URL for this global scope.

source

pub fn get_referrer(&self) -> Referrer

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

source

pub fn as_window(&self) -> &Window

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

source

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

source

pub fn resource_threads(&self) -> &ResourceThreads

Get the &ResourceThreads for this global scope.

source

pub fn core_resource_thread(&self) -> CoreResourceThread

Get the CoreResourceThread for this global scope.

source

pub fn script_chan(&self) -> Box<dyn ScriptChan + Send>

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

source

pub fn gamepad_task_source(&self) -> GamepadTaskSource

TaskSource to send messages to the gamepad task source of this global scope. https://w3c.github.io/gamepad/#dfn-gamepad-task-source

source

pub fn networking_task_source(&self) -> NetworkingTaskSource

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

source

pub fn port_message_queue(&self) -> PortMessageQueue

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

source

pub fn timer_task_source(&self) -> TimerTaskSource

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

source

pub fn remote_event_task_source(&self) -> RemoteEventTaskSource

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

source

pub fn websocket_task_source(&self) -> WebsocketTaskSource

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

source

pub 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 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 fn schedule_callback( &self, callback: OneshotTimerCallback, duration: Duration, ) -> OneshotTimerHandle

source

pub fn unschedule_callback(&self, handle: OneshotTimerHandle)

source

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

source

pub fn clear_timeout_or_interval(&self, handle: i32)

source

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

source

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

source

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

source

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

source

pub fn resume(&self)

source

pub fn suspend(&self)

source

pub fn slow_down_timers(&self)

source

pub fn speed_up_timers(&self)

source

fn timer_source(&self) -> TimerSource

source

pub 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 fn task_canceller(&self, name: TaskSourceName) -> TaskCanceller

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

source

pub fn perform_a_microtask_checkpoint(&self, can_gc: CanGc)

Perform a microtask checkpoint.

source

pub fn enqueue_microtask(&self, job: Microtask)

Enqueue a microtask for subsequent execution.

source

pub fn new_script_pair( &self, ) -> (Box<dyn ScriptChan + Send>, Box<dyn ScriptPort + Send>)

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 fn microtask_queue(&self) -> &Rc<MicrotaskQueue>

Returns the microtask queue of this global.

source

pub 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 fn dom_manipulation_task_source(&self) -> DOMManipulationTaskSource

source

pub fn file_reading_task_source(&self) -> FileReadingTaskSource

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

source

pub fn runtime_handle(&self) -> ParentRuntime

source

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

Returns the “current” global object.

source

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

Returns the “entry” global object.

source

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

Returns the “incumbent” global object.

source

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

source

pub fn performance_timeline_task_source(&self) -> PerformanceTimelineTaskSource

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

source

pub fn is_headless(&self) -> bool

source

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

source

pub fn get_https_state(&self) -> HttpsState

source

pub fn set_https_state(&self, https_state: HttpsState)

source

pub fn is_secure_context(&self) -> bool

source

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

source

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

source

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

source

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

source

pub fn remove_gpu_device(&self, device: WebGPUDevice)

source

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

source

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

source

pub 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 fn handle_gamepad_disconnect(&self, index: usize)

source

pub 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>, ) -> Result<JSVal, Error>

source

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

source

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

Trait Implementations§

source§

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§

fn global(&self) -> Root<Dom<GlobalScope>>
where Self: Sized,

Returns the global scope of the realm that the DomObject was created in.
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

§

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

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

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

This method 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.
source§

impl DerivedFrom<EventTarget> for GlobalScope

source§

impl DerivedFrom<GlobalScope> for DedicatedWorkerGlobalScope

source§

impl DerivedFrom<GlobalScope> for DissimilarOriginWindow

source§

impl DerivedFrom<GlobalScope> for GlobalScope

source§

impl DerivedFrom<GlobalScope> for PaintWorkletGlobalScope

source§

impl DerivedFrom<GlobalScope> for ServiceWorkerGlobalScope

source§

impl DerivedFrom<GlobalScope> for TestWorkletGlobalScope

source§

impl DerivedFrom<GlobalScope> for Window

source§

impl DerivedFrom<GlobalScope> for WorkerGlobalScope

source§

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

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

§

type Output = T

Should always be Self
source§

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

§

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

§

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