WaterWhisperer
158bf97e30
script/dom/: Change some #[allow]s to #[expect]s ( #40454 )
...
Removes some unneeded lints, especially `#[allow(unsafe_code)]`.
Testing: Refactor
Part of: #40383
Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com >
2025-11-06 11:06:03 +00:00
Simon Wülker
c4ae451612
Turn all commented links before functions into doccomments ( #40331 )
...
Servo has a lot of comments like this:
```rust
// https://example-spec.com/#do-the-thing
fn do_the_thing() {}
```
and I keep turning these into doc comments whenever I'm working close to
one of them. Doing so allows me to hover over a function call in an IDE
and open its specification without having to jump to the function
definition first. This change fixes all of these comments at once.
This was done using `find components -name '*.rs' -exec perl -i -0777
-pe 's|^([ \t]*)// (https?://.*)\n\1(fn )|\1/// <$2>\n\1$3|mg' {} +`.
Note that these comments should be doc comments even within trait `impl`
blocks, because rustdoc will use them as fallback documentation when the
method definition on the trait does not have documentation.
Testing: Comments only, no testing required
Preparation for https://github.com/servo/servo/pull/39552
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
2025-11-01 05:32:45 +00:00
Tim van der Lippe
4c25039d35
Fully implement request constructor body handling ( #39514 )
...
This aligns the implementation with the spec, where both input body and
init body are now set. In doing so, it fixes a fetch abort test, since
the stream was missing for the input body.
It also introduces the `unusable` method, as that's the one the spec
uses. The other two getters no longer exist in the spec.
Fixes #39448
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com >
2025-09-27 01:52:01 +00:00
Ritoban Dutta
a5c584f72a
script: Replace DomRefCell<bool> with Cell<bool> for Response::redirected ( #39351 )
...
Replace DomRefCell<bool> with Cell<bool> for Response::redirected field.
Changed redirected field from DomRefCell<bool> to Cell<bool> and updated
all related methods:
- Struct field: redirected: DomRefCell<bool> → redirected: Cell<bool>
- Constructor: DomRefCell::new(false) → Cell::new(false)
- Getter method: *self.redirected.borrow() → self.redirected.get()
- Setter method: *self.redirected.borrow_mut() = value →
self.redirected.set(value)
Testing: As noted in the issue, compilation is sufficient for this
change.
Fixes : #39288
Signed-off-by: ritoban23 <ankudutt101@gmail.com >
2025-09-18 15:12:55 +00:00
araya
2947476bdd
Fix Response:bodyUsed behavior to return false if the body is null ( #39287 )
...
This PR fixes some test-cases in
https://wpt.fyi/results/fetch/api/response/response-consume-empty.any.html?product=servo
Fetch standard indicates `Response:bodyUsed` should return `false` if
the body content is null , even if the stream was disturbed.
https://fetch.spec.whatwg.org/#dom-body-bodyused
> The bodyUsed getter steps are to return true if
[this](https://webidl.spec.whatwg.org/#this )’s
[body](https://fetch.spec.whatwg.org/#concept-body-body ) is non-null and
[this](https://webidl.spec.whatwg.org/#this )’s
[body](https://fetch.spec.whatwg.org/#concept-body-body )’s
[stream](https://fetch.spec.whatwg.org/#concept-body-stream ) is
[disturbed](https://streams.spec.whatwg.org/#is-readable-stream-disturbed );
otherwise false.
---------
Signed-off-by: araya <araya@araya.dev >
2025-09-14 08:33:54 +00:00
Martin Robinson
8743a11ba4
tidy: Add a rule ensuring that // comments are followed by a space in Rust ( #38698 )
...
This shows up sometimes in code reviews, so it makes sense that tidy
enforces it. `rustfmt` supports this via comment normalization, but it
does many other things and is still an unstable feature (with bugs).
Testing: There are new tidy tests for this change.
Signed-off-by: Martin Robinson <mrobinson@igalia.com >
2025-08-18 12:09:09 +00:00
Sebastian C
281d942981
Implement static Response.json ( #36589 )
...
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 >
2025-04-25 08:49:21 +00:00
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition ( #35764 )
...
* 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 >
2025-03-03 11:26:53 +00:00
Yerkebulan Tulibergenov
31199076ec
refactor: add CanGc as argument to Promise::reject_native ( #35640 )
...
Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com >
2025-02-25 03:58:36 +00:00
Yerkebulan Tulibergenov
0383ba9a5b
refactor: add CanGc as argument to Promise::resolve ( #35616 )
...
Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com >
2025-02-23 12:12:21 +00:00
Yerkebulan Tulibergenov
245a39c07e
refactor: add CanGc as argument to create_buffer_source ( #35597 )
...
Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com >
2025-02-22 05:42:55 +00:00
Josh Matthews
c94ac5bccb
Move various reflector types and traits to script_bindings ( #35279 )
...
* script: Move Reflector to script_bindings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2025-02-04 06:58:08 +00:00
shanehandley
938baf6bf3
script: Implement the Bytes() method on Request and Response ( #35250 )
...
* Implement the Bytes() method on Request and Response
Signed-off-by: Shane Handley <shanehandley@fastmail.com >
* avoid unsafe code during buffer creation
Signed-off-by: Shane Handley <shanehandley@fastmail.com >
---------
Signed-off-by: Shane Handley <shanehandley@fastmail.com >
2025-02-02 07:49:48 +00:00
Josh Matthews
875e387004
script: Feature-gate all crown support. ( #35055 )
...
* script: Feature-gate all crown support.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* script: Use cfg(crown) instead of a cargo feature.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2025-01-18 21:36:15 +00:00
Josh Matthews
c94d909a86
script: Limit public exports. ( #34915 )
...
* script: Restrict reexport visibility of DOM types.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* script: Mass pub->pub(crate) conversion.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* script: Hide existing dead code warnings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Fix clippy warnings.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Fix unit tests.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Fix clippy.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* More formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2025-01-10 08:19:19 +00:00
Taym Haddadi
bcad0d50e9
ReadableStream: remove the use of get_js_stream and use DomRoot<ReadableStream> ( #34836 )
...
* Remove the use of get_js_stream and use DomRoot<ReadableStream>
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* return an error instead of Option
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
2025-01-05 11:37:15 +00:00
Gregory Terzian
379bbb41dd
Dom: Re-implement ReadableStream Part 1 : Default Reader and Controller ( #34064 )
...
* Re-implement readablestream: basics and default reader and controller
---------
Co-authored-by: Jason Tsai <jason@pews.dev >
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
Add remaining WebIDLs of ReadableStream (#32605 )
* Add Reader's WebIDL files
* Add necessary methods in ReadableStream.webidl
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
Create safe wrapper for JSFunctions (#32620 )
* Create safe wrapper for JSFunctions
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Add assert to check if the name ends in a null character
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Create macro to wrap unsafe extern "C" function calls
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Remove WRAPPER_FN
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Add macro example documentation
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Use C-string literals
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Ensure name is Cstr type
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Scope #[allow(unsafe_code)]
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
---------
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
Start implementation of default controller and reader
Start implementation of default controller and reader
* implement basic internal slots, with todos
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* enum for controller
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* re-implement native controller methods
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* add calling into pull algo
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* more details on chunk enqueuing
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* add fulfill read request, clean-up warnings
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* read request and reader typing
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* allow for more than one non-native underlying source type
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* add todo for should pull
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* add underlying source dom struct container
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* remove rc around source type
* add default controller init in stream constructor
* setup source container with prototype of source dict
* clean-up docs, dispatch of controller in pull algo call
* turn off SM streams
* remove prototype setting on underlying source container
* fix read request promise resolving
* tidy
* clean-up js conversions in read req handlers
* add queue with sizes concept
* use dom in pull promise handlers
* Demonstrate using dictionary as callback this object.
* move value with size to a struct
* fmt
* put readable stream state in a cell
* nits in expectations
* remove allow unroot by passing read result directly to promise resolving
* tidy
* root default controller inside call_pull_if_needed
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Co-authored-by: Josh Matthews <josh@joshmatthews.net >
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
ReadableStream: implement Cancel and Locked (#33136 )
* implement Locked
* implement Cancel and close
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
Add GetPromiseIsHandled and SetAnyPromiseIsHandled to Promise
Signed-off-by: Taym <haddadi.taym@gmail.com >
mach fmt
Signed-off-by: Taym <haddadi.taym@gmail.com >
Readablestream default controller: get desired size (#33497 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
stream: implement controller close (#33498 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
implement stream default controller error (#33503 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Readablestream default controller: enqueue (#33528 )
* Implement ReadableStreamDefaultControllerMethods::Enqueue
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
* Add spec comments
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
---------
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
readablestream default controller: fulfill read requests (#33542 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Fix extract_size_algorithm (#33561 )
Signed-off-by: Wu Wayne <yuweiwu@pm.me >
Readablestream default controller: use strategy size (#33551 )
* readablestream default controller: use strategy size, fallible enqueue
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
docs
* readablestream default controller: clear strategy size
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* prevent potential re-borrow panics when calling into the strategy size
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* document readablestream constructor
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Readablestream: impl default controller should pull, start algo (#33586 )
* implement should-pull algo for default controller
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* add start algorithm setup for default controller
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
implement promise native handling for start and pull algorithms (#33603 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Implement ReadableStreamDefaultReader (#33160 )
* Implement ReadableStreamDefaultReader
Make the stream mutable
readable-stream-reader-generic-release
Proper error types when releasing
Closed
Cancel
Signed-off-by: Taym <haddadi.taym@gmail.com >
* follow the spec more closely
Signed-off-by: Taym <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym <haddadi.taym@gmail.com >
Implement ReadableStreamDefaultReader read (#34007 )
* Implement ReadableStreamDefaultReader read
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Perform readRequest’s error steps with stream.stored_error
Signed-off-by: Taym <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym <haddadi.taym@gmail.com >
Improve ReadableStreamDefaultReader close (#34014 )
* improve ReadableStreamDefaultReader close
Signed-off-by: Taym <haddadi.taym@gmail.com >
* remove resolve_closed_promise
Signed-off-by: Taym <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym <haddadi.taym@gmail.com >
Use Rc<Box<[u8]>> for queue to optimize get_in_memory_bytes
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Improve read_a_chunk and stop_reading implemntation (#34077 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Implement ReadableStreamDefaultReader::Constructor (#34056 )
* Implement ReadableStreamDefaultReader::Constructor
Signed-off-by: Taym <haddadi.taym@gmail.com >
* make start_reading returns ReadableStreamDefaultReader
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Fix can_gc
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Add canGc to ReadableStream::GetReader
Signed-off-by: Taym <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Readablestream fix CanGc (#34080 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* correct ReadableStream::error_native implementation and fix clippy warnings (#34088 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* turn assertion of stream present on controller on a early return with false (#34097 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Fix already mutably borrowed crash (#34105 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Refactor `get_in_memory_bytes` to return `Option<Vec<u8>> and avoid `unreachable!` panic (#34123 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Set ReadableStream ReadableStreamDefaultReader in start_reading (#34125 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Fix Unhandled rejection with value: object `TypeError: stream is not locked` (#34204 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Fix assert!(self.is_readable()) crash in ReadableStream::close (#34207 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix call to to_js_object in underlying source algos (#34098 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* do not assume presence of a stream when performing pull steps (#34244 )
* do not assume presence of a stream when performing pull steps
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* add doc comments
Co-authored-by: Taym Haddadi <haddadi.taym@gmail.com >
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com >
Co-authored-by: Taym Haddadi <haddadi.taym@gmail.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* gracefully handle failure of underlying source algorithms (#34243 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* ensure result of calling start algo is an object (#34245 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* return js failed error if underlying source constructor threw (#34246 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Use JSVal for ValueWithSize::value (#34259 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix release reader lock, (#34255 )
fix setting stream on controller in new,
fix matching fallthrough,
reduce visibility of controller error method
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* in stream cancel, reject promist if locked (#34271 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Fix UnderlyingSourceContainer::call_start_algorithm (#34277 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* implement controller cancel steps, fix stream cancel method (#34301 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix conditional in perform pull steps (#34324 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* set reader closed promise to one resolved with undefined if stream closed on init (#34321 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix init of stream and controller (#34323 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Stream: Fix reborrow in controller enqueue, and fix error and exception handling. (#34338 )
* fix re-borrow in controller enqueue
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* do not call to_jsval on JSFailed error in enqueue
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* fix error and exception handling in controller enqueue
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* remove TODO about correctness of stored error, since this was done as part of the switch to a js val.
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Stream: Fix incorrect "this" object in underlying source callbacks (#34368 )
* in controller close, throw type error if stream cannot be closed
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* store original js object for underlying source, for use as this object in callbacks
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix conditional logic in enqueue to ensure pull is called into (#34375 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Stream: Fix bytelength queueing strategy (#34376 )
* fix handling of value that is not an object in bytelength queuing strategy
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* return type error if strategy size call fails, to prevent panic because no exception is pending
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* set correct default count queuing size strategy (#34389 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* use proto in stream constructor (#34441 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix edge cases in get_desired_size (#34440 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Stream: fix algo and strategy calls error handling. (#34424 )
* fix error handling in cancel steps
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* in pull steps, reject promise if pull algo throws
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* if start algorithm fails, rethrow the error
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* when the strategy size fails, directly get the pending exception and use it to error the stream
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* add error handling to enqueue value with size
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* when enqueueing a value errors, ensure we error and stream with the same error used to throw an exception
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix native use of streams (#34468 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Implement readablestreamdefaulttee (#34405 )
* Implement readablestreamdefaulttee
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Create UnderlyingSourceType::Tee each stream
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Use Dom instead of DomRoot
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Queue a microtask for readRequest chunk steps
Signed-off-by: Taym <haddadi.taym@gmail.com >
* fix create_readable_stream
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Remove unnecessary Rc
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Use correct doc link
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Add #[allow(crown::unrooted_must_root)]
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Fix crash in ClosedPromiseRejectionHandler
Signed-off-by: Taym <haddadi.taym@gmail.com >
* reflect TeeReadRequest and TeeUnderlyingSource
Signed-off-by: Taym <haddadi.taym@gmail.com >
* fix can_gc
Signed-off-by: Taym <haddadi.taym@gmail.com >
* reflect tee source, and fix use of mutable dom for tee source and request
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* Fix typo that resolves multiple test failures in 'Tee' tests
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Fix readable-streams/tee.any.js test
Signed-off-by: Taym <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Align ReadableStreamDefaultReader with spec and fix additional tests in default-reader.any.js (#34531 )
And fix crate::DomTypeHolder usage
* Align ReadableStreamDefaultReader with spec and fix additional tests in default-reader.any.js
Signed-off-by: Taym <haddadi.taym@gmail.com >
* make reader rooted in Constructor and acquire_default_reader
Signed-off-by: Taym <haddadi.taym@gmail.com >
* Remove spaces
Signed-off-by: Taym <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Streams: fetch stream chunks should be uint8 arrays (#34553 )
* fetch stream chunks should be uint8 arrays
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
* fix clippy
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
---------
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
Co-authored-by: Taym Haddadi <haddadi.taym@gmail.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Update wpt test for ReadableStream reimplementation (#34579 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Fix ignore_malloc_size_of in readablestream tee (#34578 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Remove incorrect use of handle array, fail test safely by giving only one reason (#34560 )
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Update more wpt test for ReadableStream reimplementation (#34598 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Fix doc and rename Tee to DefaultTee (#34612 )
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix: Address review comments
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Update response-stream-with-broken-then.any.js.ini test expectation
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* fix reflect_dom_object can_gc
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Fix compositeReason for DefaultTeeUnderlyingSource (#34627 )
* Fix compositeReason for DefaultTeeUnderlyingSource
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Update test
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
* Last fixes stream (#34636 )
* remove now unsused from_js method of readable stream
* fix documenation of error steps
* return type error instread of panicking on a todo, when trying to construct a stream of type bytes
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com >
* fix crown rooting related errors (#34662 )
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com >
---------
Signed-off-by: Taym <haddadi.taym@gmail.com >
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com >
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com >
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com >
Co-authored-by: Wu Wayne <yuweiwu@pm.me >
Co-authored-by: Taym Haddadi <haddadi.taym@gmail.com >
2024-12-17 21:14:00 +00:00
Josh Matthews
e956f3124c
Generate a trait abstracting over all known DOM interfaces ( #34357 )
...
* script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* script: Update trait implementations with new generic type.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Formatting.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2024-11-24 07:35:14 +00:00
chickenleaf
324f42abd7
Use borrow() to fix GC hazard in stream_chunk ( #33976 )
...
* Use borrow() to fix GC hazard in stream_chunk
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
* added the corrections
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
---------
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
2024-10-23 11:51:15 +00:00
Josh Matthews
12e6ec25aa
Propagate CanGc when interacting with readable streams. ( #33975 )
...
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2024-10-23 11:49:59 +00:00
chickenleaf
ebfea9b352
CanGc fixes in several files ( #33958 )
...
* few cangc fixes
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
* few cangc fixes
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
---------
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
2024-10-21 21:32:22 +00:00
chickenleaf
fde8d72aca
Various CanGc fixes in 8 files ( #33893 )
...
* Various CanGc fixes in 8 files
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
* fixed merge conflicts and formatting
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
---------
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
2024-10-18 11:54:32 +00:00
chickenleaf
fc0835bae3
CanGc fixes in focusevent.rs oscillartornode.rs response.rs resizeobserversize.rs animationevent.rs ( #33827 )
...
Signed-off-by: L Ashwin B <lashwinib@gmail.com >
2024-10-13 21:35:59 +00:00
webbeef
f9a06d62a2
More CanGc fixes: Range, Event, gpu error, Header ( #33774 )
...
* Propagate CanGc parameter in Range
Signed-off-by: webbeef <me@webbeef.org >
* Propagate CanGc parameter in gpu code and dependencies
Signed-off-by: webbeef <me@webbeef.org >
* Propagate CanGc parameter in Header and dependencies
Signed-off-by: webbeef <me@webbeef.org >
* Propagate CanGc parameter in Event and dependencies
Signed-off-by: webbeef <me@webbeef.org >
* Propagate CanGc parameter in rtcdatachannel
Signed-off-by: webbeef <me@webbeef.org >
* Propagate CanGc parameter in servoparser
Signed-off-by: webbeef <me@webbeef.org >
---------
Signed-off-by: webbeef <me@webbeef.org >
2024-10-10 15:51:22 +00:00
Josh Matthews
7d931e673a
script: Include constructors and static methods in generated DOM traits ( #33665 )
...
* Add all constructors, special operations, and static methods to generated DOM interface traits.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Add missing doc links.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2024-10-08 01:51:58 +00:00
webbeef
58f34ad7a3
Create HttpStatus to safely deal with HTTP responses status. ( #33581 )
...
Signed-off-by: webbeef <me@webbeef.org >
2024-09-29 18:23:48 +00:00
Simon Wülker
7df30f3788
Replace .map_or(false with Option::is_some_and ( #33468 )
...
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
2024-09-16 10:03:52 +00:00
Josh Matthews
60ef6bc461
Start marking functions that can transitively trigger a GC ( #33144 )
...
* Mark JS reflector wrappers as CanGc.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Propagate CanGc from reflect_dom_object_with_proto.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Mark DOM constructors as GC operations.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2024-08-22 11:42:36 +00:00
Josh Matthews
bc5235827f
Various borrow hazard fixes ( #33133 )
...
* Reduce the scope of the document tag map borrow.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Reduce scope of borrow when finishing a Response.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Avoid creating a File object while borrowing FormData's data.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
* Prevent the GC from seeing an uninitialized window proxy slot.
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net >
2024-08-20 16:06:24 +00:00
Peter Mikola
0a641816bf
clippy fixes regarding clone_from ( #32482 )
2024-06-12 17:09:56 +00:00
Rosemary Ajayi
2f5a4354e7
clippy: fixed various clippy warnings in components/scripts ( #31960 )
...
* fixed various clippy warnings
* fixed various clippy warnings
* fixed various clippy warnings
* fixed various clippy warnings
2024-04-01 08:25:42 +00:00
Ekta Siwach
1bc63801e7
fix redundant closures in component/script/dom ( #31917 )
...
* fixed unnecessary conversions
* resolved conflicts
* resolved conflicts
* fix redundant closures in component/script/dom
* resolved conflicts
* fixed formatting
2024-03-28 09:06:02 +00:00
Aarya Khandelwal
9b26dca141
Fixed the .clone() warnings. ( #31819 )
2024-03-22 05:41:17 +00:00
Oluwatobi Sofela
15bf32a4e6
clippy: Fix unneeded return statement warnings ( #31776 )
2024-03-20 14:11:40 +00:00
Oluwatobi Sofela
02a0cdd6fa
clippy: Fix dereferenced warnings ( #31770 )
2024-03-20 08:07:22 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors ( #31147 )
...
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +00:00
Samson
604979e367
Replace script_plugins with a clippy like rustc driver (named crown) ( #30508 )
...
* Remove script_plugins
* Use crown instead of script_plugins
* crown_is_not_used
* Use crown in command base
* bootstrap crown
* tidy happy
* disable sccache
* Bring crown in tree
* Install crown from tree
* fix windows ci
* fix warning
* fix mac
libscript_plugins.dylib is not available anymore
* Update components/script/lib.rs
Co-authored-by: Martin Robinson <mrobinson@igalia.com >
* Update for nightly-2023-03-18
Mostly just based off https://github.com/servo/servo/pull/30630
* Always install crown
it's slow only when there is new version
* Run crown test with `mach test-unit`
* Small fixups; better trace_in_no_trace tests
* Better doc
* crown in config.toml
* Fix tidy for real
* no sccache on rustc_wrapper
* document rustc overrides
* fixup of compiletest
* Make a few minor comment adjustments
* Fix a typo in python/servo/platform/base.py
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com >
* Proper test types
* Ignore tidy on crown/tests
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com >
2023-12-01 15:50:52 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) ( #30325 )
...
* strict imports formatting
* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
9514f670d1
No tracing of nop traceable fields ( #29926 )
...
* Add `no_trace` option to JSTraceable derive
* NoTrace wrapper
* Port some types to no_trace schematics
* Fixing my unsafe mistakes (not tracing traceables)
* Add docs & safety guards for no_trace
Safety guards (trait shenanigans) guarantees safety usage of `no_trace`
* Port canvas_traits to no_trace
* Port servo_media to no_trace
* Port net_traits to no_trace
* Port style to no_trace
* Port webgpu to no_trace
* Port script_traits to no_trace
* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace
* unrooted_must_root lint in seperate file
* Add trace_in_no_trace_lint as script_plugin
* Composable types in must_not_have_traceable
* Introduced HashMapTracedValues wrapper
* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`
* Port rest of servo's types to no_trace
* Port html5ever, euclid, mime and http to no_trace
* Port remaining externals to no_trace
* Port webxr and Arc<Mutex<_>>
* Fix spelling in notrace doc
2023-08-04 10:17:43 +00:00
Josh Matthews
cc07e27864
Rename reflect_dom_object2.
2023-05-31 23:03:32 -04:00
Josh Matthews
dbff26bce0
Support arbitrary protos when wrapping DOM objects with constructors.
2023-05-28 23:23:12 -04:00
cybai
7c9c786053
Reset to in-memory stream with empty byte sequence for None init body
...
Because the response body stream is initialized with FetchResponse, it
cannot be processed with in-memory empty sequence. Thus, instead of
using the FetchResponse stream, we'll reset it to Memory body stream
with empty byte sequence if there's no init body.
2023-04-27 14:18:36 +09:00
cybai
c4882aab7e
Update steps comment to match latest (2023-04-14) spec
2023-04-14 14:32:28 +09:00
cybai
445c90e5c5
Respect MIME type from headers instead of caching it
2023-04-13 00:31:49 +09:00
Naveen Gattu
a48a111cee
Upgrade Hyper
2022-01-16 09:34:17 -08:00
Naveen Gattu
a744ac26da
concept-response-clone: Ensure header guard is cloned after headers
...
https://fetch.spec.whatwg.org/#concept-response-clone
If the header guard of the response to clone is `immutable`, then copying the headers to the new response will fail with `Guard is immutable` unless we ensure the guard is copied _after_ the headers.
8650794391/components/script/dom/response.rs (L331-L334)
fn Append(&self, name: ByteString, value: ByteString) -> ErrorResult {
// Step 1
let value = normalize_value(value);
// Step 2
let (mut valid_name, valid_value) = validate_name_and_value(name, value)?;
valid_name = valid_name.to_lowercase();
// Step 3
if self.guard.get() == Guard::Immutable {
return Err(Error::Type("Guard is immutable".to_string()));
}
2021-12-17 11:25:59 -08:00
Gregory Terzian
bd5796c90b
integrate readablestream with fetch and blob
2020-06-04 11:38:35 +08:00
Bastien Orivel
c4273d86f2
Fix the webidl for Headers
...
Make the HeadersInit type match the spec.
Fixes #26441
2020-05-30 12:46:51 +02:00
Kunal Mohan
f3fa53b849
update rust toolchain
2020-05-21 21:51:49 +05:30
Bastien Orivel
aa43ce8cf3
Fix the redirected attribute for Response
2020-05-05 20:43:56 +02:00