aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/imagedata.rs
Commit message (Collapse)AuthorAgeFilesLines
* imagedata: Fix overflow panic for too large ImageData (#36569)Andrei Volykhin8 days1-4/+21
| | | | | | | | | | | | | | | | | In Servo debug build there are runtime crash due to "attempt to multiply with overflow" panic in case of creation too large ImageData (new ImageData(1<<31, 1<<31)) Use checked integer multiplication to catch occurred overflow and throwing JS error (RangeError OR IndexSizeError). -- - [x] ./mach build -d does not report any errors - [x] ./mach test-tidy does not report any errors - [x] There are tests for these changes tests/wpt/tests/html/canvas/element/pixel-manipulation/2d.imageData.object.ctor.basics.html Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* script: implement ReadableByteStreamController (#35410)Taym Haddadi2025-03-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: implement ReadableByteStreamController Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * implement can_copy_data_block_bytes and copy_data_block_bytes Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Remove BufferSource::Default Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * implement StartAlgorithmFulfillmentHandler, StartAlgorithmRejectionHandler, PullAlgorithmFulfillmentHandler, PullAlgorithmRejectionHandler for ReadableByteStreamController Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * implement perform_pull_into Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix build Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix build Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Remove RefCell from PullIntoDescriptor and QueueEntry Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Remove commented code Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * add perform_cancel_steps, perform_release_steps and perform_pull_steps Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix crown Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * unskip readable-byte-streams Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix CRASH Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix more CRASHS Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix more crashes Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix bad-buffers-and-views.any.js test Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Update test expectations Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix BorrowMutError crashes Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix view_byte_length test Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix non-transferable-buffers test Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Pass contexts as much as possible by reference Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Make respond_internal Fallible Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix crwon Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix process pull into descriptors using queue logic and resulting double-borrow Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> * Fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * FIx more crashes Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix timeout tests Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix all tests Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Remove all error! logs Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Remove #[allow(unsafe_code)] Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix lint Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix tidy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Fix test expectation Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com> Co-authored-by: gterzian <2792687+gterzian@users.noreply.github.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-3/+3
| | | | | | | | | | | | | * 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>
* refactor: add CanGc as argument to create_buffer_source_with_length (#35596)Yerkebulan Tulibergenov2025-02-221-8/+8
| | | | Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Script: implement `ReadableStreamBYOBReader::Read` (#35040)Taym Haddadi2025-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Script: implement ReadableStreamBYOBReader::Read Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix ReadRequest::close_steps Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * implement viewed_buffer_array_byte_length and byte_length Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix clippy Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Correct BufferSource implemntation Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Correct detach_buffer implemantation Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * fix JS_IsArrayBufferViewObject usage Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Reduce BufferSource to two variants ArrayBuffer and ArrayBufferView Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * Add more doc and use promise.reject_error Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Taym Haddadi <haddadi.taym@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>
* 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>
* CanGc fixes starting from imagedata.rs (#33808)chickenleaf2024-10-111-9/+3
| | | | | | | | | | | | | | | | * CanGc fixes starting from imagedata.rs Signed-off-by: L Ashwin B <lashwinib@gmail.com> * Update components/script/dom/imagedata.rs Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: chickenleaf <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com> Signed-off-by: chickenleaf <lashwinib@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* script: Include constructors and static methods in generated DOM traits (#33665)Josh Matthews2024-10-081-34/+32
| | | | | | | | | | | | | | | | | * 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>
* Replace .map_or(false with Option::is_some_and (#33468)Simon Wülker2024-09-161-1/+1
| | | Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Start marking functions that can transitively trigger a GC (#33144)Josh Matthews2024-08-221-7/+22
| | | | | | | | | | | | | | | | | * 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>
* clippy: Fix redundant field names warnings (#31793)Oluwatobi Sofela2024-03-201-4/+4
|
* Rename buffer_source_type to buffer_source (#31426)Taym Haddadi2024-02-261-3/+3
| | | | | | | | | | | | | * Rename buffer_source_type to buffer_source Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Code format Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* WedIDL: bring dom/bindings/typedarray further in line with spec (#31375)Taym Haddadi2024-02-251-10/+10
| | | | | | | | | | | | | | | | | * WedIDL: bring dom/bindings/typedarray further in line with spec Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Rename HeapBufferSourceTypes to HeapBufferSource Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * fmt code Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* WebIDL: Use Uint8ClampedArray instead of raw JSObject in bindings (#31317)Taym Haddadi2024-02-161-45/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * WebIDL: Use Uint8ClampedArray instead of raw JSObject in bindings Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * fmt Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * introduce new_initialized_heap_typed_array function Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove unsed unsafe_code Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Use doc comments for ImageData Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Use get_internal instead of acquire_data Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Handle JS errors in ImageData GetData and new_initialized_heap_typed_array Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Fix wrong assert that causes CRASH in test Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Early return for error Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Address review comments Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* Clean up and merge some canvas-related WebIDLs (#30606)Ennui Langeweile2023-10-261-1/+1
| | | | | | | * Clean up and merge some canvas-related WebIDLs * Apply `./mach fmt` * WebIDL has `test-tidy` support???
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-11/+13
| | | | | * strict imports formatting * Reformat all imports
* Rename reflect_dom_object2.Josh Matthews2023-05-311-3/+3
|
* Formatting.Josh Matthews2023-05-281-1/+6
|
* Support arbitrary protos when wrapping DOM objects with constructors.Josh Matthews2023-05-281-9/+12
|
* Make GlobalScope.get_cx a static method.Josh Matthews2023-05-201-3/+3
|
* Fix warningsagu2021-03-301-1/+0
|
* fmtsagudev2021-03-301-6/+2
|
* Update imagedata.rssagu2021-03-301-1/+1
|
* Fix errorssagudev2021-03-191-1/+7
|
* Update euclidManish Goregaokar2020-04-071-10/+0
|
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-11/+2
|
* Modify `script` to prevent further violations of snake_caseKunal Mohan2020-01-181-3/+2
|
* Addresses issues raised in #24465; removes redundancy in set_bitmap_dimensionsBailey Blankenship2019-11-101-2/+12
| | | | Removed passing test .ini files and moved euclid extensions to euclidext.rs to factor out redundant code
* Refactor constructor code to align with spec.Isaiah Inuwa2019-09-261-50/+55
|
* Add check for empty data on ImageData constructor.Isaiah Inuwa2019-09-231-1/+1
|
* Modify *::get_cx methods to return a safe JSContext instead of a raw onemarmeladema2019-07-241-5/+5
|
* Convert CGTraitInterface to use safe JSContext instead of raw JSContextmarmeladema2019-07-241-4/+4
|
* Update euclid.Emilio Cobos Álvarez2019-07-231-1/+1
| | | | | | | | There are a few canvas2d-related dependencies that haven't updated, but they only use euclid internally so that's not blocking landing the rest of the changes. Given the size of this patch, I think it's useful to get this landed as-is.
* Remove mozjs dep from malloc_size_of.Josh Matthews2019-05-021-0/+1
|
* Send an IpcSharedMemory in tex_image_2d and tex_sub_image_2dAnthony Ramine2018-11-201-2/+3
| | | | This avoids a copy in the case of textures coming from HTMLImageElement.
* Update MPL license to https (part 3)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Prefix some pixels functions with rgba8_Anthony Ramine2018-11-161-1/+1
|
* Remove useless `use crate_name;` imports.Simon Sapin2018-11-081-1/+0
| | | | A `crate_name::foo` path always works in 2018
* Reorder importsPyfisch2018-11-061-3/+3
|
* `cargo fix --edition`Simon Sapin2018-11-061-6/+6
|
* Handle some transparent black cases in ctx.getImageDataAnthony Ramine2018-10-071-20/+2
|
* Avoid copying pixels in ctx.putImageData sometimesAnthony Ramine2018-10-061-32/+36
|
* Introduce ImageData::get_rectAnthony Ramine2018-10-061-1/+32
| | | | | | | We use that to send only the pixels that will be actually drawn to the canvas thread in CanvasRenderingContext2d::PutImageData. We also make the canvas thread byte swap and premultiply colours in-place.
* Make HTMLCanvasElement::get_size return a Size2D<u32>Anthony Ramine2018-10-021-2/+2
| | | | The changes keep trickling down.
* Format script componentchansuke2018-09-191-19/+27
|
* Fix the build for NLLSimon Sapin2018-08-241-1/+1
| | | | | | Test with `RUSTFLAGS="-Zborrowck=mir -Ztwo-phase-borrows" cargo build` https://internals.rust-lang.org/t/help-us-get-non-lexical-lifetimes-nll-over-the-finish-line/7807/7
* Revert "Fix the build for NLL"Josh Matthews2018-08-071-1/+1
| | | | This reverts commit d1733aa5029c5b97390a236d94eed916ddb64577.
* Fix the build for NLLSimon Sapin2018-08-081-1/+1
| | | | | | Test with `RUSTFLAGS="-Zborrowck=mir -Ztwo-phase-borrows" cargo build` https://internals.rust-lang.org/t/help-us-get-non-lexical-lifetimes-nll-over-the-finish-line/7807/7
* Use safe NonZero constructor instead of an explicit null checkSimon Sapin2018-01-221-2/+1
|