aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
Commit message (Collapse)AuthorAgeFilesLines
* Determine if ResizeTo is allowed (#36704)Taym Haddadi31 hours1-1/+11
| | | | | | | | | Spec says to check If target is not an auxiliary browsing context before performing ResizeTo. Fixes: #36701 Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
* Use snapshot size instead of canvas size when converting canvas to blob (#36705)Simon Wülker46 hours1-11/+19
| | | | | | | | | | | | | The blob data is encoded asynchronously, therefore the canvas size may have changed since it's data was saved to a snapshot. Using the canvas size confuses the encoder, because the provided data does not match the expected size anymore. Testing: This change includes a new web platform test Fixes https://github.com/servo/servo/issues/36702 --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* layout: Use box tree `Fragment`s for offset parent queries (#36681)Martin Robinson3 days1-1/+4
| | | | | | | | | | | | | | | | | | | | | | | This change switches `offsetParent`, `offsetLeft`, etc queries to use the BoxTree fragments instead of walking the entire fragment tree. In addition, fragments are stored for columns and colgroups. In general, this greatly simplifies the flow of the query and prevents having to do expensive tree walks. Testing: This change is covered by newly passing WPT tests and three new failures: - /css/filter-effects/backdrop-filter-edge-clipping-2.html - /css/filter-effects/backdrop-filter-edge-mirror.html - /css/filter-effects/backdrop-filter-edge-pixels-2.html These failures are actually progressions, because now the references start to render properly whereas before they did not. Fixes: This is part of #36525 and #36665. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Support CSP report-only header (#36623)Tim van der Lippe3 days1-26/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This turned out to be a full rabbit hole. The new header is parsed in the new `parse_csp_list_from_metadata` which sets `disposition` to `report. I was testing this with `script-src-report-only-policy-works-with-external-hash-policy.html` which was blocking the script incorrectly. Turns out that there were multiple bugs in the CSP library, as well as a missing check in `fetch` to report violations. Additionally, in several locations we were manually reporting csp violations, instead of the new `global.report_csp_violations`. As a result of that, they would double report, since the report-only header would be appended as a policy and now would report twice. Now, all callsides use `global.report_csp_violations`. As a nice side-effect, I added the code to set source file information, since that was already present for the `eval` check, but nowhere else. Part of #36437 Requires servo/rust-content-security-policy#5 --------- Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Signed-off-by: Tim van der Lippe <TimvdLippe@users.noreply.github.com>
* layout: Implement node geometry queries against `BoxTree`'s `Fragment` (#36663)Martin Robinson3 days1-3/+9
| | | | | | | | | | | | | | | | | | This is a followup to #36629, continuing to implement script-based layout queries using the `Fragment`s attached to the `BoxTree`. In this change, geometry queris (apart from parent offset) are calculated using `Fragment`s hanging of the `BoxTree`. In order to make this work, all `Fragment`s for inlines split by blocks, need to be accessible in the `BoxTree`. This required some changes to the way that box tree items were stored in DOM `BoxSlot`s. Now every inline level item can have more than a single `BoxTree` item. These are carefully collected by the `InlineFormattingContextBuilder` -- currently a bit fragile, but with more documentation. Testing: There are tests for these changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Implement static Response.json (#36589)Sebastian C3 days1-97/+151
| | | | | | | | | | | Implements https://fetch.spec.whatwg.org/#dom-response-json Restructured the constructor to follow the spec more closely with a separate "initialize the response" algorithm. Testing: There are existing WPT tests for this. --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* Report exceptions for async script executions to webdriver (#27041)Josh Matthews3 days1-3/+14
| | | | | | | | | | | | | | | | | | | | | Improving the accuracy of the async script execution for our webdriver implementation allows us to run many more webdriver tests without timeouts, which should help with https://github.com/web-platform-tests/wpt/issues/24257. Specification: * https://w3c.github.io/webdriver/#dfn-clone-an-object * https://w3c.github.io/webdriver/#execute-async-script --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #27036 and fix #27035 and fix #27031. - [x] There are tests for these changes (but we don't run them in CI yet) --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* compositor: Tick animations for an entire WebView at once (#36662)Martin Robinson4 days1-28/+2
| | | | | | | | | | | | | | | | | | | | | | | | Previously, when processing animations, the compositor would sent a tick message to each pipeline. This is an issue because now the `ScriptThread` always processes rendering updates for all `Document`s in order to ensure properly ordering. This change makes it so that tick messages are sent for an entire WebView. This means that each `ScriptThread` will always receive a single tick for every time that animations are processed, no matter how many frames are animating. This is the first step toward a refresh driver. In addition, we discard the idea of ticking animation only for animations and or only for request animation frame callbacks. The `ScriptThread` can no longer make this distinction due to the specification and the compositor shouldn't either. This should not really change observable behavior, but should make Servo more efficient when more than a single frame in a `ScriptThread` is animting at once. Testing: This is covered by existing WPT tests as it mainly just improve animation efficiency in a particular case. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Measure stored layout data memory usage. (#36664)Josh Matthews4 days1-1/+0
| | | | | | | | | | | | | | We previously ignored the opaque layout data field inside each node when measuring a DOM node's memory usage. While some of the reachable memory was accounted for by measuring the layout's box tree, measuring it via the node ensures that we don't miss anything. Since there are often Arc values involved, this means that the layout-thread box tree measurements now look quite small, while reported JS heap usage has increased. Testing: Manually compared about:memory for servo.org. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Implement CSSStyleSheet::replaceSync (#36586)webbeef5 days3-1/+36
| | | | | | | Implements the `replaceSync` method on CSSStyleSheet Testing: Covered by wpt tests. Expectations are updated. Signed-off-by: webbeef <me@webbeef.org>
* script: Add generic root storage to StructuredCloneReader. (#36640)Josh Matthews5 days10-126/+73
| | | | | | | | | | | | | This reduces the boilerplate necessary for adding new serializable/transferable interfaces to the structured cloning code. We always need to root the deserialized objects when performing a read operation, but we don't actually need the concrete object types in the majority of cases. By storing a list of rooted JS object values, we can push generic reflector objects into it, and extract the types we need (MessagePort) at the very end. Testing: Existing WPT structured cloning tests will provide coverage. Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* layout: Add a new `FragmentTree` pass to calculate containing block ↵Martin Robinson5 days1-2/+3
| | | | | | | | | | | | | | | | | | | | | | | rectangles (#36629) When doing any kind of query, up until now, containing block rectangles were calculated by walking the `FragmentTree` until the node being queried was found. In order to make possible answering queries without walking the `FragmentTree`, `Fragment`s need to cache their cumulative containing block rectangles. This change adds a new `FragmentTree` pass (during construction) that takes care of calculating and caching these values. The new cached value is used during resolved style queries and also scrolling area queries (with the idea that all queries will eventually use them). In addition, extra `FragmentTree` walks used for cancelling animations for elements no longer in the `FragmentTree` are integrated into this new traversal. Testing: Covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Introduce snapshot concept of canvas (#36119)sagudev5 days8-105/+97
| | | | | | | | | | | | | | | | | | Each canvas context returns snapshot instead of just raw bytes. This allows as to hold off conversions (BGRA <-> RGBA, (un)premultiply) to when/if they are actually needed. For example when loading snapshot into webgl we can load both RGBA and BGRA so no conversion is really needed. Currently whole thing is designed to be able to be extend on https://github.com/servo/ipc-channel/pull/356, to make less copies. Hence some commented out code. Fixes #35759 There are tests for these changes in WPT --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* chore: remove unnecessary `webrender_document` in script (#36648)Jason Tsai6 days1-11/+1
| | | | | | | | | remove `webrender_document` in script and constellation's pipeline Testing: `webrender_document` in script crate is not being referenced anywhere in the Servo, should be safe to remove. Fixes: https://github.com/servo/servo/issues/36647 Signed-off-by: Jason Tsai <git@pews.dev>
* Streams: fix writable transfer sink abort steps (#36638)Gregory Terzian6 days1-1/+1
| | | | | | | | | | Fixes an error where a promise was rejected where it should have been resolved. Follow-up to https://github.com/servo/servo/pull/36588/files#r2049437506; the initial diagnosis was wrong. Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Reduce indexing boilerplate for serializable/transferrable objects. (#36624)Josh Matthews7 days10-155/+77
| | | | | | | | | | | | | | | Rather than creating unique types for each pipeline-namespaced index type (eg. MessagePortId, DomExceptionId, etc.), we can create a generic common type that uses a marker to prevent type confusion. This change allows us to reduce the boilerplate code required when implementing serializable/transferable interfaces, since the structured clone implementation can rely on the common type. Testing: Existing WPT tests for serialization and transferring provide coverage. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Set correct policy-container for worker construction (#36603)Tim van der Lippe7 days4-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 Terzian7 days2-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 Matthews7 days1-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>
* Implement trusted types url setter (#36596)Tim van der Lippe7 days7-3/+220
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Eagerly define interfaces on non-Window globals (#36604)Josh Matthews8 days4-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)saku8 days1-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>
* htmlvideoelement: Include security settings in poster image request (#36605)elomscansio9 days1-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 Burns9 days47-51/+47
| | | | | | | | 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 Matthews9 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 Trivedi10 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>
* Streams: make writable streams transferrable (#36588)Gregory Terzian10 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)sagudev10 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 Matthews11 days1-3/+5
| | | | | | | | | 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 Lippe11 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 Volykhin11 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 Matthews12 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 Haddadi12 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>
* media element: support seekable attribute (#36541)TIN TUN AUNG12 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>
* compositor: Unify the cross process and in-process API (#36543)Martin Robinson13 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)webbeef13 days4-39/+41
| | | | | | | | 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 Brufau13 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ülker13 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 Yung13 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 Brufau13 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 Robinson13 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 Terzian13 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 Lippe2025-04-141-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)Gae242025-04-143-0/+148
| | | | | | | | | | 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ülker2025-04-141-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 Lippe2025-04-1314-12/+135
| | | | | | | | | | | | | | | | | | 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 Tulibergenov2025-04-133-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 Lensun2025-04-136-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 Tulibergenov2025-04-1312-54/+51
| | | | | | | | | | | | 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-pie2025-04-131-12/+12
| | | | | | | | | | | 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>