Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2016 02:46:31 +0000 (02:46 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2016 02:46:31 +0000 (02:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165251

Reviewed by Dean Jackson.

Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
Source/JavaScriptCore:

* runtime/CommonIdentifiers.h: Add WebRTC and MediaStream identifiers.

Source/WebCore:

No new tests, covered by existing tests.

* Modules/mediastream/MediaStreamEvent.idl: Add "EnabledAtRuntime".
* Modules/mediastream/NavigatorMediaDevices.idl: Ditto.
* Modules/mediastream/NavigatorUserMedia.idl: Ditto.
* Modules/mediastream/RTCDTMFToneChangeEvent.idl: Ditto.
* Modules/mediastream/RTCIceCandidate.idl: Ditto.
* Modules/mediastream/RTCPeerConnection.idl: Ditto.
* Modules/mediastream/RTCRtpReceiver.idl: Ditto.
* Modules/mediastream/RTCRtpSender.idl: Ditto.
* Modules/mediastream/RTCRtpTransceiver.idl: Ditto.
* Modules/mediastream/RTCSessionDescription.idl: Ditto.
* Modules/mediastream/RTCTrackEvent.idl: Ditto.

* bindings/generic/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): Set m_isMediaStreamEnabled in the
  constructor instead of in reset() because the later is called by the Internals constructor,
  making it impossible to override the runtime flag from WTR or DRT.
(WebCore::RuntimeEnabledFeatures::reset): Don't set m_isMediaStreamEnabled.
* page/Settings.in: Add peerConnectionEnabled.

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h: Add MediaStream and PeerConnection preferences.
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences mediaStreamEnabled]):
(-[WebPreferences setMediaStreamEnabled:]):
(-[WebPreferences peerConnectionEnabled]):
(-[WebPreferences setPeerConnectionEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetPeerConnectionEnabled): Added.
(WKPreferencesGetPeerConnectionEnabled): Added.
* UIProcess/API/C/WKPreferencesRef.h:

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
  and WebKitPeerConnectionEnabled.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues): Enable MediaStream and PeerConnection.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting): Ditto.

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setMediaStreamEnabled): New.
(WTR::TestRunner::setPeerConnectionEnabled): New.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209643 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStreamEvent.idl
Source/WebCore/Modules/mediastream/NavigatorMediaDevices.idl
Source/WebCore/Modules/mediastream/NavigatorUserMedia.idl
Source/WebCore/Modules/mediastream/RTCDTMFToneChangeEvent.idl
Source/WebCore/Modules/mediastream/RTCIceCandidate.idl
Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
Source/WebCore/Modules/mediastream/RTCRtpReceiver.idl
Source/WebCore/Modules/mediastream/RTCRtpSender.idl
Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl
Source/WebCore/Modules/mediastream/RTCSessionDescription.idl
Source/WebCore/Modules/mediastream/RTCTrackEvent.idl
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
Source/WebCore/page/Settings.in
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRef.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

index f18dd58..8ddf7e8 100644 (file)
@@ -1,3 +1,14 @@
+2016-12-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
+        https://bugs.webkit.org/show_bug.cgi?id=165251
+
+        Reviewed by Dean Jackson.
+
+        Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
+
+        * runtime/CommonIdentifiers.h: Add WebRTC and MediaStream identifiers.
+
 2016-12-09  JF Bastien  <jfbastien@apple.com>
 
         WebAssembly JS API: implement start function
index 0f7e60a..c72865a 100644 (file)
     macro(MediaKeyStatusMap) \
     macro(MediaKeySystemAccess) \
     macro(MediaKeys) \
+    macro(MediaStreamEvent) \
     macro(ModernMediaControls) \
     macro(NaN) \
+    macro(NavigatorMediaDevices) \
+    macro(NavigatorUserMedia) \
     macro(Number) \
     macro(NumberFormat) \
     macro(Object) \
     macro(RegExp) \
     macro(Response) \
     macro(Request) \
+    macro(RTCDTMFToneChangeEvent) \
+    macro(RTCIceCandidate) \
+    macro(RTCPeerConnection) \
+    macro(RTCRtpReceiver) \
+    macro(RTCRtpSender) \
+    macro(RTCRtpTransceiver) \
+    macro(RTCSessionDescription) \
+    macro(RTCTrackEvent) \
     macro(Set)\
     macro(SetIterator)\
     macro(ShadowRoot) \
index b3c96e1..c908d12 100644 (file)
@@ -1,3 +1,32 @@
+2016-12-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
+        https://bugs.webkit.org/show_bug.cgi?id=165251
+
+        Reviewed by Dean Jackson.
+
+        Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
+        No new tests, covered by existing tests.
+
+        * Modules/mediastream/MediaStreamEvent.idl: Add "EnabledAtRuntime".
+        * Modules/mediastream/NavigatorMediaDevices.idl: Ditto.
+        * Modules/mediastream/NavigatorUserMedia.idl: Ditto.
+        * Modules/mediastream/RTCDTMFToneChangeEvent.idl: Ditto.
+        * Modules/mediastream/RTCIceCandidate.idl: Ditto.
+        * Modules/mediastream/RTCPeerConnection.idl: Ditto.
+        * Modules/mediastream/RTCRtpReceiver.idl: Ditto.
+        * Modules/mediastream/RTCRtpSender.idl: Ditto.
+        * Modules/mediastream/RTCRtpTransceiver.idl: Ditto.
+        * Modules/mediastream/RTCSessionDescription.idl: Ditto.
+        * Modules/mediastream/RTCTrackEvent.idl: Ditto.
+
+        * bindings/generic/RuntimeEnabledFeatures.cpp:
+        (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): Set m_isMediaStreamEnabled in the
+          constructor instead of in reset() because the later is called by the Internals constructor,
+          making it impossible to override the runtime flag from WTR or DRT.
+        (WebCore::RuntimeEnabledFeatures::reset): Don't set m_isMediaStreamEnabled.
+        * page/Settings.in: Add peerConnectionEnabled.
+
 2016-12-09  Daniel Bates  <dabates@apple.com>
 
         Remove QuickLook scheme from the list of secure schemes
index 431ede4..7e8bfea 100644 (file)
@@ -25,6 +25,7 @@
 [
     Conditional=WEB_RTC,
     Constructor(DOMString type, MediaStreamEventInit eventInitDict),
+    EnabledAtRuntime=mediaStream,
 ] interface MediaStreamEvent : Event {
     readonly attribute MediaStream? stream;
 };
index bd3bea0..ab4791d 100644 (file)
@@ -30,6 +30,7 @@
 
 [
     Conditional=MEDIA_STREAM,
+    EnabledAtRuntime=mediaStream,
 ] partial interface Navigator {
     readonly attribute MediaDevices mediaDevices;
 };
index b3b5e94..9407f51 100644 (file)
@@ -19,6 +19,7 @@
 
 [
     Conditional=MEDIA_STREAM,
+    EnabledAtRuntime=mediaStream,
 ] partial interface Navigator {
     [JSBuiltin] void webkitGetUserMedia(MediaStreamConstraints constraints, NavigatorUserMediaSuccessCallback successCallback, NavigatorUserMediaErrorCallback errorCallback);
 };
index dfd6da7..835deba 100644 (file)
@@ -26,6 +26,7 @@
 [
     Conditional=WEB_RTC,
     Constructor(DOMString type, optional RTCDTMFToneChangeEventInit eventInitDict),
+    EnabledAtRuntime=peerConnection,
 ] interface RTCDTMFToneChangeEvent : Event {
     readonly attribute DOMString tone;
 };
index 658d682..ef182a5 100644 (file)
@@ -33,6 +33,7 @@
     Conditional=WEB_RTC,
     Constructor(Dictionary dictionary),
     ConstructorMayThrowException,
+    EnabledAtRuntime=peerConnection,
     ImplementationLacksVTable,
     PrivateIdentifier,
     PublicIdentifier
index 2559e53..8dc3591 100644 (file)
@@ -54,6 +54,7 @@ dictionary RTCDataChannelInit {
     ActiveDOMObject,
     Conditional=WEB_RTC,
     ConstructorCallWith=ScriptExecutionContext,
+    EnabledAtRuntime=peerConnection,
     ExportMacro=WEBCORE_EXPORT,
     JSBuiltinConstructor,
 ] interface RTCPeerConnection : EventTarget {
index c5c61c6..28f1d66 100644 (file)
@@ -29,7 +29,8 @@
  */
 
 [
-    Conditional=WEB_RTC
+    Conditional=WEB_RTC,
+    EnabledAtRuntime=peerConnection,
 ] interface RTCRtpReceiver {
     readonly attribute MediaStreamTrack track;
 };
index b3e3c56..3006678 100644 (file)
@@ -30,6 +30,7 @@
 
 [
     Conditional=WEB_RTC,
+    EnabledAtRuntime=peerConnection,
 ] interface RTCRtpSender {
     readonly attribute MediaStreamTrack? track;
 
index ac5449a..07f7fd4 100644 (file)
@@ -29,7 +29,8 @@
  */
 
 [
-    Conditional=WEB_RTC
+    Conditional=WEB_RTC,
+    EnabledAtRuntime=peerConnection,
 ] interface RTCRtpTransceiver {
     readonly attribute DOMString? mid;
     readonly attribute RTCRtpSender sender;
index 9305ae4..d4da695 100644 (file)
@@ -33,6 +33,7 @@
     Conditional=WEB_RTC,
     Constructor(Dictionary dictionary),
     ConstructorMayThrowException,
+    EnabledAtRuntime=peerConnection,
     ImplementationLacksVTable,
     PrivateIdentifier,
     PublicIdentifier,
index 60c1c8f..f743e4f 100644 (file)
@@ -31,6 +31,7 @@
 [
     Conditional=WEB_RTC,
     Constructor(DOMString type, RTCTrackEventInit eventInitDict),
+    EnabledAtRuntime=peerConnection,
 ] interface RTCTrackEvent : Event {
     readonly attribute RTCRtpReceiver receiver;
     readonly attribute MediaStreamTrack track;
index 12ee3cd..9c70c89 100644 (file)
@@ -42,6 +42,9 @@ namespace WebCore {
 RuntimeEnabledFeatures::RuntimeEnabledFeatures()
 {
     reset();
+#if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
+    m_isMediaStreamEnabled = false;
+#endif
 }
 
 void RuntimeEnabledFeatures::reset()
@@ -64,9 +67,6 @@ void RuntimeEnabledFeatures::reset()
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     m_isIndexedDBWorkersEnabled = true;
 #endif
-#if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
-    m_isMediaStreamEnabled = false;
-#endif
 #if ENABLE(WEB_RTC)
     m_isPeerConnectionEnabled = true;
 #endif
index 81292b8..8751587 100644 (file)
@@ -116,6 +116,7 @@ paginateDuringLayoutEnabled initial=false
 fullScreenEnabled initial=false, conditional=FULLSCREEN_API
 asynchronousSpellCheckingEnabled initial=false
 mediaStreamEnabled initial=false
+peerConnectionEnabled initial=false
 
 # This feature requires an implementation of ValidationMessageClient.
 interactiveFormValidationEnabled initial=false
index 353dd75..aca000b 100644 (file)
@@ -1,3 +1,23 @@
+2016-12-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
+        https://bugs.webkit.org/show_bug.cgi?id=165251
+
+        Reviewed by Dean Jackson.
+
+        Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
+
+        * WebView/WebPreferenceKeysPrivate.h: Add MediaStream and PeerConnection preferences.
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences mediaStreamEnabled]):
+        (-[WebPreferences setMediaStreamEnabled:]):
+        (-[WebPreferences peerConnectionEnabled]):
+        (-[WebPreferences setPeerConnectionEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2016-12-09  Ryosuke Niwa  <rniwa@webkit.org>
 
         Don’t expose pointer lock in WebKit1 Objective-C API
index 8003779..3af98c1 100644 (file)
 #define WebKitVisualViewportEnabledPreferenceKey @"WebKitVisualViewportEnabled"
 #define WebKitModernMediaControlsEnabledPreferenceKey @"WebKitModernMediaControlsEnabled"
 #define WebKitSubtleCryptoEnabledPreferenceKey @"WebKitSubtleCryptoEnabled"
+#define WebKitMediaStreamEnabledPreferenceKey @"WebKitMediaStreamEnabled"
+#define WebKitPeerConnectionEnabledPreferenceKey @"WebKitPeerConnectionEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the
index 2dac1f7..61106d5 100644 (file)
@@ -639,6 +639,15 @@ public:
 #if ENABLE(SUBTLE_CRYPTO)
         [NSNumber numberWithBool:YES], WebKitSubtleCryptoEnabledPreferenceKey,
 #endif
+
+#if ENABLE(MEDIA_STREAM)
+        [NSNumber numberWithBool:NO], WebKitMediaStreamEnabledPreferenceKey,
+#endif
+
+#if ENABLE(WEB_RTC)
+        [NSNumber numberWithBool:NO], WebKitPeerConnectionEnabledPreferenceKey,
+#endif
+
         nil];
 
 #if !PLATFORM(IOS)
@@ -2689,6 +2698,25 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitSubtleCryptoEnabledPreferenceKey];
 }
 
+- (BOOL)mediaStreamEnabled
+{
+    return [self _boolValueForKey:WebKitMediaStreamEnabledPreferenceKey];
+}
+
+- (void)setMediaStreamEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitMediaStreamEnabledPreferenceKey];
+}
+
+- (BOOL)peerConnectionEnabled
+{
+    return [self _boolValueForKey:WebKitPeerConnectionEnabledPreferenceKey];
+}
+
+- (void)setPeerConnectionEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitPeerConnectionEnabledPreferenceKey];
+}
 
 - (void)setMetaRefreshEnabled:(BOOL)enabled
 {
index 461bdd9..35dda97 100644 (file)
@@ -162,6 +162,12 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setSubtleCryptoEnabled:(BOOL)flag;
 - (BOOL)subtleCryptoEnabled;
 
+- (void)setMediaStreamEnabled:(BOOL)flag;
+- (BOOL)mediaStreamEnabled;
+
+- (void)setPeerConnectionEnabled:(BOOL)flag;
+- (BOOL)peerConnectionEnabled;
+
 #if !TARGET_OS_IPHONE
 // zero means do AutoScale
 - (float)PDFScaleFactor;
index d03c06a..3700deb 100644 (file)
@@ -2808,6 +2808,11 @@ static bool needsSelfRetainWhileLoadingQuirk()
 #if ENABLE(MEDIA_STREAM)
     settings.setMockCaptureDevicesEnabled([preferences mockCaptureDevicesEnabled]);
     settings.setMediaCaptureRequiresSecureConnection([preferences mediaCaptureRequiresSecureConnection]);
+    RuntimeEnabledFeatures::sharedFeatures().setMediaStreamEnabled([preferences mediaStreamEnabled]);
+#endif
+
+#if ENABLE(WEB_RTC)
+    RuntimeEnabledFeatures::sharedFeatures().setPeerConnectionEnabled([preferences peerConnectionEnabled]);
 #endif
 
 #if ENABLE(WEB_AUDIO)
index 94d9350..9b18d6c 100644 (file)
@@ -1,3 +1,26 @@
+2016-12-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
+        https://bugs.webkit.org/show_bug.cgi?id=165251
+
+        Reviewed by Dean Jackson.
+
+        Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
+
+        * Shared/WebPreferencesDefinitions.h: Add peerConnectionEnabled.
+
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetPeerConnectionEnabled): Added.
+        (WKPreferencesGetPeerConnectionEnabled): Added.
+        * UIProcess/API/C/WKPreferencesRef.h:
+
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add WebKitMediaStreamEnabled
+          and WebKitPeerConnectionEnabled.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences): Initialize the peerConnection preference.
+
 2016-12-09  Brady Eidson  <beidson@apple.com>
 
         Re-landing:
index 6da614b..cd53a65 100644 (file)
     macro(SubpixelCSSOMElementMetricsEnabled, subpixelCSSOMElementMetricsEnabled, Bool, bool, false, "", "") \
     macro(UseGiantTiles, useGiantTiles, Bool, bool, false, "", "") \
     macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false, "", "") \
+    macro(PeerConnectionEnabled, peerConnectionEnabled, Bool, bool, false, "", "") \
     macro(UseLegacyTextAlignPositionedElementBehavior, useLegacyTextAlignPositionedElementBehavior, Bool, bool, false, "", "") \
     macro(SpatialNavigationEnabled, spatialNavigationEnabled, Bool, bool, false, "", "") \
     macro(MediaSourceEnabled, mediaSourceEnabled, Bool, bool, true, "", "") \
index bdfbd76..8baeb19 100644 (file)
@@ -1321,6 +1321,16 @@ bool WKPreferencesGetMediaStreamEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->mediaStreamEnabled();
 }
 
+void WKPreferencesSetPeerConnectionEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setPeerConnectionEnabled(enabled);
+}
+
+bool WKPreferencesGetPeerConnectionEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->peerConnectionEnabled();
+}
+
 void WKPreferencesSetSpatialNavigationEnabled(WKPreferencesRef preferencesRef, bool enabled)
 {
     toImpl(preferencesRef)->setSpatialNavigationEnabled(enabled);
index e088c01..bc5d70b 100644 (file)
@@ -256,6 +256,10 @@ WK_EXPORT bool WKPreferencesGetAsynchronousSpellCheckingEnabled(WKPreferencesRef
 WK_EXPORT void WKPreferencesSetMediaStreamEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetMediaStreamEnabled(WKPreferencesRef preferencesRef);
 
+// Defaults to false
+WK_EXPORT void WKPreferencesSetPeerConnectionEnabled(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetPeerConnectionEnabled(WKPreferencesRef preferencesRef);
+
 // Defaults to false.
 WK_EXPORT void WKPreferencesSetSpatialNavigationEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetSpatialNavigationEnabled(WKPreferencesRef preferencesRef);
index cb04546..46441c2 100644 (file)
@@ -226,6 +226,16 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
         RuntimeEnabledFeatures::sharedFeatures().setSubtleCryptoEnabled(enabled);
 #endif
 
+#if ENABLE(MEDIA_STREAM)
+    if (preference == "WebKitMediaStreamEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setMediaStreamEnabled(enabled);
+#endif
+
+#if ENABLE(WEB_RTC)
+    if (preference == "WebKitPeerConnectionEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setPeerConnectionEnabled(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) \
@@ -244,7 +254,6 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
     macro(WebKitShouldRespectImageOrientation, ShouldRespectImageOrientation, shouldRespectImageOrientation) \
     macro(WebKitEnableCaretBrowsing, CaretBrowsingEnabled, caretBrowsingEnabled) \
     macro(WebKitDisplayImagesKey, LoadsImagesAutomatically, loadsImagesAutomatically) \
-    macro(WebKitMediaStreamEnabled, MediaStreamEnabled, mediaStreamEnabled) \
     macro(WebKitHTTPEquivEnabled, HttpEquivEnabled, httpEquivEnabled) \
     macro(WebKitVisualViewportEnabled, VisualViewportEnabled, visualViewportEnabled) \
     macro(WebKitLargeImageAsyncDecodingEnabled, LargeImageAsyncDecodingEnabled, largeImageAsyncDecodingEnabled) \
index fab953e..6717596 100644 (file)
@@ -3035,6 +3035,10 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings.setMediaStreamEnabled(store.getBoolValueForKey(WebPreferencesKey::mediaStreamEnabledKey()));
 #endif
 
+#if ENABLE(WEB_RTC)
+    settings.setPeerConnectionEnabled(store.getBoolValueForKey(WebPreferencesKey::peerConnectionEnabledKey()));
+#endif
+
 #if ENABLE(SERVICE_CONTROLS)
     settings.setImageControlsEnabled(store.getBoolValueForKey(WebPreferencesKey::imageControlsEnabledKey()));
 #endif
index d6e63dd..fc21cd3 100644 (file)
@@ -1,3 +1,23 @@
+2016-12-09  Eric Carlson  <eric.carlson@apple.com>
+
+        Annotate MediaStream and WebRTC idl with EnabledAtRuntime flag
+        https://bugs.webkit.org/show_bug.cgi?id=165251
+
+        Reviewed by Dean Jackson.
+
+        Based on a patch by Dr Alex Gouaillard <agouaillard@gmail.com>
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues): Enable MediaStream and PeerConnection.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting): Ditto.
+
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setMediaStreamEnabled): New.
+        (WTR::TestRunner::setPeerConnectionEnabled): New.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
 2016-12-09  Brady Eidson  <beidson@apple.com> 
  
         Re-landing:
index a90b5d0..b0956f9 100644 (file)
@@ -1002,6 +1002,9 @@ static void resetWebPreferencesToConsistentValues(const TestOptions& options)
 
     [preferences setSubtleCryptoEnabled:YES];
 
+    [preferences setMediaStreamEnabled:YES];
+    [preferences setPeerConnectionEnabled:YES];
+
     [WebPreferences _clearNetworkLoaderSession];
     [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
 }
index d48110f..6d98911 100644 (file)
@@ -338,6 +338,9 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
 
     m_testRunner->setSubtleCryptoEnabled(true);
 
+    m_testRunner->setMediaStreamEnabled(true);
+    m_testRunner->setPeerConnectionEnabled(true);
+
     if (m_timeout > 0)
         m_testRunner->setCustomTimeout(m_timeout);
 
index 9d6d3ce..7a13d8a 100644 (file)
@@ -361,6 +361,20 @@ void TestRunner::setSubtleCryptoEnabled(bool enabled)
     WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
 }
 
+void TestRunner::setMediaStreamEnabled(bool enabled)
+{
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitMediaStreamEnabled"));
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+}
+
+void TestRunner::setPeerConnectionEnabled(bool enabled)
+{
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitPeerConnectionEnabled"));
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+}
+
 void TestRunner::setDOMIteratorEnabled(bool enabled)
 {
     WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitDOMIteratorEnabled"));
index b89fcda..0108f02 100644 (file)
@@ -130,6 +130,8 @@ public:
     void setES6ModulesEnabled(bool);
     void setEncryptedMediaAPIEnabled(bool);
     void setSubtleCryptoEnabled(bool);
+    void setMediaStreamEnabled(bool);
+    void setPeerConnectionEnabled(bool);
 
     // Special DOM functions.
     void clearBackForwardList();