aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
Commit message (Collapse)AuthorAgeFilesLines
...
* Update wgpu and impl `WGSLLanguageFeatures` (#34928)Samson2025-01-105-3/+106
| | | | | | | | | | | | | | * Update wgpu and impl `WGSLLanguageFeatures` https://github.com/gfx-rs/wgpu/commit/dc9b2eb71807ccafb7414425f1f8f24b5691685d Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* script: Move navigation fetching to the `ScriptThread` (#34919)Martin Robinson2025-01-106-153/+354
| | | | | | | | | | | | | | | | | | | | This allows reusing the asynchrnous fetch mechanism that we use for page resources and is likely a step toward removing the `FetchThread`. Benefits: - Reduces IPC traffic during navigation. Now instead of bouncing between the constellation and the `ScriptThread` responses are sent directly to the `ScriptThread`. - Allows cancelling loads after redirects, which was not possible before. There is the question of what to do when a redirect is cross-origin (#23037). This currently isn't handled properly as the `Constellation` sends data to the same `Pipeline` that initiated the load. This change doesn't fix this issue, but does make it more possible for the `ScriptThread` to shut down the pipeline and ask the `Constellation` to replace it with a new one. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Fix shadow root binding children to the tree (#34909)Taym Haddadi2025-01-101-3/+12
| | | | | | | | | | | | | | | | | | | | | * Fix Shadow roots bind children to the tree Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Avoid iterate over the shadow root itself Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Update test expectation Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
* script: Limit public exports. (#34915)Josh Matthews2025-01-10583-5001/+5404
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 jpeg and webp support to canvas.toDataURL() (#34861)webbeef2025-01-091-9/+69
| | | Signed-off-by: webbeef <me@webbeef.org>
* script: Downgrade noisy debug logs. (#34914)Josh Matthews2025-01-094-7/+7
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Use `enum`s for event loop senders and receivers (#34896)Martin Robinson2025-01-0818-325/+217
| | | | | | | | | | | | | | | | | | | | | | | Previously, senders and receivers to different kinds of event loops (the main `ScriptThread`, different types of workers) used a rust `trait` mechanism to implement dynamic behavior. This led to having many unused implementations of this `trait`. This change moves to using an `enum` based approach for these senders and receivers and removes all of the dead code. In addition, to allowing for use of rust's dead code detection, it simplifies the code a great deal. All of these generic senders and receivers are moved to the `messaging.rs` file and given proper documentation. Finally, empty an `JSTraceable` implementation is made for all crossbeam `Sender<...>`s to avoid having to manually skip them everytime they are included in structs. The pre-existing empty `MallocSizeOf` implementation is used more thoroughly. Other unecessary wrappers around these senders and receivers are removed as well. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Consider shadow dom when dispatching events (#34788)Simon Wülker2025-01-075-263/+732
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement EventTarget::get_the_parent Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Add spec steps to Event::init_event Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Rewrite Event::composedPath to be spec compliant Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Retarget EventTargets instead of Nodes Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Rewrite event dispatch/invocation to better match the spec Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Add spec comments to Event struct Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Don't traverse shadow roots when calculating an events path We can't do this correctly yet, and assuming that an events composed flag is never set is correct 99% of the time. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix typo in event dispatch Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * fix comment Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * allow crown error Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * fmt Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reduce item visibility where possible Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Simplify code a bit Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix Step 5.10 of Event::invoke Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix renamed method calls Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* script: Expose `NodeTraits::owner_global` / `Window::as_global_scope` (#34843)Martin Robinson2025-01-0733-258/+262
| | | | | | | | | | | Expose two new helpers and start using them as much as possible. - `NodeTraits::owner_global`: which gets the `GlobalScope` that currenty owns a `Node`. This may be different than `.global()` in the case that the `Node` was adopted by a different `Document`. - `Window::as_global_scope`: A helper to avoid having to cast so much when treating a `Window` like a `GlobalScope`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Various servodriver fixes (#34871)Josh Matthews2025-01-071-1/+1
| | | | | | | | | | | | | | | | | * servodriver: Set initial URL to data:, instead of about:blank. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Ignore failed epoch update messages. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Make servo-max-session-history.html use an iframe. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Move the `FontContext` to `Window` (#34845)Martin Robinson2025-01-072-8/+21
| | | | | | | This will allow using layout's `FontContext` in `Window` letting script manage font selection and download. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* script: Unsilence all main thread `TaskQueue` errors (#34849)Martin Robinson2025-01-0748-572/+629
| | | | | | | | | | | | No longer hide errors while queueing tasks on the main thread. This requires creating two types of `TaskSource`s: one for the main thread and one that can be sent to other threads. This makes queueing a bit more efficient on the main thread and more importantly, no longer hides task queue errors. Fixes #25688. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Add shadow tree flags to Bind/UnbindContext (#34863)Simon Wülker2025-01-0710-39/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rename IS_IN_DOC flag to IS_IN_A_DOCUMENT_TREE Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Add BindContext::is_in_a_shadow_tree Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Add UnbindContext::tree_is_in_shadow_tree Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * ./mach fmt Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update test expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * fix build after rebasing Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add initial support for WebGL 2 BlitFramebuffer (#26389)Josh Matthews2025-01-063-2/+123
| | | | | | Add initial support for the WebGL2 BlitFramebuffer call. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Istvan <istvan.miklos@h-lab.eu>
* Check regex syntax for pattern attribute with CheckRegexSyntax from mozjs ↵cybai (Haku)2025-01-061-2/+31
| | | | | (#28364) Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* ReadableStream: remove the use of get_js_stream and use ↵Taym Haddadi2025-01-059-52/+43
| | | | | | | | | | | | | | | DomRoot<ReadableStream> (#34836) * Remove the use of get_js_stream and use DomRoot<ReadableStream> Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * return an error instead of Option Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
* Document's current script should not be updated when executing script ↵Domenico Rizzo2025-01-041-1/+9
| | | | | | | | | | | | | | | | | | | elements inside shadow trees (#34787) * check if node is in shadow tree Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * Removed meta ini related file Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * refactored as_parent()'s calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* Remove readable streams from webidl/codegen (#34835)Taym Haddadi2025-01-042-39/+1
| | | Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
* script: Move `TimerListener` creation to `OneShotTimers` (#34825)Martin Robinson2025-01-042-56/+53
| | | | | | | | | | | | | | Before each `OneShotTimers` would have a `TimerListener` for its lifetime, holding the timer `TaskSource`. The issue with this is that the `TaskSource` for dedicated workers keeps the main thread object alive, so as long as the `OneShotTimers` alive (until the worker thread exists), the main thread object would never be garbage collected. This change makes the creation of the listener on-demand, avoiding the long-lived handle to the main thread object and slightly simplifying `OneShotTimers` at the expense of some more operations when scheduling a timer. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Move `TaskManager` to `GlobalScope` (#34827)Martin Robinson2025-01-0454-1522/+1066
| | | | | | | | | | | | | | | | | | | | This is a simplification of the internal `TaskQueue` API that moves the `TaskManager` to the `GlobalScope` itself. In addition, the handling of cancellers is moved to the `TaskManager` as well. This means that no arguments other than the `task` are necessary for queueing tasks, which makes the API a lot easier to use and cleaner. `TaskSource` now also keeps a copy of the canceller with it, so that they always know the proper way to cancel any tasks queued on them. There is one complication here. The event loop `sender` for dedicated workers is constantly changing as it is set to `None` when not handling messages. This is because this sender keeps a handle to the main thread's `Worker` object, preventing garbage collection while any messages are still in flight or being handled. This change allows setting the `sender` on the `TaskManager` to `None` to allow proper garbabge collection. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Ensure Element ID modifications inside disconnected shadow roots are ↵Simon Wülker2025-01-042-2/+3
| | | | | | | | | | | | | | | | | | | | | | | registered (#34834) * Add test for modifying element IDs in disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Register element ID modifications inside disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Don't crash when registering named elements in disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix test title Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fix IS_IN_SHADOW_TREE flag for descendants after Node::remove call (#34803)Simon Wülker2025-01-032-12/+34
| | | | | | | | | | | | | | | | | * Consider a UnbindContext to be tree-connected if its in a shadow root Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Properly track whether a node is in a shadow tree after removing subtree Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* script: Expose node helpers as `NodeTraits` and give more descriptive names ↵Martin Robinson2025-01-0366-425/+414
| | | | | | | | | | | | | (#34832) This puts a few commonly used `Node` helpers into a trait (`NodeTraits`) and gives them more descriptive names and documentation. The renames: - `document_from_node` -> `NodeTraits::owner_document` - `window_from_node` -> `NodeTraits::owner_window` - `stylesheets_owner_from_node<T:` -> `NodeTraits::stylesheet_list_owner` - `containing_shadow_root` -> `NodeTraits::containing_shadow_root` Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Elide lifetimes where possible after rustup (#34824)Martin Robinson2025-01-0328-39/+38
| | | | | | | | | The new version of rust allows us to elide some lifetimes and clippy is now complaining about this. This change elides them where possible and removes the clippy exceptions. Fixes #34804. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* fix: add source browsing context to `Request` and HTTP credentials prompt ↵Jason Tsai2025-01-032-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#34808) * fix: add source browsing ctx id to request when initiate navigation Signed-off-by: Jason Tsai <git@pews.dev> * chore: clippy Signed-off-by: Jason Tsai <git@pews.dev> * Update components/net/http_loader.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Jason Tsai <git@pews.dev> * chore: apply suggestions Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Jason Tsai <git@pews.dev> * chore: fix naming Signed-off-by: Jason Tsai <git@pews.dev> * refactor: set request browsing ctx id on pre page load Signed-off-by: Jason Tsai <git@pews.dev> --------- Signed-off-by: Jason Tsai <git@pews.dev> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Fix building with feature=tracing (#34815)Simon Wülker2025-01-031-6/+125
| | | Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Support syntax highlighting of arguments in the devtools console (#34810)Simon Wülker2025-01-021-52/+115
| | | | | | | | | | | | | | | | | | | | | | | | | * Implement Builder struct for console messages Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Support integer arguments for console methods Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Support floating point arguments to console methods in devtools Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix warnings Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Tidy Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* chore: Update wgpu (#34795)Samson2025-01-022-17/+22
| | | | | | | | | | | | | | | | | | | | * Update wgpu https://github.com/gfx-rs/wgpu/commit/0f5f0580e4cb2fd2feac0e8ed7e8d3050e4d9c93 Most notable change is https://github.com/gfx-rs/wgpu/pull/6785 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Remove silencing of wgpu logs I fixed this in upstream: https://github.com/gfx-rs/wgpu/pull/6817 Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
* script: Eliminate code duplication in the task queue (#34798)Martin Robinson2025-01-0164-1189/+417
| | | | | | | | | | | | | | | | Instead of creating a type for each `TaskSource` variety have each `TaskSource` hold the same kind of sender (this was inconsistent before, but each sender was effectively the same trait object), a pipeline, and a `TaskSourceName`. This elminates the need to reimplement the same queuing code for every task source. In addition, have workers hold their own `TaskManager`. This allows just exposing the manager on the `GlobalScope`. Currently the `TaskCanceller` is different, but this will also be eliminated in a followup change. This is a the first step toward having a shared set of `Sender`s on `GlobalScope`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Upgrade rustc to 1.83 (#34793)Nico Burns2025-01-0114-88/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Upgrade rustc to 1.83 Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix crown (change copied from linked clippy function) Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix named lifetime lint Signed-off-by: Nico Burns <nico@nicoburns.com> * Bump shell.nix Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix non-local impl warnings Signed-off-by: Nico Burns <nico@nicoburns.com> * Format with 1.83 formatting changes Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix manual non-local impl Signed-off-by: Nico Burns <nico@nicoburns.com> * More fixes for crown Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix tidy Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix needless_return lints Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix doc comment lint Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix missing wait lint Signed-off-by: Nico Burns <nico@nicoburns.com> * Allow needless_lifetimes lint Signed-off-by: Nico Burns <nico@nicoburns.com> * more doc comments Signed-off-by: Nico Burns <nico@nicoburns.com> * More needless_returns Signed-off-by: Nico Burns <nico@nicoburns.com> * is_empty lint Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix needless_lifetime lints Signed-off-by: Nico Burns <nico@nicoburns.com> * fix div_ceil lint Signed-off-by: Nico Burns <nico@nicoburns.com> * Allow non-minimal bool Signed-off-by: Nico Burns <nico@nicoburns.com> * Non-local impl in constellation Signed-off-by: Nico Burns <nico@nicoburns.com> * Missing wait in constellation Signed-off-by: Nico Burns <nico@nicoburns.com> * fmt Signed-off-by: Nico Burns <nico@nicoburns.com> * remove useless lints table Signed-off-by: Nico Burns <nico@nicoburns.com> * Fixup comments Signed-off-by: Nico Burns <nico@nicoburns.com> * Allow non-local definition in sandboxing code to simplify feature flagging Signed-off-by: Nico Burns <nico@nicoburns.com> * Remove wait calls and allow zombie_processes lint Signed-off-by: Nico Burns <nico@nicoburns.com> --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
* script: Remove unecessary `warn(deprecated)` directives (#34807)Martin Robinson2024-12-311-35/+0
| | | | | | | | According to the [rustc book], `deprecated` is set to `warn` level by default, so these directives are not necessary. [rustc book]: https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Split StructuredCloneHolder into Reader and Writer structs (#34792)webbeef2024-12-305-111/+67
| | | Signed-off-by: webbeef <me@webbeef.org>
* script: Add gdb/lldb helper to see the current JS stack. (#34791)Josh Matthews2024-12-291-8/+14
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Correct a variety of documentation issues (#34786)Martin Robinson2024-12-298-14/+15
| | | | | | Fix some warnings in documentation as well as some faulty documentation introduced in #34776. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Use spec-aligned process for resolving history handling during navigation ↵shanehandley2024-12-279-19/+86
| | | | | | | | | (#34747) Makes use of the is_initial_about_blank property on Document in order to determine whether the navigation should create a history entry, or replace the current history entry. Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* script: Handle null contexts better during JS runtime shutdown. (#34769)Josh Matthews2024-12-266-21/+33
| | | | | | | | | | | | | | | * script: Handle null contexts better during JS runtime shutdown. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * lock file Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Don't run scripts while DOM tree is undergoing mutations (#34505)Josh Matthews2024-12-264-33/+73
| | | | | | | | | | | | | | | | | | | | | | | | | * script: Implement node insertion post-connection hook. Ensure script elements only run scripts when the DOM has stabilized. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make iframe element use post-connection steps when handling initial document insertion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Use a delayed task when running post-connection steps. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Add explanatory comment. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Ensure ConsumeBodyPromiseHandler values are always rooted (#34194)Josh Matthews2024-12-261-4/+6
| | | | | | | | | | | | | * script: Root the use of ComsumeBodyPromiseHandler. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update mozjs and run crown on mozjs_sys. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Refactor channels in `ScriptThread` into receivers and senders (#34776)Martin Robinson2024-12-2628-884/+714
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create two new data structures in the `script` crate to hold senders and receiver: - `ScriptThreadSenders`: holds all outgoing channels from the `ScriptThread` including a channel to the `ScriptThread` itself. The ultimate goal with this is to reduce duplication by giving a boxed version of this this to `Window`s. - `ScriptThradReceivers`: holds all incoming channels to the `ScriptThread`. This isn't cloenable like the senders. This is used to abstract away `recv()` and `try_recv()` methods used to make the `ScriptThread` event loop easier to read. In addition: - The many duplicated `ScriptThread` self-senders for the `TaskManager` have been removed and, in general, a lot of boilerplate is removed as well. - Visibilty of all methods affected by this change is changed to `pub(crate)` in order to take advantage of dead code detection. Some dead code produced from macros is removed. - Some conversion code is refactord into implementations of the `From` trait. - The names of channels uses a standard "sender" and "receiver" naming as well as trying to be descriptive of where they go in `ScriptThread` as well as `InitialScriptState` Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Clone node on a shadow root should always throw an error (#34742)Domenico Rizzo2024-12-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * Corrected Node-prototype-cloneNode clone part test Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * Corrected node code Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * updated MANIFEST Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * removed fails expectations Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * Removed not legacy ini file Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* script: Make timers per-process (#34581)Martin Robinson2024-12-2411-164/+179
| | | | | | | | | | | | | | | Before all timers were managed by the Constellation process, meaning that they had to trigger IPC calls to be scheduled and fired. Currently, timers are only used in the `ScriptThread`, so it makes sense that they are per-process. This change restores the timer thread functionality that existed before avoided entirely. Completion is done using a callback that is sent to the timer thread similarly to how fetch is done. This allows reusing the existing task queue without making any new channels. Fixes #15219. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add check for valid custom element name in element::attach_shadow (#34749)Steven Novaryo2024-12-242-24/+49
| | | | | | | | | | | | | * Add valid custom element name check Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> * Update wpt test expectation Signed-off-by: stevennovaryo <steven.novaryo@gmail.com> --------- Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Convert http&https to ws&wss in websocket constructor (#34735)batu_hoang2024-12-221-9/+26
| | | Signed-off-by: batu_hoang <longvatrong111@gmail.com>
* Implement referrerpolicy attribute on remaining elements (#34736)shanehandley2024-12-225-8/+25
| | | | | Fixes #11861 Signed-off-by: Shane Handley <shanehandley@fastmail.com>
* Update wgpu for supporting TextureView.usage (#34721)Samson2024-12-213-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update wgpu and add support for TextureView.usage https://github.com/gfx-rs/wgpu/commit/53f40794f275329a48efc7d1c637c91b8e51327d Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update expect Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Disable wgpu logging Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * remove unused wgpu features Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * new expect Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * re Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update deny.toml Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
* script: Cache the `<iframe>` list per-Document (#34702)Martin Robinson2024-12-207-107/+225
| | | | | | | | | This change creates a new struct `IFrameCollection` that is used to cache the list of `<iframe>`s in a `Document` as long as the `Document`'s DOM has not changed. This prevent constantly iterating the entire DOM during *update the rendering*, which runs up to 60 times per second as well as for other operations. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Lay out Shadow DOM elements (#34701)Martin Robinson2024-12-191-8/+13
| | | | | | | | | | | When an element is a shadow root, lay out the shadow root elements instead of the non-shadow children. This fixes some tests and introduces some failures, due to bugs in the Shadow DOM implementation. In general, this is very low impact as the Shadow DOM is still disabled by default. At least this gets elements rendering when the preference is turned on though. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Remove the need for crow allow unrooted lints in the queuing and de-queuing ↵Gregory Terzian2024-12-191-18/+10
| | | | | of values from default stream controllers (#34675) Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Implement `console.trace` (#34629)Simon Wülker2024-12-182-19/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Include unimplemented console methods in idl file Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix console.assert signature The condition is optional and there can be multiple messages. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement console.trace Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * ./mach fmt Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Log stack trace when calling console.trace Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update wpt expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Include line/column info in console.trace logs Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Move option out of constant Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update mozjs Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Replace HistoryEntryReplacement with NavigationHistoryBehavior from the ↵shanehandley2024-12-188-55/+60
| | | | | navigation API (#34681) Signed-off-by: Shane Handley <shanehandley@fastmail.com>