Various CanGc fixes in components/script/dom (#33706)

* 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>
This commit is contained in:
webbeef 2024-10-07 19:30:04 -07:00 committed by GitHub
parent 7d931e673a
commit d3c0785d64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 67 additions and 42 deletions

View file

@ -41,8 +41,8 @@ pub struct Blob {
}
impl Blob {
pub fn new(global: &GlobalScope, blob_impl: BlobImpl) -> DomRoot<Blob> {
Self::new_with_proto(global, None, blob_impl, CanGc::note())
pub fn new(global: &GlobalScope, blob_impl: BlobImpl, can_gc: CanGc) -> DomRoot<Blob> {
Self::new_with_proto(global, None, blob_impl, can_gc)
}
fn new_with_proto(
@ -162,7 +162,7 @@ impl Serializable for Blob {
*blob_impls = None;
}
let deserialized_blob = Blob::new(owner, blob_impl);
let deserialized_blob = Blob::new(owner, blob_impl, CanGc::note());
let blobs = blobs.get_or_insert_with(HashMap::new);
blobs.insert(storage_key, deserialized_blob);
@ -251,7 +251,7 @@ impl BlobMethods for Blob {
normalize_type_string(content_type.unwrap_or(DOMString::from("")).as_ref());
let rel_pos = RelativePos::from_opts(start, end);
let blob_impl = BlobImpl::new_sliced(rel_pos, self.blob_id, type_string);
Blob::new(&self.global(), blob_impl)
Blob::new(&self.global(), blob_impl, CanGc::note())
}
// https://w3c.github.io/FileAPI/#text-method-algo