Title: [208939] trunk
Revision
208939
Author
[email protected]
Date
2016-11-20 22:22:39 -0800 (Sun, 20 Nov 2016)

Log Message

[EncryptedMedia] Make EME API runtime-enabled
https://bugs.webkit.org/show_bug.cgi?id=164927

Reviewed by Jer Noble.

Source/_javascript_Core:

* runtime/CommonIdentifiers.h: Add the necessary identifiers.

Source/WebCore:

Update the EME API IDL definitions to use the EnabledAtRuntime
attribute on the relevant interfaces, attributes and operations.
EncryptedMediaAPI is used as the attribute value.

The corresponding getter, setter and member boolean are added to
the RuntimeEnabledFeatures class.

* Modules/encryptedmedia/MediaKeyMessageEvent.idl:
* Modules/encryptedmedia/MediaKeySession.idl:
* Modules/encryptedmedia/MediaKeyStatusMap.idl:
* Modules/encryptedmedia/MediaKeySystemAccess.idl:
* Modules/encryptedmedia/MediaKeys.idl:
* Modules/encryptedmedia/NavigatorEME.idl:
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setEncryptedMediaAPIEnabled):
(WebCore::RuntimeEnabledFeatures::encryptedMediaAPIEnabled):
* html/HTMLMediaElement.idl:
* html/MediaEncryptedEvent.idl:

Source/WebKit2:

Add the new EncryptedMediaAPI preference. Set the same feature
flag on the shared RuntimeEnabledFeatures object to the
corresponding value that's stored in the WebPreferencesStore.

InjectedBundle::overrideBoolPreferenceForTestRunner() does the
same when the 'WebKitEncryptedMediaAPIEnabled' preference is
overridden in WKTR for testing purposes.

* Shared/WebPreferencesDefinitions.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Enable the EME API via the WKTR InjectedBundle whenever testing
commences. This does not have any effect unless the EME feature
is enabled at compile-time, but it's still added to match other
features and for future use.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setEncryptedMediaAPIEnabled):
* WebKitTestRunner/InjectedBundle/TestRunner.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (208938 => 208939)


--- trunk/Source/_javascript_Core/ChangeLog	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-11-21 06:22:39 UTC (rev 208939)
@@ -1,3 +1,12 @@
+2016-11-20  Zan Dobersek  <[email protected]>
+
+        [EncryptedMedia] Make EME API runtime-enabled
+        https://bugs.webkit.org/show_bug.cgi?id=164927
+
+        Reviewed by Jer Noble.
+
+        * runtime/CommonIdentifiers.h: Add the necessary identifiers.
+
 2016-11-20  Mark Lam  <[email protected]>
 
         Fix exception scope verification failures in ConstructData.cpp.

Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (208938 => 208939)


--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h	2016-11-21 06:22:39 UTC (rev 208939)
@@ -70,6 +70,12 @@
     macro(Map)\
     macro(MapIterator)\
     macro(Math) \
+    macro(MediaEncryptedEvent) \
+    macro(MediaKeyMessageEvent) \
+    macro(MediaKeySession) \
+    macro(MediaKeyStatusMap) \
+    macro(MediaKeySystemAccess) \
+    macro(MediaKeys) \
     macro(ModernMediaControls) \
     macro(NaN) \
     macro(Number) \

Modified: trunk/Source/WebCore/ChangeLog (208938 => 208939)


--- trunk/Source/WebCore/ChangeLog	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/ChangeLog	2016-11-21 06:22:39 UTC (rev 208939)
@@ -1,3 +1,29 @@
+2016-11-20  Zan Dobersek  <[email protected]>
+
+        [EncryptedMedia] Make EME API runtime-enabled
+        https://bugs.webkit.org/show_bug.cgi?id=164927
+
+        Reviewed by Jer Noble.
+
+        Update the EME API IDL definitions to use the EnabledAtRuntime
+        attribute on the relevant interfaces, attributes and operations.
+        EncryptedMediaAPI is used as the attribute value.
+
+        The corresponding getter, setter and member boolean are added to
+        the RuntimeEnabledFeatures class.
+
+        * Modules/encryptedmedia/MediaKeyMessageEvent.idl:
+        * Modules/encryptedmedia/MediaKeySession.idl:
+        * Modules/encryptedmedia/MediaKeyStatusMap.idl:
+        * Modules/encryptedmedia/MediaKeySystemAccess.idl:
+        * Modules/encryptedmedia/MediaKeys.idl:
+        * Modules/encryptedmedia/NavigatorEME.idl:
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setEncryptedMediaAPIEnabled):
+        (WebCore::RuntimeEnabledFeatures::encryptedMediaAPIEnabled):
+        * html/HTMLMediaElement.idl:
+        * html/MediaEncryptedEvent.idl:
+
 2016-11-20  Eric Carlson  <[email protected]>
 
         REGRESSION (r208606?): LayoutTest fast/mediastream/enumerating-crash.html is a flaky crash

Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl (208938 => 208939)


--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -41,6 +41,7 @@
 [
     Conditional=ENCRYPTED_MEDIA,
     Constructor(DOMString type, MediaKeyMessageEventInit eventInitDict),
+    EnabledAtRuntime=EncryptedMediaAPI
 ] interface MediaKeyMessageEvent : Event {
     readonly attribute MediaKeyMessageType messageType;
     readonly attribute ArrayBuffer message;

Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl (208938 => 208939)


--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -28,6 +28,7 @@
 
 [
     Conditional=ENCRYPTED_MEDIA,
+    EnabledAtRuntime=EncryptedMediaAPI
 ] interface MediaKeySession : EventTarget {
     readonly attribute DOMString sessionId;
     readonly attribute unrestricted double expiration;

Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.idl (208938 => 208939)


--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeyStatusMap.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -37,7 +37,8 @@
 };
 
 [
-    Conditional=ENCRYPTED_MEDIA
+    Conditional=ENCRYPTED_MEDIA,
+    EnabledAtRuntime=EncryptedMediaAPI
 ] interface MediaKeyStatusMap {
     iterable<BufferSource, MediaKeyStatus>;
     readonly attribute unsigned long size;

Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.idl (208938 => 208939)


--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -27,7 +27,8 @@
  */
 
 [
-    Conditional=ENCRYPTED_MEDIA
+    Conditional=ENCRYPTED_MEDIA,
+    EnabledAtRuntime=EncryptedMediaAPI
 ] interface MediaKeySystemAccess {
     readonly attribute DOMString keySystem;
     [Custom] MediaKeySystemConfiguration getConfiguration();

Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl (208938 => 208939)


--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -34,6 +34,7 @@
  
 [
     Conditional=ENCRYPTED_MEDIA,
+    EnabledAtRuntime=EncryptedMediaAPI
 ] interface MediaKeys {
     [MayThrowException] MediaKeySession createSession(optional MediaKeySessionType sessionType = "temporary");
     Promise<bool> setServerCertificate(BufferSource serverCertificate);

Modified: trunk/Source/WebCore/Modules/encryptedmedia/NavigatorEME.idl (208938 => 208939)


--- trunk/Source/WebCore/Modules/encryptedmedia/NavigatorEME.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/Modules/encryptedmedia/NavigatorEME.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -27,7 +27,8 @@
  */
 
 [
-    Conditional=ENCRYPTED_MEDIA
+    Conditional=ENCRYPTED_MEDIA,
+    EnabledAtRuntime=EncryptedMediaAPI
 ] partial interface Navigator {
     Promise<MediaKeySystemAccess> requestMediaKeySystemAccess(DOMString keySystem, sequence<MediaKeySystemConfiguration> supportedConfiguration);
 };

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (208938 => 208939)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-11-21 06:22:39 UTC (rev 208939)
@@ -230,6 +230,11 @@
     void setModernMediaControlsEnabled(bool areEnabled) { m_areModernMediaControlsEnabled = areEnabled; }
     bool modernMediaControlsEnabled() const { return m_areModernMediaControlsEnabled; }
 
+#if ENABLE(ENCRYPTED_MEDIA)
+    void setEncryptedMediaAPIEnabled(bool isEnabled) { m_encryptedMediaAPIEnabled = isEnabled; }
+    bool encryptedMediaAPIEnabled() const { return m_encryptedMediaAPIEnabled; }
+#endif
+
     WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
 
     WEBCORE_EXPORT void reset();
@@ -344,6 +349,10 @@
     bool m_cssGridLayoutEnabled;
 #endif
 
+#if ENABLE(ENCRYPTED_MEDIA)
+    bool m_encryptedMediaAPIEnabled { false };
+#endif
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.idl (208938 => 208939)


--- trunk/Source/WebCore/html/HTMLMediaElement.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/html/HTMLMediaElement.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -93,10 +93,10 @@
 
     [Conditional=LEGACY_ENCRYPTED_MEDIA] readonly attribute WebKitMediaKeys webkitKeys;
     [Conditional=LEGACY_ENCRYPTED_MEDIA] void webkitSetMediaKeys(WebKitMediaKeys? mediaKeys);
-    [Conditional=ENCRYPTED_MEDIA] readonly attribute MediaKeys mediaKeys;
-    [Conditional=ENCRYPTED_MEDIA] attribute EventHandler onencrypted;
-    [Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwaitingforkey;
-    [Conditional=ENCRYPTED_MEDIA] Promise<void> setMediaKeys(MediaKeys? mediaKeys);
+    [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] readonly attribute MediaKeys mediaKeys;
+    [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] attribute EventHandler onencrypted;
+    [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] attribute EventHandler onwaitingforkey;
+    [Conditional=ENCRYPTED_MEDIA, EnabledAtRuntime=EncryptedMediaAPI] Promise<void> setMediaKeys(MediaKeys? mediaKeys);
 
     [Conditional=VIDEO_TRACK, MayThrowException] TextTrack addTextTrack(DOMString kind, optional DOMString label = "", optional DOMString language = "");
     [Conditional=VIDEO_TRACK] readonly attribute AudioTrackList audioTracks;

Modified: trunk/Source/WebCore/html/MediaEncryptedEvent.idl (208938 => 208939)


--- trunk/Source/WebCore/html/MediaEncryptedEvent.idl	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebCore/html/MediaEncryptedEvent.idl	2016-11-21 06:22:39 UTC (rev 208939)
@@ -33,7 +33,8 @@
 
 [
     Conditional=ENCRYPTED_MEDIA,
-    Constructor(DOMString type, optional MediaEncryptedEventInit eventInitDict)
+    Constructor(DOMString type, optional MediaEncryptedEventInit eventInitDict),
+    EnabledAtRuntime=EncryptedMediaAPI
 ] interface MediaEncryptedEvent : Event {
     readonly attribute DOMString initDataType;
     readonly attribute ArrayBuffer? initData;

Modified: trunk/Source/WebKit2/ChangeLog (208938 => 208939)


--- trunk/Source/WebKit2/ChangeLog	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-21 06:22:39 UTC (rev 208939)
@@ -1,3 +1,24 @@
+2016-11-20  Zan Dobersek  <[email protected]>
+
+        [EncryptedMedia] Make EME API runtime-enabled
+        https://bugs.webkit.org/show_bug.cgi?id=164927
+
+        Reviewed by Jer Noble.
+
+        Add the new EncryptedMediaAPI preference. Set the same feature
+        flag on the shared RuntimeEnabledFeatures object to the
+        corresponding value that's stored in the WebPreferencesStore.
+
+        InjectedBundle::overrideBoolPreferenceForTestRunner() does the
+        same when the 'WebKitEncryptedMediaAPIEnabled' preference is
+        overridden in WKTR for testing purposes.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-11-19  Antti Koivisto  <[email protected]>
 
         Salt network cache hashes

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (208938 => 208939)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-11-21 06:22:39 UTC (rev 208939)
@@ -236,6 +236,7 @@
     macro(NeedsStorageAccessFromFileURLsQuirk, needsStorageAccessFromFileURLsQuirk, Bool, bool, true, "", "") \
     macro(AsyncImageDecodingEnabled, asyncImageDecodingEnabled, Bool, bool, true, "", "") \
     macro(CustomElementsEnabled, customElementsEnabled, Bool, bool, true, "", "") \
+    macro(EncryptedMediaAPIEnabled, encryptedMediaAPIEnabled, Bool, bool, false, "", "") \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (208938 => 208939)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-11-21 06:22:39 UTC (rev 208939)
@@ -216,6 +216,11 @@
     if (preference == "WebKitModernMediaControlsEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setModernMediaControlsEnabled(enabled);
 
+#if ENABLE(ENCRYPTED_MEDIA)
+    if (preference == "WebKitEncryptedMediaAPIEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setEncryptedMediaAPIEnabled(enabled);
+#endif
+
     // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
 #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
     macro(WebKitAcceleratedCompositingEnabled, AcceleratedCompositingEnabled, acceleratedCompositingEnabled) \

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (208938 => 208939)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-21 06:22:39 UTC (rev 208939)
@@ -3187,6 +3187,10 @@
 
     RuntimeEnabledFeatures::sharedFeatures().setModernMediaControlsEnabled(store.getBoolValueForKey(WebPreferencesKey::modernMediaControlsEnabledKey()));
 
+#if ENABLE(ENCRYPTED_MEDIA)
+    RuntimeEnabledFeatures::sharedFeatures().setEncryptedMediaAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::encryptedMediaAPIEnabledKey()));
+#endif
+
     platformPreferencesDidChange(store);
 
     if (m_drawingArea)

Modified: trunk/Tools/ChangeLog (208938 => 208939)


--- trunk/Tools/ChangeLog	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Tools/ChangeLog	2016-11-21 06:22:39 UTC (rev 208939)
@@ -1,3 +1,21 @@
+2016-11-20  Zan Dobersek  <[email protected]>
+
+        [EncryptedMedia] Make EME API runtime-enabled
+        https://bugs.webkit.org/show_bug.cgi?id=164927
+
+        Reviewed by Jer Noble.
+
+        Enable the EME API via the WKTR InjectedBundle whenever testing
+        commences. This does not have any effect unless the EME feature
+        is enabled at compile-time, but it's still added to match other
+        features and for future use.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setEncryptedMediaAPIEnabled):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
 2016-11-19  Simon Fraser  <[email protected]>
 
         Fix the Mac and iOS bulds.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (208938 => 208939)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-11-21 06:22:39 UTC (rev 208939)
@@ -330,6 +330,8 @@
 
     m_testRunner->setES6ModulesEnabled(true);
 
+    m_testRunner->setEncryptedMediaAPIEnabled(true);
+
     m_testRunner->setCloseRemainingWindowsWhenComplete(false);
     m_testRunner->setAcceptsEditing(true);
     m_testRunner->setTabKeyCyclesThroughElements(true);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (208938 => 208939)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-11-21 06:22:39 UTC (rev 208939)
@@ -396,6 +396,13 @@
     WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
 }
 
+void TestRunner::setEncryptedMediaAPIEnabled(bool enabled)
+{
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitEncryptedMediaAPIEnabled"));
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+}
+
 void TestRunner::setAllowsAnySSLCertificate(bool enabled)
 {
     InjectedBundle::singleton().setAllowsAnySSLCertificate(enabled);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (208938 => 208939)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-11-21 04:38:42 UTC (rev 208938)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-11-21 06:22:39 UTC (rev 208939)
@@ -128,6 +128,7 @@
     void setDownloadAttributeEnabled(bool);
     void setAllowsAnySSLCertificate(bool);
     void setES6ModulesEnabled(bool);
+    void setEncryptedMediaAPIEnabled(bool);
 
     // Special DOM functions.
     void clearBackForwardList();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to