WebKit Bugzilla
Attachment 350209 Details for
Bug 189619
: [EME] Queue a "message" Event algorithm should enqueue a task
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189619-20180920175811.patch (text/plain), 12.33 KB, created by
Xabier RodrÃguez Calvar
on 2018-09-20 08:58:13 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Xabier RodrÃguez Calvar
Created:
2018-09-20 08:58:13 PDT
Size:
12.33 KB
patch
obsolete
>Subversion Revision: 236244 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index bb79157cb7a6250771aa9cb1cb912901a1b72f98..103b30f2630427f513485353a7af732677396691 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-09-20 Xabier Rodriguez Calvar <calvaris@igalia.com> >+ >+ [EME] Queue a "message" Event algorithm should enqueue a task >+ https://bugs.webkit.org/show_bug.cgi?id=189619 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https.html >+ >+ * Modules/encryptedmedia/MediaKeySession.cpp: >+ (WebCore::MediaKeySession::enqueueMessage): Send the message >+ inside a queued task. >+ >+ * Modules/encryptedmedia/MediaKeySession.cpp: >+ (WebCore::MediaKeySession::MediaKeySession): >+ (WebCore::MediaKeySession::enqueueMessage): >+ (WebCore::MediaKeySession::updateKeyStatuses): >+ (WebCore::MediaKeySession::hasPendingActivity const): >+ (WebCore::MediaKeySession::activeDOMObjectName const): >+ (WebCore::MediaKeySession::canSuspendForDocumentSuspension const): >+ (WebCore::MediaKeySession::stop): >+ * Modules/encryptedmedia/MediaKeySession.h: >+ > 2018-09-19 Ryosuke Niwa <rniwa@webkit.org> > > Improve node statistics for rare data >diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp >index eb72ce0778e81cbbcfbeba434c7828dd9a1152a4..ba6b59335bc2bcee83c96d7811728c5a0376b39d 100644 >--- a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp >+++ b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp >@@ -64,7 +64,7 @@ MediaKeySession::MediaKeySession(ScriptExecutionContext& context, WeakPtr<MediaK > , m_sessionType(sessionType) > , m_implementation(WTFMove(implementation)) > , m_instance(WTFMove(instance)) >- , m_eventQueue(*this) >+ , m_eventQueue(context) > { > // https://w3c.github.io/encrypted-media/#dom-mediakeys-setservercertificate > // W3C Editor's Draft 09 November 2016 >@@ -596,7 +596,9 @@ void MediaKeySession::enqueueMessage(MediaKeyMessageType messageType, const Shar > // interface with its type attribute set to message and its isTrusted attribute initialized to true, and dispatch it at the > // session. > auto messageEvent = MediaKeyMessageEvent::create(eventNames().messageEvent, {messageType, message.tryCreateArrayBuffer()}, Event::IsTrusted::Yes); >- m_eventQueue.enqueueEvent(WTFMove(messageEvent)); >+ m_eventQueue.enqueueTask([this, messageEvent = WTFMove(messageEvent), pendingActivity = makePendingActivity(*this)] { >+ dispatchEvent(messageEvent); >+ }); > } > > void MediaKeySession::updateKeyStatuses(CDMInstanceClient::KeyStatusVector&& inputStatuses) >@@ -641,7 +643,12 @@ void MediaKeySession::updateKeyStatuses(CDMInstanceClient::KeyStatusVector&& inp > m_statuses.uncheckedAppend({ WTFMove(status.first), toMediaKeyStatus(status.second) }); > > // 5. Queue a task to fire a simple event named keystatuseschange at the session. >- m_eventQueue.enqueueEvent(Event::create(eventNames().keystatuseschangeEvent, Event::CanBubble::No, Event::IsCancelable::No)); >+ { >+ auto event = Event::create(eventNames().keystatuseschangeEvent, Event::CanBubble::No, Event::IsCancelable::No); >+ m_eventQueue.enqueueTask([this, event = WTFMove(event), pendingActivity = makePendingActivity(*this)] { >+ dispatchEvent(event); >+ }); >+ } > > // 6. Queue a task to run the Attempt to Resume Playback If Necessary algorithm on each of the media element(s) whose mediaKeys attribute is the MediaKeys object that created the session. > m_taskQueue.enqueueTask( >@@ -702,25 +709,23 @@ String MediaKeySession::mediaKeysStorageDirectory() const > > bool MediaKeySession::hasPendingActivity() const > { >- notImplemented(); >- return false; >+ return m_eventQueue.hasPendingTasks() || ActiveDOMObject::hasPendingActivity(); > } > > const char* MediaKeySession::activeDOMObjectName() const > { >- notImplemented(); > return "MediaKeySession"; > } > > bool MediaKeySession::canSuspendForDocumentSuspension() const > { >- notImplemented(); >- return false; >+ return !hasPendingActivity(); > } > > void MediaKeySession::stop() > { >- notImplemented(); >+ m_eventQueue.close(); >+ m_taskQueue.close(); > } > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h >index 0d1900e31bc7bd4917e826b610331ec588c95132..a649884a6ee19401df56a0b1a4f2e8ba18223e36 100644 >--- a/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h >+++ b/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h >@@ -111,7 +111,7 @@ private: > MediaKeySessionType m_sessionType; > Ref<CDM> m_implementation; > Ref<CDMInstance> m_instance; >- GenericEventQueue m_eventQueue; >+ GenericTaskQueue<ScriptExecutionContext> m_eventQueue; > GenericTaskQueue<Timer> m_taskQueue; > Vector<Ref<SharedBuffer>> m_recordOfKeyUsage; > double m_firstDecryptTime { 0 }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 460d3adf96b9faa4ce0d9a56d489a4b32d3d5245..41e4542f60dcee6c3f0e3b2f36e208288b6e6001 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,22 @@ >+2018-09-20 Xabier Rodriguez Calvar <calvaris@igalia.com> >+ >+ [EME] Queue a "message" Event algorithm should enqueue a task >+ https://bugs.webkit.org/show_bug.cgi?id=189619 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * media/encrypted-media/mock-MediaKeySession-remove-expected.txt: >+ * media/encrypted-media/mock-MediaKeySession-remove.html: As per >+ spec, promise callbacks are run before events so events arrive >+ later than promise callbacks. >+ * platform/wpe/TestExpectations: Removed >+ clearkey-mp4-waiting-for-a-key.https.html from failures. >+ * platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-license-events.https-expected.txt: >+ * platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-events.https-expected.txt: >+ Updated expectations because they keep failing, but later. >+ * platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https-expected.txt: >+ Pass expectations updated. >+ > 2018-09-19 Yacine Bandou <yacine.bandou@softathome.com> > > [EME][WPE] Add WebM initData in the expected result of clearkey-generate-request-disallowed-input test >diff --git a/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove-expected.txt b/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove-expected.txt >index 22c2f0bd2603d69247047578cd1d5c8eb1eda5e9..cc6f400eee9590dd0eb57d048229261702524078 100644 >--- a/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove-expected.txt >+++ b/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove-expected.txt >@@ -37,6 +37,7 @@ RUN(mediaKeySession = mediaKeys.createSession("temporary")) > RUN(promise = mediaKeySession.generateRequest("keyids", encoder.encode(kids))) > Promise resolved OK > RUN(promise = mediaKeySession.remove()) >+EXPECTED (event.messageType == 'license-request') OK > EXPECTED (event.messageType == 'license-release') OK > EXPECTED (new Uint8Array(event.message).length == '14') OK > EXPECTED (new Uint8Array(event.message)[0] == '114') OK >diff --git a/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove.html b/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove.html >index da865892bf7fd7a6aa1c8ce8d95fb18fdb9ea99d..84e6c2f295f248d231aa7c7487c0260c2f4335b0 100644 >--- a/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove.html >+++ b/LayoutTests/media/encrypted-media/mock-MediaKeySession-remove.html >@@ -93,11 +93,17 @@ > run('promise = mediaKeySession.generateRequest("keyids", encoder.encode(kids))'); > shouldResolve(promise).then(function() { > run('promise = mediaKeySession.remove()'); >+ let receivedRequest = false; > mediaKeySession.addEventListener('message', function(event) { >- testExpected('event.messageType', 'license-release'); >- testArraysEqual('new Uint8Array(event.message)', encoder.encode("remove-message")); >+ if (!receivedRequest) { >+ testExpected('event.messageType', 'license-request'); >+ receivedRequest = true; >+ } else { >+ testExpected('event.messageType', 'license-release'); >+ testArraysEqual('new Uint8Array(event.message)', encoder.encode("remove-message")); > >- shouldResolve(promise).then(next, next); >+ shouldResolve(promise).then(next, next); >+ } > }, true); > }, next); > }, >diff --git a/LayoutTests/platform/wpe/TestExpectations b/LayoutTests/platform/wpe/TestExpectations >index 4ecc0af7a430e099956e3e2034e162b8bcc834a9..481e7aab46cf1cdbfe3900374dc3edf10dff30d7 100644 >--- a/LayoutTests/platform/wpe/TestExpectations >+++ b/LayoutTests/platform/wpe/TestExpectations >@@ -1216,7 +1216,6 @@ media/encrypted-media/encrypted-media-v2-syntax.html [ Skip ] > #"waitingforkey" event is not supported yet > webkit.org/b/189618 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential-readyState.https.html [ Failure ] > webkit.org/b/189618 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential.https.html [ Failure ] >-webkit.org/b/189619 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https.html [ Failure ] > > webkit.org/b/185594 imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-clear-encrypted.https.html [ Failure ] > >diff --git a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-license-events.https-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-license-events.https-expected.txt >index d1fb1b2e7212dd1dbb33ffb6f94de5de3af0eaa3..ef88407f9d84cfa9a56b89c1de56efec066af8d0 100644 >--- a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-license-events.https-expected.txt >+++ b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-persistent-license-events.https-expected.txt >@@ -1,3 +1,3 @@ > >-FAIL org.w3.clearkey, persistent-license, mp4, playback, check events assert_equals: Expected 1st event to be 'generaterequest' expected "generaterequest" but got "license-request" >+PASS org.w3.clearkey, persistent-license, mp4, playback, check events > >diff --git a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-events.https-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-events.https-expected.txt >index a9ac78c90bed73c8292eab1a0e4db478a03f16f0..0d2449a385104a0c52ff45622bb109495eb11ffb 100644 >--- a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-events.https-expected.txt >+++ b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-playback-temporary-events.https-expected.txt >@@ -1,3 +1,3 @@ > >-FAIL org.w3.clearkey, temporary, mp4, playback, check events assert_equals: Expected 1st event to be 'generaterequest' expected "generaterequest" but got "license-request" >+PASS org.w3.clearkey, temporary, mp4, playback, check events > >diff --git a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https-expected.txt >index 7377617aee377c0efc389cc75b7ef66099ca2c4b..99117214695e3f711260aa5001b017821c69789b 100644 >--- a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https-expected.txt >+++ b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/encrypted-media/clearkey-mp4-waiting-for-a-key.https-expected.txt >@@ -1,3 +1,3 @@ > >-Pass Waiting for a key. >+PASS Waiting for a key. >
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 189619
:
349759
|
350012
|
350209
|
350347