Set the placeholder canvas element of offscreenCanvas to a weak reference in transferControlToOffscreen() (#37764)

Set the placeholder canvas element of offscreenCanvas to a weak
reference in transferControlToOffscreen()

Testing: I do not understand how to test it, suggestions appreciated 
Fixes: https://github.com/servo/servo/issues/35626

---------

Signed-off-by: Rodion Borovyk <rodion.borovyk@gmail.com>
This commit is contained in:
Rodion Borovyk 2025-06-30 15:30:58 +02:00 committed by GitHub
parent 4cd7c5196b
commit 60c10d710d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 52 additions and 27 deletions

View file

@ -23,6 +23,7 @@ use js::error::throw_type_error;
use js::rust::{HandleObject, HandleValue};
use layout_api::HTMLCanvasData;
use pixels::{Snapshot, SnapshotAlphaMode, SnapshotPixelFormat};
use script_bindings::weakref::WeakRef;
use servo_media::streams::MediaStreamType;
use servo_media::streams::registry::MediaStreamId;
use style::attr::AttrValue;
@ -675,7 +676,7 @@ impl HTMLCanvasElementMethods<crate::DomTypeHolder> for HTMLCanvasElement {
None,
self.Width().into(),
self.Height().into(),
Some(&Dom::from_ref(self)),
Some(WeakRef::new(self)),
can_gc,
);