aboutsummaryrefslogtreecommitdiffstats
path: root/components/net
Commit message (Collapse)AuthorAgeFilesLines
* Support CSP report-only header (#36623)Tim van der Lippe4 days1-16/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Initial support for marking custom protocol secure (#36656)Tony5 days2-16/+52
| | | | | | | | | | | | | | | | | | | | | | | Add initial support for marking custom protocol as secure, this makes it possible to `fetch` a custom protocol inside secure contexts (e.g. http://localhost) Some additional contexts: - [#embedding > Custom protocol secure context](https://servo.zulipchat.com/#narrow/channel/437943-embedding/topic/Custom.20protocol.20secure.20context) - https://github.com/versotile-org/tauri-runtime-verso/issues/6#issuecomment-2820776128 Testing: use `fetch('urlinfo://abc').then(async (response) => console.log(await response.text())).catch(console.log)` in servoshell with in a secure context (e.g. https://servo.org), and see the response should not be an error --------- Signed-off-by: Tony <legendmastertony@gmail.com> Signed-off-by: Tony <68118705+Legend-Master@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Return Result from ProtocolRegistry::register() (#36688)Jonathan Schwender5 days1-7/+25
| | | | | | | | Instead of returning true / false it's better to return a Result (even if we continue ignoring possible error). Testing: Doesn't change any behavior Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Prevent multiple notifications for image dimensions (#36600)Barigbue Nbira11 days1-9/+11
| | | | | | | | | | | | | Added a simple check to only perform metadata extraction and listener notification when we haven't already processed the metadata for an image Testing: Existing tests should cover if we break decoding image metadata complete. Fixes: #36502 --------- Signed-off-by: Barigbue <barigbuenbira@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Refactor common infrastructure for creating memory reports. (#36579)Josh Matthews12 days2-22/+11
| | | | | | | | | 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>
* resources: Remove baked in resources (#36042)Jonathan Schwender13 days1-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows removing a LazyLock around the resources. We override the baked in resources unconditionally in servoshell upon initialization anyway ([desktop](https://github.com/servo/servo/blob/9f93ccd9427265f39f1a2de38389fec0e80f7bea/ports/servoshell/desktop/cli.rs#L15), [android](https://github.com/servo/servo/blob/9f93ccd9427265f39f1a2de38389fec0e80f7bea/ports/servoshell/egl/android/simpleservo.rs#L49), [ohos](https://github.com/servo/servo/blob/9f93ccd9427265f39f1a2de38389fec0e80f7bea/ports/servoshell/egl/ohos/simpleservo.rs#L43) ), meaning that the baked in resources are unused in servoshell. For 3rd-party embedders, we probably also want to the let them know early that they should initialize the resources, instead of restricting the panics to production mode. Rippy is the only resource which was required. Since it is only 253 bytes large, we just bake that resource in as a fallback. We do want to make using the resources easy from tests, so we add some logic to keep the baked in resources for tests only and initialize the resource reader on first access. --- <!-- 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 - [ ] These changes fix #___ (GitHub issue number if applicable) - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* net: Report memory usage for image cache. (#36556)Josh Matthews14 days1-2/+36
| | | | | | | | | 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>
* net: Measure HSTS memory usage. (#36558)Josh Matthews14 days3-24/+27
| | | | | | | | Records the memory usage of the HSTS lists in the network thread. Testing: Verified the presence of the new reports for servo.org. Fixes: #35059 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Update FetchTaskTarget to propagate CSP violations. (#36409)Tim van der Lippe2025-04-136-13/+50
| | | | | | | | | | | | | | | | | | 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>
* Manually concatenate ACRH headers to not include a space (#36455)Sebastian C2025-04-112-9/+14
| | | | | | | | | | | | headers library will join values with `, ` (comma space) but Access-Control-Request-Headers specifies that it does not use the normal combining algorithm and values should be joined with `,` (comma). Testing: WPT tests exist Fixes: temporary fix for #36451 until hyperium/headers#207 is fixed --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* `compositing`: Combine `webrender_traits` and `compositing_traits` (#36372)Martin Robinson2025-04-062-2/+2
| | | | | | | | | | | | | | | These two traits both exposed different parts of the compositing API, but now that the compositor doesn't depend directly on `script` any longer and the `script_traits` crate has been split into the `constellation_traits` crate, this can be finally be cleaned up without causing circular dependencies. In addition, some unit tests for the `IOPCompositor`'s scroll node tree are also moved into `compositing_traits` as well. Testing: This just combines two crates, so no new tests are necessary. Fixes: #35984. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Make the memory reporting multi-process aware (#35863)webbeef2025-04-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | So far the memory reporter aggregates reports from all processes, and runs the system reporter only in the main process. Instead it is desirable to have per-process reports. We do so by: - creating a ProcessReports struct that holds includes the pid in addition to the reports themselves. - running the system memory reporter also in content processes. - updating the about:memory page to create one report per process, and add useful information like the pid and the urls loaded in a given process. <!-- Please describe your changes on the following line: --> --- <!-- 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 ![image](https://github.com/user-attachments/assets/0bafe140-539d-4d6a-8316-639309a22d4a) Signed-off-by: webbeef <me@webbeef.org>
* Check all ancestor navigable trustworthiness for mixed content (#36157)Sebastian C2025-04-052-12/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | Propagate through documents a flag that represents if any of the ancestor navigables has a potentially trustworthy origin. The "potentially trustworthy origin" concept appears to have gotten confused in a couple of places and we were instead testing if a URL had "potentially trustworthy" properties. The main test for the ancestor navigables is [mixed-content/nested-iframes](https://github.com/web-platform-tests/wpt/blob/master/mixed-content/nested-iframes.window.js) --- <!-- 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 #36108 <!-- Either: --> - [X] There are tests for these changes --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* Webdriver delete cookie (#36306)Euclid Ye2025-04-042-0/+19
| | | | | | | | | | 1. Implement `WebDriverCommand::DeleteCookie` 2. Remove unnecessary clone for `WebDriverCommand::GetNamedCookie` Fixes: #36287 --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* libservo: Remove a couple `EmbedderMethods` (#36276)Martin Robinson2025-04-014-15/+4
| | | | | | | | | | | | | | | | | | | | | | | - 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>
* Refuse to provide partial response from earlier ranged request to API that ↵Simon Wülker2025-03-313-13/+46
| | | | | | | did not make a range request (#36227) Part of https://github.com/servo/servo/issues/33616 Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Organize component Cargo.toml dependencies (#36224)Alex Touchet2025-03-301-4/+4
| | | Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com>
* net: Add missing feature required for unit tests. (#36193)Josh Matthews2025-03-281-1/+1
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* fix: does_settings_prohibit_mixed_security_contexts typo (#36135)Arya Nair2025-03-241-2/+2
| | | Signed-off-by: Arya Nair <aryaajitnair@gmail.com>
* pixels: Extend Image to allow for multiple frames (#36058)TIN TUN AUNG2025-03-211-3/+4
| | | Signed-off-by: rayguo17 <rayguo17@gmail.com>
* Create `config_dir` if none exist for caching (#35761)Euclid Ye2025-03-181-3/+3
| | | | | | | | | | | | | | | | | | | | | * Create config_dir if none exist for caching Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * remove specialized behaviour for ohos; copy prefs.json if necessary Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * downgrade the log to trace verbosity Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * update wpt-test Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
* Migrate to the 2024 edition (#35755)Simon Wülker2025-03-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | * Migrate to 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Allow unsafe_op_in_unsafe_fn lint This lint warns by default in the 2024 edition, but is *way* too noisy for servo. We might enable it in the future, but not now. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Compile using the 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Implement `nonce` attribute to pass more CSP checks (#35876)Simon Wülker2025-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add doc comments to RequestBuilder fields/methods Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement Request::cryptographic_nonce_metadata Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement HTMLOrSVGElement::nonce Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Set request cryptographic nonce metadata for link elements Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Set request's cryptographic nonce when fetching scripts Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Forward request nonce to rust-content-security-policy 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>
* Add an about:memory page (#35728)webbeef2025-03-071-0/+13
| | | | | | | | | | | | | | | | | 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-0323-262/+336
| | | | | | | | | | | | | * 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>
* Don’t prompt user for credentials for non-Navigate request (#35664)Isaac Marovitz2025-02-262-1/+57
| | | Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
* Update to rust 1.85 (#35628)Simon Wülker2025-02-245-15/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | * Update to rust 1.85 This is needed for cargo-deny Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Upgrade crown Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Clippy fixes Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Re-upgrade cargo-deny to 0.18 Keeping it locked to 0.18 just in case they update their required rustc version again Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* libservo: Convert `intercept_web_resource_load` into `load_web_resource` ↵Martin Robinson2025-02-217-130/+107
| | | | | | | | | | | | | | | | | | | | | (#35564) Rework the `WebViewDelegate::intercept_web_resource_load` into `WebViewDelegate::load_web_resource` and clean up internal messaging. The main thing here is adding objects which manage the response to these delegate methods. Now we have `WebResourceLoad` and `InterceptedWebResourceLoad` which make it much harder to misuse the API. In addition, the internal messaging for this is cleaned up. Canceling and finishing the load are unrelated to the HTTP body so they are no longer subtypes of an HttpBodyData message. Processing of messages is made a bit more efficient by collecting all body chunks in a vector and only flattening the chunks at the end. Finally, "interceptor" is a much more common spelling than "intercepter" so I've gone ahead and made this change everywhere. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* net: Use the unfiltered response status when comparing against cached ↵Josh Matthews2025-02-161-2/+4
| | | | | resources. (#35483) Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* libservo: Add a delegate method for HTTP authentication (#35400)Martin Robinson2025-02-103-74/+55
| | | | | | | | | | | | Add a delegate method for HTTP authentication and a related `AuthenticationRequest` object that carries with it the URL as well as whether or not the authentication request is for a proxy or not. This is now separate from the prompt API because requesting authentication doesn't necessarily involve prompting -- this is an implementation detail of the embedder. In addition, the internal bits are cleaned up slightly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Remove unintended `dbg!` from `components/net/fetch/methods.rs` (#35401)Samson2025-02-101-1/+0
| | | | | It was accidentally introduced in https://github.com/servo/servo/pull/34794 Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
* Add support for Upgrade a mixed content request. (#34794)Shubham Gupta2025-02-101-4/+52
| | | Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
* Modify the checks for upgrade-request algorithm (#35357)Shubham Gupta2025-02-072-9/+4
| | | Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
* deps: Upgrade to `webrender@0.66` (#35325)Martin Robinson2025-02-072-2/+2
| | | | | | | | | In addition to some small API changes, this downstream version of WebRender no longer depends on a very old version of time. This is the last step toward removing the dependency on `time0.1`. The review for this commit should also include: https://github.com/servo/webrender/commit/9f552bebab81a73e62068c42d94be2f9c0586ce4 Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Cleanup blocking fetch operations with bad ports (#35324)Simon Wülker2025-02-062-43/+22
| | | | | | | | | | | Blocking a fetch due to a bad port should be grouped together with CSP blocks as per the spec, but these steps were previously seperated. Additionally, remove handling of ftp in should_request_be_blocked_due_to_a_bad_port, since it did nothing anyways. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add support for Upgrade request to a potentially trustworthy URL. (#34986)Shubham Gupta2025-02-052-6/+91
| | | | | | | | | | | | | | | | * Add support for Upgrade request to a potentially trustworthy URL. Signed-off-by: Shubham Gupta <shubham13297@gmail.com> * script: Support inheritable insecure request policy in documents and workers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Shubham Gupta <shubham13297@gmail.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Shubham Gupta <shubham.gupta@chromium.org> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* servoshell: Migrate to egui-file-dialog from tinyfiledialogs (#34823)chickenleaf2025-02-042-4/+4
| | | | | | This is the first step toward completely replacing tinyfiledialogs with an egui-based solution. Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* Update implementations of `HTTP-network fetch` and `HTTP-network-or-cache ↵arthmis2025-02-041-26/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | fetch` to take `fetchParams` as an argument (#35205) * change http-network-or-cache-fetch to take FetchParams argument instead of request Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * change http-network-fetch to take fetchParams as an argument Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * run formatter Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * renaming variable to be similar to step in spec Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refixing usage of http_request after rebasing Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> --------- Signed-off-by: Lloyd Massiah <artmis9@protonmail.com>
* Use aws-lc-rs as rust-tls provider (#35106)Jonathan Schwender2025-01-302-2/+2
| | | Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Include `WebViewId` into EmbedderMsg variants where possible (#35211)Delan Azabani2025-01-3010-136/+147
| | | | | | | | | | | | | | | | | `EmbedderMsg` was previously paired with an implicit `Option<WebViewId>`, even though almost all variants were either always `Some` or always `None`, depending on whether there was a `WebView involved. This patch adds the `WebViewId` to as many `EmbedderMsg` variants as possible, so we can call their associated `WebView` delegate methods without needing to check and unwrap the `Option`. In many cases, this required more changes to plumb through the `WebViewId`. Notably, all `Request`s now explicitly need a `WebView` or not, in order to ensure that it is passed when appropriate. Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: Do not set up an IPC route for every image load (#35041)Martin Robinson2025-01-251-46/+7
| | | | | | | | | | | | Instead of setting up a route for every image load in the DOM / Layout, route all incoming image cache responses through the `ScriptThread`. This avoids creating a set of file descriptor for every image that is loaded. This change requires having the `ImageCache` track the `PipelineId` of the original the listener so that the `ScriptThread` can route it properly to the correct `Window`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Remove `Preferences::network_tls_ignore_unexpected_eof` (#35080)Martin Robinson2025-01-201-4/+1
| | | | | | | This workaround was introduced to handle an issue with the WPT server, but it seems that it is no longer needed. This change removes the prefernce and the workarond code. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Implement WebResourceRequested Event. (#34961)zhuhaichao5182025-01-166-8/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement WebResourceRequested Event on the Embedder Layer Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * fix and add test Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * resolve comments Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * remove sample code in webview Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * remove typo Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * ./mach format Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * fix test fail caused by interception message Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> * update impl for is_for_main_frame Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com> --------- Signed-off-by: zhuhaichao518 <zhuhaichao518@gmail.com>
* api: Flatten and simplify Servo preferences (#34966)Martin Robinson2025-01-149-16/+20
| | | | | | | | | | | | | | | | | | | Flatten and simplify Servo's preferences code. In addition, have both preferences and options passed in as arguments to `Servo::new()` and make sure not to use the globally set preferences in `servoshell` (as much as possible now). Instead of a complex procedural macro to generate preferences, just expose a very simple derive macro that adds string based getters and setters. - All command-line parsing is moved to servoshell. - There is no longer the concept of a missing preference. - Preferences no longer have to be part of the resources bundle because they now have reasonable default values. - servoshell specific preferences are no longer part of the preferences exposed by the Servo API. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add Content Range Header and add one for blob end range (#34797)TIN TUN AUNG2025-01-141-6/+43
| | | Signed-off-by: rayguo17 <rayguo17@gmail.com>
* add minimal implementation of FetchParams (#34833)arthmis2025-01-129-154/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add minimal implementation of fetchParams and fetch controller for cancellation support fix something removing fetch params from http network or cache fetch due to implementation difficult Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * run formatter Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix incorrect spec implementation and add comments with related step number and description Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix double borrow issue Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove unused code from FetchParams Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add workaround for double mutable borrow error Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove unnecessary comments, move import and format Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix comments that state spec instructions Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * update comment Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refactor tests Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * refactor tests Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> --------- Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> Co-authored-by: lazypassion <25536767+lazypassion@users.noreply.github.com>
* net: Raed RippyPNG resource once at startup. (#34954)Josh Matthews2025-01-121-3/+1
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* net: Use `RequestId` to cancel fetches instead of creating an IPC channel ↵Martin Robinson2025-01-116-54/+80
| | | | | | | | | | | | | | | | | | (#34883) Instead of creating an IPC channel for every fetch, allow cancelling fetches based on the `RequestId` of the original request. This requires that `RequestId`s be UUIDs so that they are unique between processes that might communicating with the resource process. In addition, the resource process loop now keeps a `HashMap` or `Weak` handles to cancellers and cleans them up. This allows for creating mutiple `FetchCanceller`s in `script` for a single fetch request, allowing integration of the media and video elements to integrate with the `Document` canceller list -- meaning these fetches also get cancelled when the `Document` unloads. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Move navigation fetching to the `ScriptThread` (#34919)Martin Robinson2025-01-102-22/+4
| | | | | | | | | | | | | | | | | | | | 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>
* Add http2 feature for hyper-util (#34920)Oriol Brufau2025-01-091-1/+1
| | | | | This fixes an error when running `./mach clippy -r -p layout_2020`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>