Wrap legacy WebRTC API in runtime flag
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Mar 2017 00:05:36 +0000 (00:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Mar 2017 00:05:36 +0000 (00:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169646

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-16
Reviewed by Alex Christensen.

Source/WebCore:

Test: webrtc/legacy-api.html

Adding a runtime flag for legacy API.
Making some WebIDL peer connection members runtime-enabled.
Adding a JS private getter on this flag so that overloaded operations behave as promise-based only if flag is turned off.

* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCPeerConnectionInternals.js:
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::isWebRTCLegacyAPIEnabled):
(WebCore::JSDOMGlobalObject::addBuiltinGlobals):
* bindings/js/WebCoreBuiltinNames.h:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCLegacyAPIEnabled):
(WebCore::RuntimeEnabledFeatures::setWebRTCLegacyAPIEnabled):

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences webRTCLegacyAPIEnabled]):
(-[WebPreferences setWebRTCLegacyAPIEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Adding preference to legacy API.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetWebRTCLegacyAPIEnabled):
(WKPreferencesGetWebRTCLegacyAPIEnabled):
* UIProcess/API/C/WKPreferencesRef.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setWebRTCLegacyAPIEnabled):
* WebKitTestRunner/InjectedBundle/TestRunner.h:

LayoutTests:

* webrtc/legacy-api-expected.txt: Added.
* webrtc/legacy-api.html: Added.

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

26 files changed:
LayoutTests/ChangeLog
LayoutTests/webrtc/legacy-api-expected.txt [new file with mode: 0644]
LayoutTests/webrtc/legacy-api.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js
Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/page/RuntimeEnabledFeatures.h
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/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

index 858b5ca..511a6f1 100644 (file)
@@ -1,5 +1,15 @@
 2017-03-16  Youenn Fablet  <youenn@apple.com>
 
+        Wrap legacy WebRTC API in runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=169646
+
+        Reviewed by Alex Christensen.
+
+        * webrtc/legacy-api-expected.txt: Added.
+        * webrtc/legacy-api.html: Added.
+
+2017-03-16  Youenn Fablet  <youenn@apple.com>
+
         Rebase webrtc tests
         https://bugs.webkit.org/show_bug.cgi?id=169791
 
diff --git a/LayoutTests/webrtc/legacy-api-expected.txt b/LayoutTests/webrtc/legacy-api-expected.txt
new file mode 100644 (file)
index 0000000..14eb414
--- /dev/null
@@ -0,0 +1,14 @@
+Summary
+
+Harness status: OK
+
+Found 1 tests
+
+1 Pass
+Details
+
+Result Test Name       Message
+Pass   Testing legacy API is not defined when legacy flag is turned off        
+
+PASS Testing legacy API is not defined when legacy flag is turned off 
+
diff --git a/LayoutTests/webrtc/legacy-api.html b/LayoutTests/webrtc/legacy-api.html
new file mode 100644 (file)
index 0000000..0b84495
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+    <head>
+        <script src="../resources/testharness.js"></script>
+    </head>
+    <body>
+        <script>
+if (window.testRunner)
+    testRunner.setWebRTCLegacyAPIEnabled(false);
+
+promise_test(function() {
+    var pc1 = new RTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
+    var pc2 = new RTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
+    assert_equals(pc1.getLocalStreams, undefined);
+    assert_equals(pc1.getRemoteStreams, undefined);
+    assert_equals(pc1.getStreamById, undefined);
+    assert_equals(pc1.addStream, undefined);
+    assert_equals(pc1.removeStream, undefined);
+    assert_equals(pc1.onaddstream, undefined);
+
+    var channel = pc1.createDataChannel("test");
+    return pc1.createOffer({ }, assert_unreached, assert_unreached).then((offer) => {
+        return pc1.setLocalDescription(offer, assert_unreached, assert_unreached).then(() => { return offer; }); 
+    }).then((offer) => {
+        return pc2.setRemoteDescription(offer, assert_unreached, assert_unreached); 
+    }).then(() => {
+        return pc2.createAnswer({ }, assert_unreached, assert_unreached);
+    });
+}, "Testing legacy API is not defined when legacy flag is turned off");
+        </script>
+        <script src="../resources/testharnessreport.js"></script>
+    </body>
+</html>
index 6b4bdf9..5f99bda 100644 (file)
@@ -1,3 +1,26 @@
+2017-03-16  Youenn Fablet  <youenn@apple.com>
+
+        Wrap legacy WebRTC API in runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=169646
+
+        Reviewed by Alex Christensen.
+
+        Test: webrtc/legacy-api.html
+
+        Adding a runtime flag for legacy API.
+        Making some WebIDL peer connection members runtime-enabled.
+        Adding a JS private getter on this flag so that overloaded operations behave as promise-based only if flag is turned off.
+
+        * Modules/mediastream/RTCPeerConnection.idl:
+        * Modules/mediastream/RTCPeerConnectionInternals.js:
+        * bindings/js/JSDOMGlobalObject.cpp:
+        (WebCore::isWebRTCLegacyAPIEnabled):
+        (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
+        * bindings/js/WebCoreBuiltinNames.h:
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::webRTCLegacyAPIEnabled):
+        (WebCore::RuntimeEnabledFeatures::setWebRTCLegacyAPIEnabled):
+
 2017-03-16  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebCrypto] Support SPKI/PKCS8 for Elliptic Curve
index fc06a96..7b48b2f 100644 (file)
     // 9.6 Identity Provider API
     // FIXME 169644: missing IdP
 
-
     // Legacy MediaStream API
-    // FIXME 169646: wrap this in runtime flag
-    [JSBuiltin] sequence<MediaStream> getLocalStreams();
-    [PrivateIdentifier, PublicIdentifier] sequence<MediaStream> getRemoteStreams();
-    [JSBuiltin] MediaStream getStreamById(DOMString streamId);
+    [JSBuiltin, EnabledAtRuntime=WebRTCLegacyAPI] sequence<MediaStream> getLocalStreams();
+    [PrivateIdentifier, PublicIdentifier, EnabledAtRuntime=WebRTCLegacyAPI] sequence<MediaStream> getRemoteStreams();
+    [JSBuiltin, EnabledAtRuntime=WebRTCLegacyAPI] MediaStream getStreamById(DOMString streamId);
 
-    [JSBuiltin] void addStream(MediaStream stream);
-    [JSBuiltin] void removeStream(MediaStream stream);
+    [JSBuiltin, EnabledAtRuntime=WebRTCLegacyAPI] void addStream(MediaStream stream);
+    [JSBuiltin, EnabledAtRuntime=WebRTCLegacyAPI] void removeStream(MediaStream stream);
 
     // Legacy event handler (MediaStream-based API)
-    attribute EventHandler onaddstream;
+    [EnabledAtRuntime=WebRTCLegacyAPI] attribute EventHandler onaddstream;
 };
index 498d4f8..99671eb 100644 (file)
@@ -88,7 +88,7 @@ function objectAndCallbacksOverload(args, functionName, objectInfo, promiseMode,
     if (!objectArgOk)
         return @Promise.@reject(new @TypeError(`Argument 1 ('${objectInfo.argName}') to RTCPeerConnection.${functionName} must be an instance of ${objectInfo.argType}`));
 
-    if (argsCount === 1)
+    if (!@webRTCLegacyAPIEnabled() || argsCount === 1)
         return promiseMode(objectArg);
 
     // More than one argument: Legacy mode
@@ -111,7 +111,7 @@ function callbacksAndDictionaryOverload(args, functionName, promiseMode, legacyM
 {
     "use strict";
 
-    if (args.length <= 1) {
+    if (!@webRTCLegacyAPIEnabled() || args.length <= 1) {
         // Zero or one arguments: Promise mode
         const options = args[0];
         if (args.length && !@isDictionary(options))
index 4e581a2..bd1bc06 100644 (file)
@@ -50,6 +50,7 @@ namespace WebCore {
 
 EncodedJSValue JSC_HOST_CALL makeThisTypeErrorForBuiltins(ExecState*);
 EncodedJSValue JSC_HOST_CALL makeGetterTypeErrorForBuiltins(ExecState*);
+EncodedJSValue JSC_HOST_CALL isWebRTCLegacyAPIEnabled(ExecState*);
 
 const ClassInfo JSDOMGlobalObject::s_info = { "DOMGlobalObject", &JSGlobalObject::s_info, 0, CREATE_METHOD_TABLE(JSDOMGlobalObject) };
 
@@ -99,6 +100,13 @@ EncodedJSValue JSC_HOST_CALL makeGetterTypeErrorForBuiltins(ExecState* execState
     return JSValue::encode(createTypeError(execState, makeGetterTypeErrorMessage(interfaceName.utf8().data(), attributeName.utf8().data())));
 }
 
+#if ENABLE(WEB_RTC)
+EncodedJSValue JSC_HOST_CALL isWebRTCLegacyAPIEnabled(ExecState*)
+{
+    return JSValue::encode(jsBoolean(RuntimeEnabledFeatures::sharedFeatures().webRTCLegacyAPIEnabled()));
+}
+#endif
+
 void JSDOMGlobalObject::addBuiltinGlobals(VM& vm)
 {
     m_builtinInternalFunctions.initialize(*this);
@@ -155,6 +163,9 @@ void JSDOMGlobalObject::addBuiltinGlobals(VM& vm)
 #endif
         JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().ReadableStreamDefaultReaderPrivateName(), privateReadableStreamDefaultReaderConstructor, DontDelete | ReadOnly),
 #endif
+#if ENABLE(WEB_RTC)
+        JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().webRTCLegacyAPIEnabledPrivateName(), JSFunction::create(vm, this, 0, String(), isWebRTCLegacyAPIEnabled), DontDelete | ReadOnly),
+#endif
     };
     addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
 }
index da18792..25d2e47 100644 (file)
@@ -107,6 +107,7 @@ namespace WebCore {
     macro(underlyingSink) \
     macro(underlyingSource) \
     macro(view) \
+    macro(webRTCLegacyAPIEnabled) \
     macro(writing) \
     macro(Headers) \
     macro(MediaStream) \
index 4cb521f..03e2ba0 100644 (file)
@@ -96,6 +96,8 @@ public:
 #if ENABLE(WEB_RTC)
     bool peerConnectionEnabled() const { return m_isPeerConnectionEnabled; }
     void setPeerConnectionEnabled(bool isEnabled) { m_isPeerConnectionEnabled = isEnabled; }
+    bool webRTCLegacyAPIEnabled() const { return m_webRTCLegacyAPIEnabled; }
+    void setWebRTCLegacyAPIEnabled(bool isEnabled) { m_webRTCLegacyAPIEnabled = isEnabled; }
 #endif
 
 #if ENABLE(LEGACY_CSS_VENDOR_PREFIXES)
@@ -231,6 +233,7 @@ private:
 
 #if ENABLE(WEB_RTC)
     bool m_isPeerConnectionEnabled { true };
+    bool m_webRTCLegacyAPIEnabled { true };
 #endif
 
 #if ENABLE(LEGACY_CSS_VENDOR_PREFIXES)
index 0436b3c..c073de0 100644 (file)
@@ -1,3 +1,19 @@
+2017-03-16  Youenn Fablet  <youenn@apple.com>
+
+        Wrap legacy WebRTC API in runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=169646
+
+        Reviewed by Alex Christensen.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences webRTCLegacyAPIEnabled]):
+        (-[WebPreferences setWebRTCLegacyAPIEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-03-14  Megan Gardner  <megan_gardner@apple.com>
 
         Correctly export WebItemProviderPasteboard
index 8b55202..b6ad75e 100644 (file)
 #define WebKitSubtleCryptoEnabledPreferenceKey @"WebKitSubtleCryptoEnabled"
 #define WebKitMediaStreamEnabledPreferenceKey @"WebKitMediaStreamEnabled"
 #define WebKitPeerConnectionEnabledPreferenceKey @"WebKitPeerConnectionEnabled"
+#define WebKitWebRTCLegacyAPIEnabledPreferenceKey @"WebKitWebRTCLegacyAPIEnabled"
 #define WebKitLinkPreloadEnabledPreferenceKey @"WebKitLinkPreloadEnabled"
 #define WebKitCredentialManagementEnabledPreferenceKey @"WebKitCredentialManagementEnabled"
 
index c221688..d568a69 100644 (file)
@@ -655,6 +655,7 @@ public:
 #endif
 #if ENABLE(WEB_RTC)
         [NSNumber numberWithBool:NO], WebKitPeerConnectionEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO], WebKitWebRTCLegacyAPIEnabledPreferenceKey,
 #endif
 #if ENABLE(INTERSECTION_OBSERVER)
         @NO, WebKitIntersectionObserverEnabledPreferenceKey,
@@ -2775,6 +2776,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitPeerConnectionEnabledPreferenceKey];
 }
 
+- (BOOL)webRTCLegacyAPIEnabled
+{
+    return [self _boolValueForKey:WebKitWebRTCLegacyAPIEnabledPreferenceKey];
+}
+
+- (void)setWebRTCLegacyAPIEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitWebRTCLegacyAPIEnabledPreferenceKey];
+}
+
 - (BOOL)linkPreloadEnabled
 {
     return [self _boolValueForKey:WebKitLinkPreloadEnabledPreferenceKey];
index 43d7df8..ee95ff8 100644 (file)
@@ -168,6 +168,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setPeerConnectionEnabled:(BOOL)flag;
 - (BOOL)peerConnectionEnabled;
 
+- (void)setWebRTCLegacyAPIEnabled:(BOOL)flag;
+- (BOOL)webRTCLegacyAPIEnabled;
+
 #if !TARGET_OS_IPHONE
 // zero means do AutoScale
 - (float)PDFScaleFactor;
index 8d35fc1..f02d900 100644 (file)
@@ -2867,6 +2867,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
 #if ENABLE(WEB_RTC)
     RuntimeEnabledFeatures::sharedFeatures().setPeerConnectionEnabled([preferences peerConnectionEnabled]);
+    RuntimeEnabledFeatures::sharedFeatures().setWebRTCLegacyAPIEnabled([preferences webRTCLegacyAPIEnabled]);
 #endif
 
 #if ENABLE(WEB_AUDIO)
index 709ff38..8fd5837 100644 (file)
@@ -1,3 +1,22 @@
+2017-03-16  Youenn Fablet  <youenn@apple.com>
+
+        Wrap legacy WebRTC API in runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=169646
+
+        Reviewed by Alex Christensen.
+
+        Adding preference to legacy API.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetWebRTCLegacyAPIEnabled):
+        (WKPreferencesGetWebRTCLegacyAPIEnabled):
+        * UIProcess/API/C/WKPreferencesRef.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2017-03-16  Brady Eidson  <beidson@apple.com>
 
         Update the WKHTTPCookieStore API to be simpler and add observers.
index b9c159d..6c19d54 100644 (file)
     macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false, "", "") \
     macro(MediaCaptureRequiresSecureConnection, mediaCaptureRequiresSecureConnection, Bool, bool, true, "", "") \
     macro(EnumeratingAllNetworkInterfacesEnabled, enumeratingAllNetworkInterfacesEnabled, Bool, bool, false, "", "") \
+    macro(WebRTCLegacyAPIEnabled, webRTCLegacyAPIEnabled, Bool, bool, true, "", "") \
     macro(ICECandidateFilteringEnabled, iceCandidateFilteringEnabled, Bool, bool, true, "", "") \
     macro(ShadowDOMEnabled, shadowDOMEnabled, Bool, bool, true, "Shadow DOM", "HTML Shadow DOM prototype") \
     macro(FetchAPIEnabled, fetchAPIEnabled, Bool, bool, true, "", "") \
index b899554..97ec149 100644 (file)
@@ -1351,6 +1351,16 @@ bool WKPreferencesGetPeerConnectionEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->peerConnectionEnabled();
 }
 
+void WKPreferencesSetWebRTCLegacyAPIEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setWebRTCLegacyAPIEnabled(enabled);
+}
+
+bool WKPreferencesGetWebRTCLegacyAPIEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->webRTCLegacyAPIEnabled();
+}
+
 void WKPreferencesSetSpatialNavigationEnabled(WKPreferencesRef preferencesRef, bool enabled)
 {
     toImpl(preferencesRef)->setSpatialNavigationEnabled(enabled);
index bc5d70b..5cb6122 100644 (file)
@@ -260,6 +260,10 @@ WK_EXPORT bool WKPreferencesGetMediaStreamEnabled(WKPreferencesRef preferencesRe
 WK_EXPORT void WKPreferencesSetPeerConnectionEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetPeerConnectionEnabled(WKPreferencesRef preferencesRef);
 
+// Should default to false
+WK_EXPORT void WKPreferencesSetWebRTCLegacyAPIEnabled(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetWebRTCLegacyAPIEnabled(WKPreferencesRef preferencesRef);
+
 // Defaults to false.
 WK_EXPORT void WKPreferencesSetSpatialNavigationEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetSpatialNavigationEnabled(WKPreferencesRef preferencesRef);
index 885e3e9..ea2de6d 100644 (file)
@@ -237,6 +237,8 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
 #if ENABLE(WEB_RTC)
     if (preference == "WebKitPeerConnectionEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setPeerConnectionEnabled(enabled);
+    if (preference == "WebKitWebRTCLegacyAPIEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setWebRTCLegacyAPIEnabled(enabled);
 #endif
 
     // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
index 6847b2e..dd6afe1 100644 (file)
@@ -3130,6 +3130,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 
 #if ENABLE(WEB_RTC)
     RuntimeEnabledFeatures::sharedFeatures().setPeerConnectionEnabled(store.getBoolValueForKey(WebPreferencesKey::peerConnectionEnabledKey()));
+    RuntimeEnabledFeatures::sharedFeatures().setWebRTCLegacyAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::webRTCLegacyAPIEnabledKey()));
 #endif
 
 #if ENABLE(SERVICE_CONTROLS)
index 90e36e3..d0f7589 100644 (file)
@@ -1,3 +1,19 @@
+2017-03-16  Youenn Fablet  <youenn@apple.com>
+
+        Wrap legacy WebRTC API in runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=169646
+
+        Reviewed by Alex Christensen.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (enableExperimentalFeatures):
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setWebRTCLegacyAPIEnabled):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
 2017-03-16  Brady Eidson  <beidson@apple.com>
 
         Update the WKHTTPCookieStore API to be simpler and add observers.
index d895a44..297d27d 100644 (file)
@@ -849,6 +849,7 @@ static void enableExperimentalFeatures(WebPreferences* preferences)
     [preferences setWebGL2Enabled:YES];
     [preferences setWebGPUEnabled:YES];
     [preferences setPeerConnectionEnabled:YES];
+    [preferences setWebRTCLegacyAPIEnabled:YES];
     [preferences setCredentialManagementEnabled:YES];
 }
 
index d398c38..e0f3e29 100644 (file)
@@ -268,4 +268,6 @@ interface TestRunner {
 
     // Open panel
     void setOpenPanelFiles(object filesArray);
+
+    void setWebRTCLegacyAPIEnabled(boolean value);
 };
index c55ddd2..027bb1f 100644 (file)
@@ -345,6 +345,7 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
 
     m_testRunner->setMediaStreamEnabled(true);
     m_testRunner->setPeerConnectionEnabled(true);
+    m_testRunner->setWebRTCLegacyAPIEnabled(true);
 
     if (m_timeout > 0)
         m_testRunner->setCustomTimeout(m_timeout);
index d4072b0..69f0c5f 100644 (file)
@@ -381,6 +381,13 @@ void TestRunner::setPeerConnectionEnabled(bool enabled)
     WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
 }
 
+void TestRunner::setWebRTCLegacyAPIEnabled(bool enabled)
+{
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitWebRTCLegacyAPIEnabled"));
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+}
+
 void TestRunner::setModernMediaControlsEnabled(bool enabled)
 {
     WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitModernMediaControlsEnabled"));
index d680c08..fe44d37 100644 (file)
@@ -133,6 +133,7 @@ public:
     void setSubtleCryptoEnabled(bool);
     void setMediaStreamEnabled(bool);
     void setPeerConnectionEnabled(bool);
+    void setWebRTCLegacyAPIEnabled(bool);
 
     // Special DOM functions.
     void clearBackForwardList();