WebKit Bugzilla
Attachment 348295 Details for
Bug 189016
: WebKitMediaSession should be GC collectable when its document is being stopped
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189016-20180828083450.patch (text/plain), 7.50 KB, created by
youenn fablet
on 2018-08-28 08:34:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-08-28 08:34:51 PDT
Size:
7.50 KB
patch
obsolete
>Subversion Revision: 235392 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2905448ac1f95e5b0aa975b8fdf6f053767791dd..70d0970a1c48469f4710fcf2b30a92e5a3c0f497 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-08-28 Youenn Fablet <youenn@apple.com> >+ >+ WebKitMediaSession should be GC collectable when its document is being stopped >+ https://bugs.webkit.org/show_bug.cgi?id=189016 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make sure WebKitMediaSession is collectable after its document is stopped. >+ This is done by nullifying m_session when calling close. >+ This way hasPendingActivity() returns false when stop() is called. >+ >+ Test: http/tests/media/clearkey/collect-webkit-media-session.html >+ >+ * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: >+ (WebCore::WebKitMediaKeySession::WebKitMediaKeySession): >+ (WebCore::WebKitMediaKeySession::close): >+ * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: >+ > 2018-08-27 Youenn Fablet <youenn@apple.com> > > Various IndexDB tests abandon documents >diff --git a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp >index b6aa5d85684b56b6005360598f7798cf4f6a3274..e666ce97936745eda0106607978f6e9809ff0b39 100644 >--- a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp >@@ -56,6 +56,8 @@ WebKitMediaKeySession::WebKitMediaKeySession(ScriptExecutionContext& context, We > , m_keyRequestTimer(*this, &WebKitMediaKeySession::keyRequestTimerFired) > , m_addKeyTimer(*this, &WebKitMediaKeySession::addKeyTimerFired) > { >+ if (m_session) >+ m_sessionId = m_session->sessionId(); > } > > WebKitMediaKeySession::~WebKitMediaKeySession() >@@ -68,8 +70,10 @@ WebKitMediaKeySession::~WebKitMediaKeySession() > > void WebKitMediaKeySession::close() > { >- if (m_session) >+ if (m_session) { > m_session->releaseKeys(); >+ m_session = nullptr; >+ } > } > > RefPtr<ArrayBuffer> WebKitMediaKeySession::cachedKeyForKeyId(const String& keyId) const >@@ -77,11 +81,6 @@ RefPtr<ArrayBuffer> WebKitMediaKeySession::cachedKeyForKeyId(const String& keyId > return m_session ? m_session->cachedKeyForKeyID(keyId) : nullptr; > } > >-const String& WebKitMediaKeySession::sessionId() const >-{ >- return m_session->sessionId(); >-} >- > void WebKitMediaKeySession::generateKeyRequest(const String& mimeType, Ref<Uint8Array>&& initData) > { > m_pendingKeyRequests.append({ mimeType, WTFMove(initData) }); >diff --git a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h >index 1d0dc7c4aab0a8b88c957928ec6de47a653bd889..9301f09381007d6a7684ec2ba3210d305d066a7c 100644 >--- a/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h >+++ b/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h >@@ -48,7 +48,7 @@ public: > > WebKitMediaKeyError* error() { return m_error.get(); } > const String& keySystem() const { return m_keySystem; } >- const String& sessionId() const; >+ const String& sessionId() const { return m_sessionId; } > ExceptionOr<void> update(Ref<Uint8Array>&& key); > void close(); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4fe3470dc3650928572745a77f4f8ac146b2f774..b940a72f4ac61575dd04b6a5dbde03c819a8380e 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2018-08-28 Youenn Fablet <youenn@apple.com> >+ >+ WebKitMediaSession should be GC collectable when its document is being stopped >+ https://bugs.webkit.org/show_bug.cgi?id=189016 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/media/clearkey/collect-webkit-media-session-expected.txt: Added. >+ * http/tests/media/clearkey/collect-webkit-media-session.html: Added. >+ * http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm: Added. >+ > 2018-08-27 Youenn Fablet <youenn@apple.com> > > Various IndexDB tests abandon documents >diff --git a/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session-expected.txt b/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..38ffb88f23faab7a3996ec3fa71de2c6e91b1850 >--- /dev/null >+++ b/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session-expected.txt >@@ -0,0 +1,4 @@ >+ >+ >+PASS Ensure that the frame's document get collected after being stopped while doing some webkit media session calls >+ >diff --git a/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session.html b/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session.html >new file mode 100644 >index 0000000000000000000000000000000000000000..82975dd8b2d5c6641f48adfc488974921b9c85e4 >--- /dev/null >+++ b/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session.html >@@ -0,0 +1,45 @@ >+<!DOCTYPE html> >+<meta charset="utf-8"> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script> >+function waitFor(duration) >+{ >+ return new Promise((resolve) => setTimeout(resolve, duration)); >+} >+ >+var resolveCallback, rejectCallback; >+var promise = new Promise((resolve, reject) => { >+ resolveCallback = resolve; >+ rejectCallback = reject; >+}); >+ >+async function done() >+{ >+ try { >+ const frameIdentifier = internals.documentIdentifier(iframe.contentDocument); >+ iframe.src = "non-existent-frame"; >+ let counter = 0; >+ while (++counter < 10) { >+ if (!internals.isDocumentAlive(frameIdentifier)) { >+ resolveCallback(); >+ return; >+ } >+ if (window.GCController) >+ GCController.collect(); >+ >+ await waitFor(50); >+ } >+ } finally { >+ rejectCallback("Test failed"); >+ } >+} >+ >+promise_test((test) => { >+ if (!window.internals) >+ rejectCallback("Test require internals API"); >+ return promise; >+}, "Ensure that the frame's document get collected after being stopped while doing some webkit media session calls"); >+ >+</script> >+<iframe src="resources/mywebkitmediasessionframe.htm" id="iframe"></iframe> >diff --git a/LayoutTests/http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm b/LayoutTests/http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm >new file mode 100644 >index 0000000000000000000000000000000000000000..acf55f5d043a15acad0b5469fb1b5c8518d6fbe1 >--- /dev/null >+++ b/LayoutTests/http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm >@@ -0,0 +1,32 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script> >+ var keyId; >+ var session; >+ >+ function go() >+ { >+ video.addEventListener('webkitneedkey', needkey, true); >+ video.src = '../../resources/hls/clearkey/prog_index.m3u8'; >+ } >+ >+ function needkey(event) >+ { >+ if (!video.webkitKeys) >+ video.webkitSetMediaKeys(new WebKitMediaKeys('org.w3c.clearkey')); >+ >+ if (!video.webkitKeys) { >+ log('Error: org.w3c.clearkey not supported.'); >+ return; >+ } >+ >+ session = video.webkitKeys.createSession('application/x-mpegurl', event.initData); >+ parent.done(); >+ } >+ </script> >+</head> >+<body onload="go()"> >+ <video id="video" controls></video> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189016
:
348220
|
348295
|
348373