aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/resource_thread.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Webdriver delete cookie (#36306)Euclid Ye2025-04-041-0/+8
| | | | | | | | | | 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-011-10/+2
| | | | | | | | | | | | | | | | | | | | | | | - Remove `EmbedderMethods::get_user_agent_string`. This is now part of the `Preferences` data structure, which should allow it to be per-`WebView` in the future. - Remove `EmbedderMethods::get_version_string`. This was used to include some data along with WebRender captures about the Servo version. This isn't really necessary and it was done to replace code in the past that output the WebRender version, so also isn't what the original code did. I think we can just remove this entirely. The idea with these changes is that `EmbedderMethods` can be removed in a followup and the rest of the methods can be added to `ServoDelegate`. These two methods are ones that cannot be added to a delegate as they are used during `Servo` initialization. Testing: There is currently no testing for libservo. These changes are meant as preparation for adding a suite of `WebView` unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* 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>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-4/+7
| | | | | | | | | | | | | * 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>
* libservo: Convert `intercept_web_resource_load` into `load_web_resource` ↵Martin Robinson2025-02-211-5/+5
| | | | | | | | | | | | | | | | | | | | | (#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>
* Implement WebResourceRequested Event. (#34961)zhuhaichao5182025-01-161-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-141-2/+2
| | | | | | | | | | | | | | | | | | | 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 minimal implementation of FetchParams (#34833)arthmis2025-01-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: Use `RequestId` to cancel fetches instead of creating an IPC channel ↵Martin Robinson2025-01-111-19/+59
| | | | | | | | | | | | | | | | | | (#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>
* Update all network-related dependencies to the latest versions (#34630)Josh Matthews2025-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update all network-related dependencies to the latest versions: * rustls * hyper * http * headers * tungstenite * async-tungstenite Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix panics with 1xx responses in WPT tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use reported response length when calculating available ranges. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Clean up commented fragments in blob and file handlers. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Remove unreachable match arm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix clippy warning. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Cleanup. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Fix up unit tests for dependency upgrades. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update aws-lc-sys to fix Windows builds. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * net: Use ring instead of aws-lc-sys. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * embedding: Require embedder to initialize a rustls CryptoProvider. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Disable aws-lc-rs pending OhOS build fixes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Prompt user for credentials when http request needs it (#34620)arthmis2024-12-281-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * prompt user to get their credentials Signed-off-by: Lloyd Massiah artmis9@protonmail.com move credential prompt to a function Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add prompt for step 15.4 Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add new prompt definition for user credentials Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove default implementation for HttpState which allowed making the embedder_proxy non-optional - default implementation was only used in tests so created an alternative create_http_state function Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> add credentials to authentication cache Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add tests that are successful for the happy path Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add test for user cancels prompt and user inputs incorrect credentials, and refactor shared code between tests Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * handle error when setting username and password in Url and ran formatting Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> renaming test functions Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * change authentication flag to false for proxy authentication. The spec doesn't specify that the flag should be true, and the flag is by default false Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * clean up test code a bit Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * add skeleton implementation to support open harmony and android Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * update warning message to include Android Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * fix build error for OH os and Android Signed-off-by: Lloyd Massiah <artmis9@protonmail.com> * remove unused import to fix warning 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>
* Add prefs to limit threadpool sizes (#34478)Jonathan Schwender2024-12-071-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | * Add prefs to limit threadpool sizes Add preferences to control the size of threadpools, so that we can easily reduce the amount of runtime threads and test which pools benefit from more threads. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> * Add pref for Webrender threadpool Add a preference to limit the size of the webrender threadpool. Note: WebRender by default calls hooks which register the threads with a profiler instance that the embedder can register with webrender. Servo currently doesn't register such a profiler with webrender, but in the future we might also want to profile the webrender threadpool. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com> --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* make protocol handlers registrable (#33104)webbeef2024-08-221-14/+48
| | | Signed-off-by: webbeef <me@webbeef.org>
* dependencies: Upgrade `cookie` and rename Servo's `Cookie` to `ServoCookie` ↵Martin Robinson2024-07-261-4/+6
| | | | | | | | | | | | | | (#32861) This changes updates to the new version of the `cookie` crate in Servo which no longer uses the old `time@0.1` data types. This requires using a new version of `time` while we transition off of the old one. This is the first step in that process. In addition, the overloading of the `cookie::Cookie` name was causing a great deal of confusion, so I've renamed the Servo wrapper to `ServoCookie` like we do with `ServoUrl`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Net: fold websocket and http tokio runtime into one (#31771)tannal2024-03-211-1/+2
| | | | | | | | | * net: use the same tokio runtime in websocket loader #31648 * readability * license
* fix: missing thread name when spawning (#31656)Ngo Iok Ui (Wu Yu Wei)2024-03-141-0/+1
| | | | | * Add missing thread name when spawning * Update namings
* clippy: Fix warnings in `components/net` (#31626)eri2024-03-131-3/+4
| | | | | * clippy: fix warnings in `components/net` * fix: review comments
* clippy: fix warnings in components/net (#31564)eri2024-03-101-16/+14
| | | | | | | * clippy: fix some warnings in components/net * fix: review comments * fix: tidy
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-31/+30
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+2
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Switch to rustls and webpki-roots (#30025)Martin Robinson2023-08-081-38/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change replaces OpenSSL with rustls and also the manually curated CA certs file with webpki-roots (effectively the same thing, but as a crate). Generally speaking the design of the network stack is the same. Changes: - Code around certificate overrides needed to be refactored to work with rustls so the various thread-safe list of certificates is refactored into `CertificateErrorOverrideManager` - hyper-rustls takes care of setting ALPN protocols for HTTP requests, so for WebSockets this is moved to the WebSocket code. - The safe set of cypher suites is chosen, which seem to correspond to the "Modern" configuration from [1]. This can be adjusted later. - Instead of passing a string of PEM CA certificates around, an enum is used that includes parsed Certificates (or the default which reads them from webpki-roots). - Code for starting up an SSL server for testing is cleaned up a little, due to the fact that the certificates need to be overriden explicitly now. This is due to the fact that the `webpki` crate is more stringent with self-signed certificates than SSL (CA certificates cannot used as end-entity certificates). [2] 1. https://wiki.mozilla.org/Security/Server_Side_TLS 2. https://github.com/briansmith/webpki/issues/114 Fixes #7888. Fixes #13749. Fixes #26835. Fixes #29291.
* Make sender and receiver name more coherentatbrakhi2023-05-081-8/+8
|
* Upgrade HyperNaveen Gattu2022-01-161-77/+56
|
* Non-blocking network IONaveen Gattu2021-12-231-38/+52
|
* Make reload button clear the network cache.Josh Matthews2020-07-271-0/+3
|
* net: Replace ws-rs with async-tungstenite.Josh Matthews2020-07-081-3/+4
|
* net: Allow SSL websockets to use dynamic list of certs as well.Josh Matthews2020-06-091-0/+2
|
* net: Pass certs that fail the SSL handshake out of the network layer.Josh Matthews2020-06-091-10/+26
|
* net: Add an SSL verification callback to support checking a dynamic list of ↵Josh Matthews2020-06-091-6/+12
| | | | certs.
* net: shutdown async runtime on exitGregory Terzian2020-05-301-2/+5
|
* allow for a service worker network mediator per originGregory Terzian2020-04-051-5/+7
|
* add a fetch token for blob urlsGregory Terzian2020-02-211-1/+34
|
* add a core resource thread-poolGregory Terzian2020-02-141-8/+143
|
* Cookies are now expired immediately before each lookupPatrick Shaughnessy2020-01-241-0/+2
|
* Fix some warnings in future Rust nightliesSimon Sapin2020-01-021-13/+4
|
* Let hyper automatically add a host header for HTTP/1Jan Andre Ikenmeyer2019-12-161-3/+3
|
* Disable H2 ALPN.Josh Matthews2019-12-131-3/+3
|
* Add ALPN and signature algorithms to OpenSSL configJan Andre Ikenmeyer2019-11-301-3/+3
|
* Use HSTS preload list for private HttpState, too.Jan Andre Ikenmeyer2019-11-101-6/+18
|
* continue messageport, transferable, postmessage optionsGregory Terzian2019-10-191-2/+2
|
* http-cache: wait on pending storesGregory Terzian2019-10-081-0/+1
| | | | and various small improvements
* Move ResourceFetchTiming into ArcJaved Nissar2019-09-181-1/+2
| | | | | | | | | | | The purpose of this commit is to ensure that the Response object has access to Timing updates as previously the Response object simply stored a ResourceFetchTiming struct so updates on ResourceFetchTiming that were not explicitly done on the Response would not be passed down. The references to ServoArc are added because Response uses servo_arc::Arc rather than std::sync::Arc as is used elsewhere. So, we've switched those other places to servo_arc::Arc instead of switching Response to std::sync::Arc.
* Responding to review commentsAlan Jeffrey2019-09-111-1/+2
|
* Prefetch img and scripts during parsingAlan Jeffrey2019-09-101-3/+8
|
* Net: removed opts::get() usageoneturkmen2019-06-061-8/+27
|
* Auto merge of #22769 - gterzian:use_thread_pool_in_resource_thread, r=noxbors-servo2019-04-191-36/+37
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a threadpool for fetch <!-- 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: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #22768 (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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22769) <!-- Reviewable:end -->
| * use a threadpool for fetchGregory Terzian2019-04-181-36/+37
| |
* | Add webdriver deletecookies functionaditj2019-04-191-0/+8
|/
* Implementing the builder pattern for RequestInitLucas Fantacuci2019-04-101-6/+6
|