haikuwebkit/Source/WebCore/Modules/remoteplayback
Ryosuke Niwa 6ba30d40a8 RemotePlayback must keep its media element alive when there is a pending activity
https://bugs.webkit.org/show_bug.cgi?id=227471
<rdar://79694015>

Reviewed by Geoffrey Garen.

Source/WebCore:

Fixed the bug that the media element's JS wrapper can be collected while there is still
a pending activity for RemotePlayback. In fact, the newly added test demonstrates that
the media element can be deleted without this patch.

This patch also introduces new extended IDL interface attribute GenerateAddOpaqueRoot
to make adding an opaque root as a part of visitChildren easy in the DOM code.

Test: media/remoteplayback-watch-availability-gc.html

* Modules/remoteplayback/RemotePlayback.cpp:
(WebCore::RemotePlayback::ownerNode const):
* Modules/remoteplayback/RemotePlayback.h:
* Modules/remoteplayback/RemotePlayback.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(InstanceNeedsVisitChildren):
(GenerateImplementation):
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.cpp: Added.
(WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::prototypeForStructure):
(WebCore::JSTestGenerateAddOpaqueRootDOMConstructor::initializeProperties):
(WebCore::JSTestGenerateAddOpaqueRootPrototype::finishCreation):
(WebCore::JSTestGenerateAddOpaqueRoot::JSTestGenerateAddOpaqueRoot):
(WebCore::JSTestGenerateAddOpaqueRoot::finishCreation):
(WebCore::JSTestGenerateAddOpaqueRoot::createPrototype):
(WebCore::JSTestGenerateAddOpaqueRoot::prototype):
(WebCore::JSTestGenerateAddOpaqueRoot::getConstructor):
(WebCore::JSTestGenerateAddOpaqueRoot::destroy):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
(WebCore::jsTestGenerateAddOpaqueRoot_someAttributeGetter):
(WebCore::JSTestGenerateAddOpaqueRoot::subspaceForImpl):
(WebCore::JSTestGenerateAddOpaqueRoot::visitChildrenImpl):
(WebCore::JSTestGenerateAddOpaqueRoot::analyzeHeap):
(WebCore::JSTestGenerateAddOpaqueRootOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestGenerateAddOpaqueRootOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSTestGenerateAddOpaqueRoot::toWrapped):
* bindings/scripts/test/JS/JSTestGenerateAddOpaqueRoot.h: Added.
(WebCore::JSTestGenerateAddOpaqueRoot::create):
(WebCore::JSTestGenerateAddOpaqueRoot::createStructure):
(WebCore::JSTestGenerateAddOpaqueRoot::subspaceFor):
(WebCore::wrapperOwner):
(WebCore::wrapperKey):
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObject_TestGenerateAddOpaqueRootConstructorGetter):
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestGenerateAddOpaqueRoot.idl: Added.
* testing/Internals.cpp:
(WebCore::Internals::isElementAlive const):
(WebCore::Internals::mediaElementCount):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Added a GC test.

* media/remoteplayback-watch-availability-gc-expected.txt: Added.
* media/remoteplayback-watch-availability-gc.html: Added.


Canonical link: https://commits.webkit.org/239299@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279443 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-30 23:53:16 +00:00
..
HTMLMediaElement+RemotePlayback.idl [WebIDL] Switch to new file name convention for partial interfaces 2020-09-23 00:20:14 +00:00
HTMLMediaElementRemotePlayback.h
RemotePlayback.cpp RemotePlayback must keep its media element alive when there is a pending activity 2021-06-30 23:53:16 +00:00
RemotePlayback.h RemotePlayback must keep its media element alive when there is a pending activity 2021-06-30 23:53:16 +00:00
RemotePlayback.idl RemotePlayback must keep its media element alive when there is a pending activity 2021-06-30 23:53:16 +00:00
RemotePlaybackAvailabilityCallback.h
RemotePlaybackAvailabilityCallback.idl