aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
Commit message (Collapse)AuthorAgeFilesLines
* Set correct policy-container for worker construction (#36603)Tim van der Lippe7 hours4-27/+38
| | | | | | | This makes sure that when workers are created, their global scope has the correct policy-container set so that we can do CSP-checks. Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
* Streams: remove unnecessary special hanlding of dataclone error (#36628)Gregory Terzian11 hours2-19/+7
| | | | | | | | This removes a now unnecessary handling of dataclone error when port posts a message handling error to support stream transfers. Fix https://github.com/servo/servo/issues/36479 Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Remove unnecessary map_err. (#36625)Josh Matthews11 hours1-1/+1
| | | | | | | | | #36361 changed the return type of structuredclone::read, so this code is just stomping on an error value that is potentially more useful since #36308 was merged. Testing: Existing WPT test coverage. Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: `LoadBlocker`'s drop impl shouldn't run after termination. (#36508)Mukilan Thiyagarajan12 hours1-3/+11
| | | | | | | | | | | | | The logic in LoadBlocker::terminate was modified in #34122 to `clone` the LoadBlocker's inner `load` member instead of `take`ing it. However, this member serves as a flag so that `LoadBlocker`'s Drop impl can avoid calling `doc.finish_load` on already terminated loads. The change results in unnecessary 'unknown completed load' warnings when Servo is run with logging enabled. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Implement trusted types url setter (#36596)Tim van der Lippe12 hours8-4/+229
| | | | | | | | | | | | | | | | | | | | | | | | We now check the sink of script.src for trusted types. This is the first attribute that we check, other sinks will be implemented in follow-up changes. The algorithms currently hardcode various parts. That's because I need to refactor a couple of algorithms already present in TrustedTypePolicy. They use callbacks at the moment, which made sense for their initial use. However, for these new algorithms they don't work. Therefore, I will align them with the specification by taking in an enum. However, since that's a bigger refactoring, I left that out of this PR (which is already quite big). The other trusted types support (createScript and createHTML) will also be implemented separately. Part of #36258 --------- Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Rework `ScriptThread::handle_input_event` for behaviour and performance (#36619)Euclid Ye16 hours1-32/+30
| | | | | | | | | | | | | | Rework `ScriptThread::handle_input_event` for correct behaviour and better performance 1. Only trigger click event with primary button, according to spec 2. Avoid unnecessary clone of `ConstellationInputEvent` This is a follow up of #36413 Testing: Manually tested. Right mouse won't trigger click event now. Fixes: #35666 cc @jdm @xiaochengh Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* Eagerly define interfaces on non-Window globals (#36604)Josh Matthews16 hours4-3/+36
| | | | | | | | | | | | | | | | These changes make us match Gecko's setup for how Window and non-Window globals are initialized. Since Window globals are much more common than Worker globals, using lazy interface definitions can be a useful memory optimization at the expense of increased complexity for property lookups. Also adds the MayResolve hook for all globals, which is an optimization for the JIT to avoid calling resolve hooks unnecessarily. Testing: Existing test coverage on global interfaces should suffice. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix: Slot Assignment mode according to the spec (#36620)saku27 hours1-1/+1
| | | | | | | | | | | | | | | | | | | | When parsing a Declarative Shadow DOM, the slot assignment isn't being triggered as mentioned in the [spec](https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inhead:~:text=Attach%20a%20shadow%20root%20with%20declarative%20shadow%20host%20element%2C%20mode%2C%20clonable%2C%20serializable%2C%20delegatesFocus%2C%20%22named%22%2C%20and%20registry.). When creating a shadow root declaratively, SlotAssignment mode was set to "manual" instead of "named". Tests: The followings should get fully passed with this change, so `.ini`s are removed. - `declarative-shadow-dom-basic.html` - `declarative-shadow-dom-write-to-iframe.html` - `declarative-shadow-dom-repeats.html` Fixes: #36100 --------- Signed-off-by: saku <saku@email.sakupi01.com>
* Fix missing settings in script module requests (#36606)elomscansio31 hours1-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR resolves [#36592](https://github.com/servo/servo/issues/36592) by updating the `RequestBuilder` used in `script_module.rs` to include: - `insecure_requests_policy` - `has_trustworthy_ancestor_origin` - `policy_container` These fields are critical for enforcing proper fetch behavior under modern web security models, and were previously omitted from module script requests. This change ensures that scripts loaded via `<script type="module">` or dynamic `import()` correctly reflect the calling document’s security environment. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #36592 <!-- Either: --> - [X] There are tests for these changes Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com>
* htmlvideoelement: Include security settings in poster image request (#36605)elomscansio42 hours1-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This PR addresses [#36593](https://github.com/servo/servo/issues/36593), where the poster image request for `<video>` elements lacked several settings introduced in `RequestBuilder`. These settings — `insecure_requests_policy`, `has_trustworthy_ancestor_origin`, and `policy_container` — are now forwarded from the document, aligning poster requests with other fetches using the correct policy container and trust assessment. This ensures that poster images are requested under the same security assumptions as other media or resource loads. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #36593 <!-- Either: --> - [X] There are tests for these changes Signed-off-by: Emmanuel Elom <elomemmanuel007@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Use version of `markup5ever` with `web_atoms` crate (#36542)Nico Burns2 days52-56/+52
| | | | | | | | Upgrades `markup5ever` and fixes "unnecessary import" lints. See https://github.com/servo/html5ever/pull/599 And https://github.com/servo/stylo/pull/173 Signed-off-by: Nico Burns <nico@nicoburns.com>
* script: Only register one image callback per CSS image in use. (#36612)Josh Matthews3 days1-2/+5
| | | | | | | | | | | | | | | | | | | When layout encounters a CSS image, the script thread is responsible for fetching the image from the image cache. When the image is not yet available, the script thread creates image cache listeners to perform actions in response to future updates from the image cache. In the current implementation, a cache listener would iterate over all nodes using a particular image and mark them as dirty. However, we mistakenly added one cache listener per node, leading to n^2 runtime while performing lots of redundant work. For cases like #36480 with over 1000 elements using the same image, this led to a completely unresponsive script thread. Testing: Manual testing on the provided testcase, and a new WPT test that times out without this PR's changes. Fixes: #36480 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* content/dom: set navigator.onLine attribute to `true` (#36560)Siddhant N Trivedi3 days2-0/+10
| | | | | | | | | | | | | | | | | | | | 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>
* Move click event trigger from embedding layer to `ScriptThread` (#36413)Euclid Ye3 days1-3/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Move click event trigger from embedding layer to `ScriptThread` 2. Previously, the logic is to trigger click event at same position as `MouseButtonAction::Up` if `MouseButtonAction::Up` is within 10px of `MouseButtonAction::Down`, in embedding layer. This PR ~~removes the condition~~ moves the check to `ScriptThread`. Testing: tested for webdriver with self written test case. Perform actions of pointermove, pointerdown, pointerup in sequence. Click event can now be triggered. Fixes: #35395 cc @xiaochengh @jdm For `MAYBE? TODO:` part I added, should we do it? I read the [spec](https://w3c.github.io/uievents/#event-type-click), it doesn't specify we have to implement MDN's way. If we should work in the MDN's way, it also should be fixed in another PR, as this PR doesn't regress anything. Also I am not sure what is the best way to do it. Should I handle it in https://github.com/servo/servo/blob/4d4f94936f8859f039497df370083fd7ea35fb00/components/script/dom/document.rs#L1296-L1297? --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* Streams: make writable streams transferrable (#36588)Gregory Terzian3 days3-5/+103
| | | | | | Making writable streams transferrable, part of https://github.com/servo/servo/issues/34676 Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* chore: Update wgpu to v25 (#36486)sagudev3 days1-6/+21
| | | | | | | | | | Updates wgpu to v25 and remove some verbose logging from CTS (that also causes OOM). Testing: WebGPU CTS --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Refactor common infrastructure for creating memory reports. (#36579)Josh Matthews4 days3-26/+26
| | | | | | | | | This removes a bunch of duplicated code needed to support ConditionalMallocSizeOf correctly, and fixes multiple places where that code was subtly wrong (the seen pointers hashset was never cleared). Testing: Measuring https://www.nist.gov/image-gallery lots of times. Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Check CSP for inline event handlers (#36510)Tim van der Lippe4 days5-16/+42
| | | | | | | | | | | | This also ensures that document now reports all violations and we set the correct directive. With these changes, all `script-src-attr-elem` WPT tests pass. Part of #36437 Requires servo/rust-content-security-policy#3 to land first Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
* imagedata: Fix overflow panic for too large ImageData (#36569)Andrei Volykhin5 days1-4/+21
| | | | | | | | | | | | | | | | | In Servo debug build there are runtime crash due to "attempt to multiply with overflow" panic in case of creation too large ImageData (new ImageData(1<<31, 1<<31)) Use checked integer multiplication to catch occurred overflow and throwing JS error (RangeError OR IndexSizeError). -- - [x] ./mach build -d does not report any errors - [x] ./mach test-tidy does not report any errors - [x] There are tests for these changes tests/wpt/tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics.html Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* Fix crash when enumerating properties of global object (#36491)Josh Matthews5 days1-3/+2
| | | | | | | | | | | | | | | | | | | These changes make our implementation of the enumeration hook for globals [match Gecko's](https://searchfox.org/mozilla-central/rev/1f65969e57c757146e3e548614b49d3a4168eeb8/dom/base/nsGlobalWindowInner.cpp#3297), fixing an assertion failure that occurred in the previous implementation. Our enumeration hook is supposed to fill a vector with names of properties on the global object without modifying the global in any way; instead we were defining all of the missing webidl interfaces. We now do much less work and crash less. Testing: New crashtest based on manual testcase. Fixes: #34686 --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* fix writablestream assertion crash when getting chunk size following spec ↵Taym Haddadi5 days1-3/+3
| | | | | | | | change (#36566) One-line change to align with the new spec and avoid a crash. fix #36565 Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
* net: Report memory usage for image cache. (#36556)Josh Matthews5 days1-1/+4
| | | | | | | | | These changes add a new report for image cache memory usage for each script thread. Testing: Looked at the numbers after browsing various stock photo sites that show galleries of images. Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* media element: support seekable attribute (#36541)TIN TUN AUNG6 days1-7/+46
| | | | | | | | | | | | | | | support seekable attribute in `htmlmediaelement`, modify `seek` algorithm to use `seekable` attribute. related [specs](https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable) Testing: Run WPT Test Fixes: https://github.com/servo/servo/issues/22297 Will wait for https://github.com/servo/media/pull/435 before turning this to ready for review. cc @jdm @xiaochengh Signed-off-by: rayguo17 <rayguo17@gmail.com>
* Implement GetComputedRole in wd (#36552)Kenzie Raditya Tirtarahardja6 days2-0/+26
| | | | | | | | Implement Webdriver Get Computed Role. [spec](https://w3c.github.io/webdriver/#get-computed-role) Signed-off-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com> Co-authored-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com>
* Refactor retrieving element container in webdriver into function (#36467)Kenzie Raditya Tirtarahardja6 days1-21/+37
| | | | | | | | | | | Refactor getting an element's container. Previously this is inlined and only done for `HTMLOptionElement`. [Try](https://github.com/PotatoCP/servo/actions/runs/14399482275) Fixes: #24106 Signed-off-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com> Co-authored-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com>
* compositor: Unify the cross process and in-process API (#36543)Martin Robinson6 days2-7/+4
| | | | | | | | | | | | | | | | | | | Because there used to be two traits exposing messages to the compositor, there were two kinds of messages that could be sent: 1. In-process messages from the `Constellation` 2. Cross-process messages from other parts of Servo Now these two types of messages can be unified into one type. This is a reland of #36443, which caused regressions due to the fact that messages to the compositor were no longer triggering the event loop waker. This version of the PR splits out just the bits that unify the two APIs, leaving the cleanup of routes in the constellation for another PR. Testing: This is covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Switch to data_url::mime for document content type (#36522)webbeef6 days7-49/+112
| | | | | | | | The data_url Mime parser has a more conformant behavior in most cases, including dealing with charsets. Testing: wpt expectations with new passes are updated. Signed-off-by: webbeef <me@webbeef.org>
* script: Implement CSSStyleSheet constructor (#36521)Oriol Brufau6 days5-10/+119
| | | | | | | | https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssstylesheet Testing: covered by WPT This is part of #36162 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Remove two outdated TODO comments in HTMLScriptElement (#36540)Simon Wülker6 days1-7/+14
| | | | | | We support both the "referrerpolicy" and the "nonce" attribute on script elements, just not where the spec tells us to do it. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Make DOMException serializable (#36535)Kingsley Yung6 days2-2/+88
| | | | | | | | | | | Follow the implementation of making DOMPoint and DOMPointReadOnly serializable in PR #35989 Testing: Passed a test previously expected to fail. Fixes: #36463 --------- Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
* Unify media query and media query list parsing (#36520)Oriol Brufau6 days4-123/+64
| | | | | | | | | | Several places were using identical logic in order to parse a media queries or media query lists. This patch centralizes the logic into 2 new helper methods in MediaList. Testing: not needed (no behavior change) Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Revert "compositor: Unify the cross process and in-process API (#36443)" ↵Martin Robinson6 days2-4/+7
| | | | | | | | | | | | | (#36533) This reverts commit 4c55104b36c7b858a117a6dd90a5dc21b74324d1. This commit introduced an issue where messages from script to the compositor no longer woke up the embedder. There is a larger issue here, but this change exacerbated it. Fixes #36528. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Transfer ReadableStream (#36181)Gregory Terzian6 days7-56/+864
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | <!-- Please describe your changes on the following line: --> Add transfer support to ReadableStream. Part of https://github.com/servo/servo/issues/34676 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Implement CSP check for Trusted Types (#36363)Tim van der Lippe7 days1-3/+12
| | | | | | | | | | | | | | The algorithm [1] is implemented in the content-security-policy package. Requires https://github.com/rust-ammonia/rust-content-security-policy/pull/56 This is part of #36258 [1]: https://w3c.github.io/trusted-types/dist/spec/#abstract-opdef-should-trusted-type-policy-creation-be-blocked-by-content-security-policy Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* async clipboard: implement `writeText` (#36498)Gae247 days5-0/+151
| | | | | | | | | | 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>
* Remove HTMLStyleElement::line_number (#36507)Simon Wülker8 days1-2/+0
| | | | | This field is unused. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update FetchTaskTarget to propagate CSP violations. (#36409)Tim van der Lippe8 days19-18/+180
| | | | | | | | | | | | | | | | | | It also updates the FetchResponseListener to process CSP violations to ensure that iframe elements (amongst others) properly generate the CSP events. These iframe elements are used in the Trusted Types tests themselves and weren't propagating the violations before. However, the tests themselves are still not passing since they also use Websockets, which currently aren't using the fetch machinery itself. That is fixed as part of [1]. [1]: https://github.com/servo/servo/issues/35028 --------- Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* add CanGc as argument to methods in HTMLInputElement, HTMLLinkElement (#36504)Yerkebulan Tulibergenov8 days3-24/+21
| | | | | | | | add CanGc as argument to methods in HTMLInputElement, HTMLLinkElement Testing: These changes do not require tests because they are a refactor. Addresses part of https://github.com/servo/servo/issues/34573. Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Support optional message for dataclone error (#36308)Jerens Lensun8 days6-9/+60
| | | | | | | | | | | | | | | | | | | | | | | - [x] our [DataClone error](https://github.com/servo/servo/blob/d733abfca02cdb9fd2af4f0d82ff050e25f71829/components/script/dom/bindings/error.rs#L80) needs to support an optional message - [x] we need to add support to our DOMException implementation to allow an optional message to replace the default message - [x] we need to create a new struct used by both StructuredDataReader and StructuredDataWriter for storing the error message in the report_error_callback - [x] report_error_callback needs to cast the closure pointer to the new struct - [x] the code that [throws a DataClone error](https://github.com/servo/servo/blob/5d1c64dba9cf3e65f770370eb17f00ad4114edce/components/script/dom/bindings/structuredclone.rs#L542) needs to use the stored error message if it's available Testing: *Describe how this pull request is tested or why it doesn't require tests* Fixes: #36191 --------- Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>
* add CanGc as argument to methods in HTMLCollection, HTMLDataListElement, ↵Yerkebulan Tulibergenov9 days13-56/+53
| | | | | | | | | | | | HTMLDialogElement, HTMLElement, HTMLFieldSetElement, HTMLFormControlsCollection, HTMLFormElement, HTMLIFrameElement (#36495) add CanGc as argument to methods in HTMLCollection, HTMLDataListElement, HTMLDialogElement, HTMLElement, HTMLFieldSetElement, HTMLFormControlsCollection, HTMLFormElement, HTMLIFrameElement Testing: These changes do not require tests because they are a refactor. Addresses part of https://github.com/servo/servo/issues/34573. Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* script: Clean up CSP management code (#36493)chocolate-pie9 days3-85/+130
| | | | | | | | | | | Current implementation takes arguments for specifying values of violation report, but is difficult to understand which value should be passed. These changes create new builder for violation report to address the issue. Testing: These changes do not require tests because they just refactor current code Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
* add CanGc as argument to methods in ElementInternals, GlobalScope, ↵Yerkebulan Tulibergenov9 days9-23/+25
| | | | | | | | | | | HTMLAnchorElement, HTMLAreaElement, HTMLCanvasElement (#36492) add CanGc as argument to methods in ElementInternals, GlobalScope, HTMLAnchorElement, HTMLAreaElement, HTMLCanvasElement Testing: These changes do not require tests because they are a refactor. Addresses part of https://github.com/servo/servo/issues/34573. Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Implement "Create a Trusted Type" algorithm (#36454)Tim van der Lippe9 days2-25/+179
| | | | | | | | | | | | | | | | | | | | | | | | | This algorithm is quite straightforward written in the specification, but leads to some type awkwardness in Rust. Most notably, the callbacks have different types and cannot be unified easily. They also return different string types. Similarly, the returning objects are all unique types and don't have a common denominator. Therefore, rather than implementing it in 1-to-1 fashion with the specification text, it instead uses callbacks to instruct the type system of what to call when. This is further complicated by the fact that the callback can exist or not, as well as return a value or not. This requires multiple unwrangling, combined with the fact that the algorithm should throw or not. All in all, the number of lines is relatively low compared to the specification algorithm and the Rust compiler does a lot of heavy lifting figuring out which type is what. Part of https://github.com/servo/servo/issues/36258 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Update ProgressEvent to use doubles (#36487)Sebastian C9 days3-13/+20
| | | | | | | See: https://github.com/whatwg/xhr/pull/394 Testing: WPT tests exist for this Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* compositor: Unify the cross process and in-process API (#36443)Martin Robinson9 days2-7/+4
| | | | | | | | | | | | | | | | | | | | | | Because there used to be two traits exposing messages to the compositor, there were two kinds of messages that could be sent: 1. In-process messages from the `Constellation` 2. Cross-process messages from other parts of Servo Now these two types of messages can be unified into one type. With that done the compositor can simply keep a single `IpcReceiver` for all messages, instead of having to set up a route for the cross-process messsages. This decreases overhead of cross proceses messages a bit, but more importantly solves an issue where Servo would rely on the compositor's cross-process message route after the `Constellation` had called `ROUTER.shutdown()`. This is part of #36442. Testing: This is covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* textinput: position the caret at the end when selecting input (#36478)webbeef10 days1-6/+12
| | | | | | | | | | | When clicking on a text input element, we currently position the caret at the very beginning, even if there is already text present. That makes is annoying when you want to add text, and doesn't match what other browsers do. Instead, this change positions the caret at the end of the current text. Testing: Not covered by any wpt tests (rightly so I think). Signed-off-by: webbeef <me@webbeef.org>
* fix: File to FormData not correctly handling name and lastModified (#36458)Sebastian C10 days2-5/+7
| | | | | | | | | | | Set File's lastModified when reconstructing from Blob for FormData Remove special character replacement in fileName (spec removed this step) Testing: WPT tests exist Fixes: #22744 (if I undertand the issue correctly the filename issue was already fixed and now this fixes the lastModified part) Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* Implement attribute and property lookup for Trusted Types (#36422)Tim van der Lippe10 days1-11/+131
| | | | | | | | These algorithms are used to check whether an attribute/property can accept a Trusted Type. Part of #36258 Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
* Handle HTTP Refresh header (#36393)Sebastian C10 days4-117/+127
| | | | | | | | | | | | | | | Move parsing of Refresh values to Document. Send Refresh header to Document and have meta tags reuse the logic. I transplanted the existing Regex and made some updates so that it passed all the existing parser tests. I added the comments that made sense but it is not very clean to add many comments within the regex. Testing: There are existing WPT tests --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* dom: should change media element's currentSrc to children source element's ↵TIN TUN AUNG11 days2-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | src in resource selection algorithm. (#36408) Set the `htmlmediaelement`'s `currenSrc` in resource-selection-algorithm. Change the `htmlsourceelement`'s src and srcset to USVString type. According to [Spec](https://html.spec.whatwg.org/multipage/media.html#concept-media-load-algorithm), Step 9.3 for mode is children, should set the `currentSrc` to `src` of children `htmlsourceelement`. Also, In the `htmlsourceelement` [interface definition](https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element), the `src` and `srcset` attribute should be type `USVString`. Testing: More WPT tests related to resource selection algorithm are passing. Fix: Some spec fix [Try](https://github.com/rayguo17/servo/actions/runs/14347535616) cc @xiaochengh Signed-off-by: rayguo17 <rayguo17@gmail.com>