aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/navigator.rs
Commit message (Collapse)AuthorAgeFilesLines
* content/dom: set navigator.onLine attribute to `true` (#36560)Siddhant N Trivedi7 days1-0/+5
| | | | | | | | | | | | | | | | | | | | Sets the navigator.onLine attribute to true. Testing: Ran `./mach run https://pinterest.com --enable-experimental-web-platform-features`. This doesn't show the "Hmm..you're not connected to the internet" text anymore. <img width="1027" alt="Screenshot 2025-04-16 at 11 31 02 AM" src="https://github.com/user-attachments/assets/3745077b-dc51-42ce-88a0-38d5f157fc0c" /> part of: #36554 --------- Signed-off-by: Siddhant N. Trivedi <sidntrivedi012@gmail.com> Signed-off-by: Siddhant N Trivedi <sidntrivedi012@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* async clipboard: implement `writeText` (#36498)Gae2412 days1-0/+9
| | | | | | | | | | Implement enough of the Clipboard API to have a working `writeText`. Testing: Unfortunately many clipboard-apis tests require testdriver, so only idlharness ones will pass now. --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
* libservo: Remove a couple `EmbedderMethods` (#36276)Martin Robinson2025-04-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | - Remove `EmbedderMethods::get_user_agent_string`. This is now part of the `Preferences` data structure, which should allow it to be per-`WebView` in the future. - Remove `EmbedderMethods::get_version_string`. This was used to include some data along with WebRender captures about the Servo version. This isn't really necessary and it was done to replace code in the past that output the WebRender version, so also isn't what the original code did. I think we can just remove this entirely. The idea with these changes is that `EmbedderMethods` can be removed in a followup and the rest of the methods can be added to `ServoDelegate`. These two methods are ones that cannot be added to a delegate as they are used during `Servo` initialization. Testing: There is currently no testing for libservo. These changes are meant as preparation for adding a suite of `WebView` unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* feat: add can_gc argument to to_frozen_array (#36043)Arya Nair2025-03-191-2/+2
| | | | | | | | | | | | | | | | | | | | | * feat: add can_gc argument to to_frozen_array Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * fix: linting issues Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * feat: add can_gc in binding.conf Signed-off-by: Arya Nair <aryaajitnair@gmail.com> * fix: linting issues Signed-off-by: Arya Nair <aryaajitnair@gmail.com> --------- Signed-off-by: Arya Nair <aryaajitnair@gmail.com>
* Add an about:memory page (#35728)webbeef2025-03-071-0/+9
| | | | | | | | | | | | | | | | | This patch exposes a servo internal DOM API that is only made available to about: pages on the navigator object to request memory reports. The about:memory page itself is loaded like other html resources (eg. bad cert, net error) and makes use of this new API. On the implementation side, notable changes: - components/script/routed_promise.rs abstracts the setup used to fulfill a promise when the work needs to be routed through the constellation. The goal is to migrate other similar promise APIs in followup (eg. dom/webgpu/gpu.rs, bluetooth.rs). - a new message is added to request a report from the memory reporter, and the memory reporter creates a json representation of the set of memory reports. - the post-processing of memory reports is done in Javascript in the about-memory.html page, providing the same results as the current Rust code that outputs to stdout. We can decide later if we want to remove the current output. Signed-off-by: webbeef <me@webbeef.org>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-1/+1
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Propagate `CanGc` arguments through callers in constructors (#35541)Auguste Baum2025-02-201-11/+14
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
* Make WebBluetooth an optional feature. (#35479)Josh Matthews2025-02-181-0/+4
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Move various reflector types and traits to script_bindings (#35279)Josh Matthews2025-02-041-1/+1
| | | | | | | | | | | | | * script: Move Reflector to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix unit tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * More formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Add CanGc argument to reflect_dom_object (#34606)Domenico Rizzo2024-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | * applied mach fmt Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Refinements Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Modified reflect_dom_object signature and all its calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * fix function calls when parameter is passed up Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* Add `webgpu` feature flag (#34444)atbrakhi2024-12-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move script gpu files into webgpu folder Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Modify gpu webidls Signed-off-by: atbrakhi <atbrakhi@igalia.com> * move gpu realted webidl Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add webgpu feature to script Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add dummy implementation for gpucanvascontext Signed-off-by: atbrakhi <atbrakhi@igalia.com> * fmt Signed-off-by: atbrakhi <atbrakhi@igalia.com> * add skip-if CARGO_FEATURE_WEBGPU Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Move NavigatorGPU and workerNavigator GPU to webgpu idl Signed-off-by: atbrakhi <atbrakhi@igalia.com> * fmt and cleanup Signed-off-by: atbrakhi <atbrakhi@igalia.com> * review fix Signed-off-by: atbrakhi <atbrakhi@igalia.com> * enable webgpu by default and also some fmt fix Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Add pref back, fix imports, small cleanups Signed-off-by: atbrakhi <atbrakhi@igalia.com> --------- Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Move script gpu files into webgpu folder (#34415)atbrakhi2024-11-281-1/+1
| | | Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Filter out webidl files based on special comments, and feature-gate webxr ↵Josh Matthews2024-11-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interfaces. (#34348) * Filter out webidl files based on skip-if directives. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Don't build XR functionality without webxr feature. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Adjust imports for file movement. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Clean up webxr module import. Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* Generate a trait abstracting over all known DOM interfaces (#34357)Josh Matthews2024-11-241-1/+1
| | | | | | | | | | | | | | | | | * script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Update trait implementations with new generic type. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Use out parameter for generated methods returning JSVal (#34087)Josh Matthews2024-11-051-3/+3
| | | | | | | | | | | | | | | | | | | | | * Make generated bindings that return a WebIDL `any` value use out parameters. Returning raw JSVal values makes it easier to create GC hazards in code that calls these methods. Accepting a MutableHandle argument instead ensures that the values are rooted by the caller. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update mozjs. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* CanGc fixes in several files (#33958)chickenleaf2024-10-211-3/+3
| | | | | | | | | | | | | * few cangc fixes Signed-off-by: L Ashwin B <lashwinib@gmail.com> * few cangc fixes Signed-off-by: L Ashwin B <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* Replace the lazy_static crate whth `std::sync::LazyLock` in ↵Hayashi Mikihiro2024-08-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | components/script (#33004) * replace in str.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace navigator.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace htmlmetaelement.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace document.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace cssstyledeclaration.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace script_runtime.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace window_named_properties.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce dependency lazy_static Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * reduce lazy in script_runtime.rs `Mutex::new()` is const contexts. I think that `JS_ENGINE` is need not lazy initialize. Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
* clippy: fix several lint warns (#32126)Kitsu2024-04-221-2/+2
| | | | | | | | | | | | | | | As seems #31500 still remain opened here's the next partial fix. Fixed list: `unused_mut`, `clippy::needless_borrow`, `clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`, `clippy::unnecessary_cast`, `clippy::derivable_impls`, `clippy::collapsible_match`, `clippy::extra_unused_lifetimes`, `clippy::map_clone`, `clippy::manual_filter`. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes are part of #31500. - [x] These changes do not require tests because are only cosmetic.
* Gamepad: Remove GamepadList and fix dropped connection event on startup (#31684)Daniel Adams2024-04-081-8/+48
| | | | | | | | | | | | | | | * Replace GamepadList * Fix initial gamepad connection event from gilrs getting dropped * Fix gamepad reconnection issues, use MutNullableDom * Reduce some repetition in handle_gamepad_events * Address feedback, move some steps to navigator methods * Refactor internal navigator gamepad methods * Add note re: unused gilrs index, adjust navigator gamepad methods
* clippy: Fix a variety of warnings in components/script/dom (#31894)Ekta Siwach2024-03-291-4/+2
|
* clippy: Fix dereferenced warnings (#31770)Oluwatobi Sofela2024-03-201-2/+1
|
* Gamepad: Align closer to spec and implement missing slots (#31385)Daniel Adams2024-03-121-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement missing gamepad slots, align to spec more - Fixes TODO's from initial gamepad implementation - Adds some missing spec steps * Only handle gamepad events when pref is enabled * Return empty list in getGamepads if document not active * ./mach fmt * Update getGamepads to return an array instead of GamepadList * Add spec link for [[exposed]] slot * Remove failing test expectations for not-fully-active * A few fixes - Change should_notify to has_gesture - Add spec links and TODO to navigator - Remove unneeded clone from GamepadList::list - Move gamepadconnected event firing into has_gesture block * Use queue_with_canceller for tasks and add expects * Explicitly check for gamepad user gesture * Move user gesture check into separate function * Change contains_user_gesture to be a gamepad function * mach fmt * Change axis/button threshold constants to be private to module
* script: implement navigator.hardwareConcurrency (#31268)Smitty2024-02-071-0/+15
| | | Signed-off-by: syvb <me@iter.ca>
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-3/+3
| | | | This fixes many rustdoc errors that occur due to raw URLs in rustdoc comments as well as unescaped Rust code that should be in backticks.
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-2/+3
| | | | | * strict imports formatting * Reformat all imports
* dom: Implement Navigator.languages.Josh Matthews2020-07-141-0/+9
|
* Remove WebVRAlan Jeffrey2020-04-081-18/+1
|
* webgl: Don't dirty canvas element while in immersive mode.Josh Matthews2020-03-311-0/+4
|
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-6/+1
|
* Avoid accessing DOM global from XR's destructor.Josh Matthews2020-02-241-1/+2
|
* refactor: rename XR to XRSystemJavaScript Joe2020-02-231-4/+4
| | | | | | | | | | | | | | chore: fix formatting refactor: change filename and ref to xrsystem refactor: change filename XRSystem.webidl refactor: update crate in navigator refactor: use XRSystem instead of XR in navigator refactor: update Bindings.conf refactor: use XRSystemMethods fix: update assertions for XRSystem fix: update manifest json
* rename compartment to realmKunal Mohan2020-01-241-3/+3
|
* Support worker for WebGPUIstvan Miklos2020-01-231-36/+0
| | | | | To create resource ids for the WebGPU we need to access the `IdentityHub`. In order to access the `IdentityHub` from a `Window` or a `Worker` as well, I've moved the `IdentityHub` to the `GlobalScope` from the `Navigator`.
* Initial implementation of GPUPipelineLayout for WebGPUIstvan Miklos2020-01-211-1/+7
| | | | | Added WebIDL bindings for `GPUPipelineLayout`. Implemented the createPipelineLayout function of `GPUDevice`.
* Initial implementation of GPUBindGroupLayout for WebGPUIstvan Miklos2020-01-161-1/+7
| | | | | | Added WebIDL bindings for `GPUBindGroupLayout`, `GPUBindGroupLayoutDescriptor`, `GPUBindingType`, `GPUShaderStage` and `GPUBindGroupLayoutBinding` (Note: The servo's codegen doesn't like the name, because its already occupied). Implemented the `createBindGroupLayout` function of `GPUDevice`.
* Initial implementation of GPUBuffer for WebGPUIstvan Miklos2019-12-171-1/+5
| | | | | Added WebIDL bindings for GPUBuffer, GPUBufferDescriptor, GPUBufferUsage Implemented the `createBuffer` and `createBufferMapped` functions of GPUDevice
* Replace wgpu-native with wgpu-coreZakor Gyula2019-12-061-5/+9
|
* Initial implementation of GPUDevice for WebGPUIstvan Miklos2019-12-051-1/+5
| | | | | Added the WebIDL bindigs for GPUDevice, GPUObjectDescriptorBase, GPUDeviceDescriptor, GPUObjectBase Implemented the `requestDevice` function of `GPUAdapter`
* Add WebGPU identity managementIstvan Miklos2019-11-281-0/+12
| | | | Issue: https://github.com/servo/servo/issues/24706#issuecomment-557891841
* Initial implementation of WebGPU APIZakor Gyula2019-11-211-0/+8
|
* Fix media session action handlingFernando Jiménez Moreno2019-11-201-10/+2
|
* Move active media session logic to constellationFernando Jiménez Moreno2019-11-201-2/+2
|
* Register media instance with session and prepare communication with embedderFernando Jiménez Moreno2019-11-201-2/+20
|
* MediaSession API DOM bindingsFernando Jiménez Moreno2019-11-201-0/+9
|
* Script: removed a few opts::get()oneturkmen2019-06-261-1/+1
|
* Added missing NavigatorId attributesAlan Jeffrey2019-06-111-0/+15
|
* Use the newly added inCompartments option everywhere it can beBastien Orivel2019-05-251-7/+3
|
* Pass InCompartment by valueAron Zwaan2019-04-251-1/+1
|
* Add proof parameter to Promise::new_in_current_compartmentAron Zwaan2019-04-241-2/+6
|