media: Clean up shadow root content when removing controls#43983
Conversation
27478d6 to
ad96e6a
Compare
|
The thing is, cleaning the text content of the We should probably do: But we still need to figure out how to run the cleanup step when media elements is deleted with |
|
@rayguo17 |
|
I will again into it |
|
@rayguo17 Which approach would you prefer? |
|
The first approach sounds more reasonable. |
|
@rayguo17 can you check again and tell me what you think now ? |
|
This is nice! |
|
🔨 Triggering try run (#24169289463) for Linux (WPT) |
|
Test results for linux-wpt from try job (#24169289463): Flaky unexpected result (39)
Stable unexpected results that are known to be intermittent (18)
Stable unexpected results (1)
|
|
|
|
That test timeout is unrelated. |
Signed-off-by: Messi002 <rostandmessi2@gmail.com>
|
ok @jdm |
When media controls are removed (either by removing the controls attribute or by removing the element from the DOM), the shadow root's children are now cleared. This breaks the reference cycle between the js mediacontrols instance and the media element, the event listeners and this.media reference in the controls script would otherwise keep the element alive and prevent garbage collection.
I tested the controls and it renders correctly and deleting a video with controls doesn't crash.
Fixes: #43828