CanGc fixes starting from imagedata.rs (#33808)

* 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>
This commit is contained in:
chickenleaf 2024-10-11 22:08:23 +05:30 committed by GitHub
parent 27b25e869b
commit 20a15619f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 65 additions and 24 deletions

View file

@ -39,6 +39,7 @@ impl ImageData {
width: u32,
height: u32,
mut data: Option<Vec<u8>>,
can_gc: CanGc,
) -> Fallible<DomRoot<ImageData>> {
let len = width * height * 4;
unsafe {
@ -48,16 +49,9 @@ impl ImageData {
d.resize(len as usize, 0);
let data = CreateWith::Slice(&d[..]);
Uint8ClampedArray::create(*cx, data, js_object.handle_mut()).unwrap();
Self::new_with_jsobject(
global,
None,
width,
Some(height),
js_object.get(),
CanGc::note(),
)
Self::new_with_jsobject(global, None, width, Some(height), js_object.get(), can_gc)
} else {
Self::new_without_jsobject(global, None, width, height, CanGc::note())
Self::new_without_jsobject(global, None, width, height, can_gc)
}
}
}