aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/blob.rs
Commit message (Collapse)AuthorAgeFilesLines
* More miscellaneous script splitting changes (#36220)Josh Matthews2025-03-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Move HasParent to script_bindings and update imports for InheritTypes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make principal creation generic over DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move a bunch of proxy-related code to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make some proxy-related code generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move DomSlice to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move some utility bindings code to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make enumerating and resolving globals generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make realm helpers generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move implementations on concrete DOM types to concrete bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make additional codegen helpers generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make iterator creation generic over the DOM interface. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make reporting an exception a generic operation. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Move AsCCharPtrPtr to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Address clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Refactor common boilerplate out of serialize/transfer implementations (#35831)Josh Matthews2025-03-151-45/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Create infrastructure for reducing hand-written serializable/transferrable implementations. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Clone all serializable DOM interfaces. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Deserialize all serializable DOM interfaces. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Serialize all serializable DOM interfaces. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Transfer-receive all transferable DOM interfaces. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Transfer all transferable DOM interfaces. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract boilerplate from serialize/deserialize implementations. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract boilerplate from transfer-receive. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract boilerplate from transfer operation. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Tidy fixes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Check transferability of all DOM interfaces. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Clippy fixes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Clippy fixes. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Remove unnecessary duplicate crate. 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>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-2/+2
| | | | | | | | | | | | | * 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>
* script: Implement `Blob::bytes()` (#35151)Kousuke Takaki2025-02-271-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Implement Blob.bytes() Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com> * improve read_all_bytes Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com> * fix read_all_bytes Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com> * fix bug Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com> * something went wrong Signed-off-by: Kousuke Takaki <98276492+yoseio@users.noreply.github.com> * fix read loop Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * add use of can_gc to promise code following rebase Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * fix rooting of fulfillment handler Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * Update test expectations Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * use dom for reader in read loop fulfillment handler Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * use the global of the reader in read loop fulfillment handler Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * remove FAIl expectations for blob methods in detached iframe Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> --------- Signed-off-by: yoseio <98276492+yoseio@users.noreply.github.com> Signed-off-by: Kousuke Takaki <98276492+yoseio@users.noreply.github.com> Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com> Co-authored-by: Taym Haddadi <haddadi.taym@gmail.com>
* refactor: add CanGc as argument to Promise::reject_error (#35646)Yerkebulan Tulibergenov2025-02-251-3/+3
| | | Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* refactor: add CanGc as argument to Promise::resolve (#35616)Yerkebulan Tulibergenov2025-02-231-2/+4
| | | Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* refactor: add CanGc as argument to create_buffer_source (#35597)Yerkebulan Tulibergenov2025-02-221-1/+1
| | | Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Move various reflector types and traits to script_bindings (#35279)Josh Matthews2025-02-041-1/+1
| | | | | | | | | | | | | * 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>
* script: Feature-gate all crown support. (#35055)Josh Matthews2025-01-181-1/+1
| | | | | | | | | | | | | * 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>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* ReadableStream: remove the use of get_js_stream and use ↵Taym Haddadi2025-01-051-6/+4
| | | | | | | | | | | | | | | 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>
* Split StructuredCloneHolder into Reader and Writer structs (#34792)webbeef2024-12-301-19/+8
| | | Signed-off-by: webbeef <me@webbeef.org>
* Generate a trait abstracting over all known DOM interfaces (#34357)Josh Matthews2024-11-241-1/+1
| | | | | | | | | | | | | | | | | * 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>
* Propagate CanGc when interacting with readable streams. (#33975)Josh Matthews2024-10-231-4/+4
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Mark promise creation methods with CanGc (#33928)Josh Matthews2024-10-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add CanGc annotations to promise constructor. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc arguments for Promise::new_in_current_realm. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix out-of-order entries. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc from Promise::new. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Suppress clippy warning. 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>
* Multiple CanGc fixes in components/script/dom (#33924)tanishka2024-10-201-1/+2
| | | Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
* CanGc fixes starting from blob.rs, mediastream.rs, custom_event.rs (#33820)chickenleaf2024-10-121-1/+2
| | | Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* Various CanGc fixes in components/script/dom (#33706)webbeef2024-10-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * Propagate 'can_gc' in IFrame DOM code Signed-off-by: webbeef <me@webbeef.org> * Propagate 'can_gc' in HTML video and image elements Signed-off-by: webbeef <me@webbeef.org> * Propagate 'can_gc' in Blob and dependencies Signed-off-by: webbeef <me@webbeef.org> * Leftover can_gc fixes for HTMLMediaElement Signed-off-by: webbeef <me@webbeef.org> * Address comment Signed-off-by: webbeef <me@webbeef.org> --------- Signed-off-by: webbeef <me@webbeef.org>
* script: Include constructors and static methods in generated DOM traits (#33665)Josh Matthews2024-10-081-23/+23
| | | | | | | | | | | | | | | | | * 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>
* Start marking functions that can transitively trigger a GC (#33144)Josh Matthews2024-08-221-5/+11
| | | | | | | | | | | | | | | | | * 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>
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | For a long time, `gfx_traits` has held a lot of things unrelated to graphics and also unrelated to the `gfx` crate (which is mostly about fonts). This is a cleanup which does a few things: 1. Move non `gfx` crate things out of `gfx_traits`. This is important in order to prevent dependency cycles with a different integration between layout, script, and fonts. 2. Rename the `msg` crate to `base`. It didn't really contain anything to do with messages and instead mostly holds ids, which are used across many different crates in Servo. This new crate will hold the *rare* data types that are widely used. Details: - All BackgroundHangMonitor-related things from base to a new `background_hang_monitor_api` crate. - Moved `TraversalDirection` to `script_traits` - Moved `Epoch`-related things from `gfx_traits` to `base`. - Moved `PrintTree` to base. This should be widely useful in Servo. - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it to `WebRenderFontApi`.
* clippy: fix several lint warns (#32126)Kitsu2024-04-221-4/+4
| | | | | | | | | | | | | | | As seems #31500 still remain opened here's the next partial fix. Fixed list: `unused_mut`, `clippy::needless_borrow`, `clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`, `clippy::unnecessary_cast`, `clippy::derivable_impls`, `clippy::collapsible_match`, `clippy::extra_unused_lifetimes`, `clippy::map_clone`, `clippy::manual_filter`. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes are part of #31500. - [x] These changes do not require tests because are only cosmetic.
* clippy: Fix let_and_return warnings (#31964)Oluwatobi Sofela2024-04-011-2/+1
|
* fixed various clippy warnings (#31954)Rosemary Ajayi2024-03-311-1/+1
|
* clippy: Fix a few clippy problems in `components/scripts/dom` (#31905)Rosemary Ajayi2024-03-281-3/+3
| | | | | * option_as_ref_deref * fix
* fix redundant closures in component/script/dom (#31917)Ekta Siwach2024-03-281-1/+1
| | | | | | | | | | | | | * fixed unnecessary conversions * resolved conflicts * resolved conflicts * fix redundant closures in component/script/dom * resolved conflicts * fixed formatting
* clippy: Fix clone-on-copy warnings (#31877)Oluwatobi Sofela2024-03-261-7/+6
|
* fixes dereferencing on an immutable reference (#31864)Aarya Khandelwal2024-03-261-1/+1
|
* clippy: Fix `explicit_auto_deref` warnings in `components/script` (#31837)Oluwatobi Sofela2024-03-231-1/+1
| | | | | | | | | * clippy: Fix explicit auto-deref warnings * clippy: Fix explicit auto-deref warnings * refactor: Tidy up code * refactor: Fix method not found errors
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-2/+2
| | | | 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.
* Replace script_plugins with a clippy like rustc driver (named crown) (#30508)Samson2023-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-12/+14
| | | | | * strict imports formatting * Reformat all imports
* No tracing of nop traceable fields (#29926)Samson2023-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Rename reflect_dom_object2.Josh Matthews2023-05-311-2/+2
|
* Formatting.Josh Matthews2023-05-281-2/+7
|
* Support arbitrary protos when wrapping DOM objects with constructors.Josh Matthews2023-05-281-3/+9
|
* Remove unused argument from AlreadyInRealm::assert.Josh Matthews2023-05-201-2/+2
|
* Remove global argument from Promise::new_in_current_realm.Josh Matthews2023-05-201-2/+2
|
* Make GlobalScope.get_cx a static method.Josh Matthews2023-05-201-1/+1
|
* integrate readablestream with fetch and blobGregory Terzian2020-06-041-7/+15
|
* Update wpt-tests metadataUtsav Oza2020-05-191-1/+0
|
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-1/+0
|
* Implement Blob methods (text/arraybuffer) and async file read methodKunal Mohan2020-01-281-0/+58
|
* Modify `script` to prevent further violations of snake_caseKunal Mohan2020-01-181-0/+1
|
* Add lint check for `&DomRoot<T>`lberrymage2019-12-211-2/+2
| | | | | `&DomRoot<T> is strictly less expressive than `&T`, so using it is pointless.
* re-structure blob, structured serializationGregory Terzian2019-12-111-276/+102
|
* Use `#![register_tool]` instead of `#![register_attr]`Simon Sapin2019-11-151-1/+1
| | | | CC https://github.com/rust-lang/rust/issues/66079
* Don't panic if file manager thread is unreachable when cleaning up Blobs.Josh Matthews2019-07-291-1/+1
|
* create uuid before sending PromoteMemory messageRussell Cousineau2019-03-181-15/+9
|
* Update MPL license to https (part 3)Jan Andre Ikenmeyer2018-11-191-1/+1
|