aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/domexception.rs
Commit message (Collapse)AuthorAgeFilesLines
* Reduce indexing boilerplate for serializable/transferrable objects. (#36624)Josh Matthews17 hours1-27/+7
| | | | | | | | | | | | | | | Rather than creating unique types for each pipeline-namespaced index type (eg. MessagePortId, DomExceptionId, etc.), we can create a generic common type that uses a marker to prevent type confusion. This change allows us to reduce the boilerplate code required when implementing serializable/transferable interfaces, since the structured clone implementation can rely on the common type. Testing: Existing WPT tests for serialization and transferring provide coverage. --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Make DOMException serializable (#36535)Kingsley Yung7 days1-0/+72
| | | | | | | | | | | Follow the implementation of making DOMPoint and DOMPointReadOnly serializable in PR #35989 Testing: Passed a test previously expected to fail. Fixes: #36463 --------- Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
* Support optional message for dataclone error (#36308)Jerens Lensun9 days1-0/+15
| | | | | | | | | | | | | | | | | | | | | | | - [x] our [DataClone error](https://github.com/servo/servo/blob/d733abfca02cdb9fd2af4f0d82ff050e25f71829/components/script/dom/bindings/error.rs#L80) needs to support an optional message - [x] we need to add support to our DOMException implementation to allow an optional message to replace the default message - [x] we need to create a new struct used by both StructuredDataReader and StructuredDataWriter for storing the error message in the report_error_callback - [x] report_error_callback needs to cast the closure pointer to the new struct - [x] the code that [throws a DataClone error](https://github.com/servo/servo/blob/5d1c64dba9cf3e65f770370eb17f00ad4114edce/components/script/dom/bindings/structuredclone.rs#L542) needs to use the stored error message if it's available Testing: *Describe how this pull request is tested or why it doesn't require tests* Fixes: #36191 --------- Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-1/+1
| | | | | | | | | | | | | * 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>
* Propagate `CanGc` arguments through callers in constructors (#35541)Auguste Baum2025-02-201-2/+6
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Add CanGc argument to reflect_dom_object (#34606)Domenico Rizzo2024-12-131-1/+5
| | | | | | | | | | | | | | | | | | | | | * applied mach fmt Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Refinements Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Modified reflect_dom_object signature and all its calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * fix function calls when parameter is passed up Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* 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>
* crypto: Implement encrypt/decrypt for AES-CBC + JWK support (#33795)Daniel Adams2024-10-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add support for raw importKey with AES-CBC Signed-off-by: Daniel Adams <msub2official@gmail.com> * Support JWK import/export, importKey for AES-CBC Signed-off-by: Daniel Adams <msub2official@gmail.com> * Implement encrypt/decrypt for AES-CBC Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update Cargo.lock Signed-off-by: Daniel Adams <msub2official@gmail.com> * Pass MutableHandleObject as arg instead of returning raw pointer Signed-off-by: Daniel Adams <msub2official@gmail.com> * Swap order of checks in generate_key_aes_cbc - Fixes WPT tests that expect to error on algorithm first before usages Signed-off-by: Daniel Adams <msub2official@gmail.com> * Avoid potential GC hazard with array_buffer_ptr Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update expectations for discards context Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
* Fixed some clippy warnings in components/script/dom (#33757)komuhangi2024-10-101-0/+1
| | | | | | | | | | | | | * Fixed some clippy warnings in components/script/dom Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com> * Incorporated review suggestions Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com> --------- Signed-off-by: jahielkomu <ktumuhairwe24@gmail.com>
* script: Include constructors and static methods in generated DOM traits (#33665)Josh Matthews2024-10-081-12/+12
| | | | | | | | | | | | | | | | | * 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-0/+3
| | | | | | | | | | | | | | | | | * 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>
* webgpu: Implement proper async pipeline creation and GPUPipelineError (#32636)Samson2024-08-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add GPUPipelineError Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Proper GetBindGroupLayout Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Proper Create*PipelineAsync Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixups Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * more good expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Implement HTMLImageElement decode (#31269)Taym Haddadi2024-06-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement HTMLImageElement decode Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Fix Decode doc link Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Temp * Decode HTML Image Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Fix doc link Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Move image decode to process_image_response_for_environment_change Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update some wpt test result Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Handle multiple image decode promises Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove unnecessary promise calls Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update more wpt test result Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Undo body-size-cross-origin.https.html.ini changes Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Reject decode when src and srcset are missing Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Revert "Reject decode when src and srcset are missing" This reverts commit 1b57ab978f9fc24facafc8af97ee8851d5142533. * Drain promises vec and run update_the_image_data when element is created Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * resolve decode promise in abort_request when request is CompletelyAvailable Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Update wpt test Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Move storing promise in decode task Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove the resolve logic from decode task Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Revert "Remove the resolve logic from decode task" This reverts commit eee6096d50dbe46a22a5bbfd7f15c03988ed2f4b. * reject or reject current promise before storing it Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Add comment to explain why resolve promise when state is CompletelyAvailable Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-4/+6
| | | | | * strict imports formatting * Reformat all imports
* Rename reflect_dom_object2.Josh Matthews2023-05-311-2/+4
|
* Support arbitrary protos when wrapping DOM objects with constructors.Josh Matthews2023-05-281-2/+5
|
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-7/+1
|
* Add an unused but part-of-the-spec exception typePatrick Shaughnessy2020-01-281-0/+3
|
* Modify `script` to prevent further violations of snake_caseKunal Mohan2020-01-181-0/+1
|
* Stringifier is sno longer exposedPatrick Shaughnessy2019-12-121-5/+5
|
* Decoupled DOMErrorName from legacy error codesAlan Jeffrey2019-07-181-6/+6
|
* Added framebuffer and related attributes to XRWebGLLayerAlan Jeffrey2019-07-181-0/+5
|
* implemented missed constructor for DOMException; fixed the tests expectationscdeler2019-03-191-33/+90
|
* Update MPL license to https (part 3)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Reorder importsPyfisch2018-11-061-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-061-7/+7
|
* Format script componentchansuke2018-09-191-8/+15
|
* Implement read methods on FileReaderSyncJonas Reinwald2018-06-041-0/+2
|
* Replace all uses of the `heapsize` crate with `malloc_size_of`.Nicholas Nethercote2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.
* Remove use of unstable box syntax.Simon Sapin2017-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | http://www.robohornet.org gives a score of 101.36 on master, and 102.68 with this PR. The latter is slightly better, but probably within noise level. So it looks like this PR does not affect DOM performance. This is expected since `Box::new` is defined as: ```rust impl<T> Box<T> { #[inline(always)] pub fn new(x: T) -> Box<T> { box x } } ``` With inlining, it should compile to the same as box syntax.
* Rename Root<T> to DomRoot<T>Anthony Ramine2017-09-261-2/+2
| | | | | | | In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>, where Root<T> will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned.
* Rename dom::bindings::js to dom::bindings::rootAnthony Ramine2017-09-261-1/+1
|
* order derivable traits listsClément DAVID2017-08-231-1/+1
| | | | | | Ignoring : - **generated**.rs - python/tidy/servo_tidy_tests/rust_tidy.rs
* Make #[dom_struct] a proc_macro attributeAnthony Ramine2017-02-241-0/+1
|
* Remove and allow some dead code.Ms2ger2016-12-221-9/+1
|
* Make reflect_dom_object take a &GlobalScopeAnthony Ramine2016-10-061-2/+2
|
* Move DOMString back to scriptAnthony Ramine2016-05-241-1/+1
| | | | This entirely removes the 'non-geckolib' feature of the util crate.
* Rustfmt some of script.Ms2ger2015-11-181-3/+5
|
* Replaced DOMString constructor by conversion functions.Alan Jeffrey2015-11-121-4/+3
| | | | | | Replaced DOMString(...) by DOMString::from(...). Replaced ....0 by String::from(...). Removed any uses of .to_owner() in DOMString::from("...").
* Make DOMString a newtype around String, rather than a typedef.Ms2ger2015-11-041-4/+4
| | | | | | | | | | This should make it somewhat easier to experiment with alternative representations in the future. To reduce churn, this commit leaves the String field public, though. Also, this will allow us to use the default String type to represent the IDL USVString type, which explicitly forbids unpaired surrogates, ans as such is a better match to the Rust String type.
* more refactoringrohan.prinja2015-10-301-1/+1
|
* Add better stringifier for DOMExceptionManish Goregaokar2015-09-241-0/+5
|
* Fix reported test-tidy errors for unmerged import blocksBrandon Fairchild2015-09-191-2/+1
| | | | This merges import blocks that were reported by tidy as unmerged.
* Make the traits for the IDL interfaces take &selfAnthony Ramine2015-08-271-4/+4
|
* make dom_struct derive HeapSizeOf,João Oliveira2015-08-271-1/+0
| | | | closes #7357
* Measure heap memory usage for more types. Fixes #6951Bogdan Cuza2015-08-131-1/+2
|
* Implement window.crypto.getRandomValues()Tim Taubert2015-07-031-0/+2
|
* Refactor #[jstraceable] to #[derive(JSTraceable)]David Winslow2015-07-011-2/+1
| | | | fixes #6524
* Upgrade to SM 39Michael Wu2015-06-191-3/+3
|