[WebRTC][Mac][WebKit2] Initial WebProcess does not support WebRTC
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Feb 2017 18:10:16 +0000 (18:10 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Feb 2017 18:10:16 +0000 (18:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168438
<rdar://problem/30401818>

Reviewed by Youenn Fablet.

The sandbox extension for microphone access does not take effect until the second WebProcess
is created, causing the initial browser tab to lack microphone support.

This patch checks the setting earlier in the boot process so that the initial WebProcess
instance gets the correct setting.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess): Move microphone sandbox extension here, so that the
initial WebProcess has the correct microphone access.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess): Move microphone sandbox extension from here to platform-specific file.
(WebKit::WebProcessPool::createWebPage): Remove unneeded preference checks.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit2/UIProcess/WebProcessPool.cpp

index 282d9e2..6995f5a 100644 (file)
@@ -1,3 +1,24 @@
+2017-02-16  Brent Fulgham  <bfulgham@apple.com>
+
+        [WebRTC][Mac][WebKit2] Initial WebProcess does not support WebRTC
+        https://bugs.webkit.org/show_bug.cgi?id=168438
+        <rdar://problem/30401818>
+
+        Reviewed by Youenn Fablet.
+
+        The sandbox extension for microphone access does not take effect until the second WebProcess
+        is created, causing the initial browser tab to lack microphone support.
+
+        This patch checks the setting earlier in the boot process so that the initial WebProcess
+        instance gets the correct setting.
+
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess): Move microphone sandbox extension here, so that the
+        initial WebProcess has the correct microphone access.
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createNewWebProcess): Move microphone sandbox extension from here to platform-specific file.
+        (WebKit::WebProcessPool::createWebPage): Remove unneeded preference checks.
+
 2017-02-16  Eric Carlson  <eric.carlson@apple.com>
 
         Add WebRTC as an off-by-default experimental feature menu item.
index 2767df9..4663947 100644 (file)
@@ -245,6 +245,15 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
     ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
     parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
 #endif
+#if ENABLE(MEDIA_STREAM)
+    bool webRTCEnabled = m_defaultPageGroup->preferences().peerConnectionEnabled();
+    if ([defaults objectForKey:@"ExperimentalPeerConnectionEnabled"])
+        webRTCEnabled = [defaults boolForKey:@"ExperimentalPeerConnectionEnabled"];
+    
+    // FIXME: Remove this and related parameter when <rdar://problem/29448368> is fixed.
+    if (webRTCEnabled)
+        SandboxExtension::createHandleForGenericExtension("com.apple.webkit.microphone", parameters.audioCaptureExtensionHandle);
+#endif
 }
 
 void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationParameters& parameters)
index 074b831..f1e21a0 100644 (file)
@@ -72,7 +72,6 @@
 #include <WebCore/LinkHash.h>
 #include <WebCore/LogInitialization.h>
 #include <WebCore/ResourceRequest.h>
-#include <WebCore/RuntimeEnabledFeatures.h>
 #include <WebCore/SessionID.h>
 #include <WebCore/URLParser.h>
 #include <runtime/JSCInlines.h>
@@ -574,12 +573,6 @@ WebProcessProxy& WebProcessPool::createNewWebProcess()
     if (!parameters.mediaKeyStorageDirectory.isEmpty())
         SandboxExtension::createHandleWithoutResolvingPath(parameters.mediaKeyStorageDirectory, SandboxExtension::ReadWrite, parameters.mediaKeyStorageDirectoryExtensionHandle);
 
-#if ENABLE(MEDIA_STREAM)
-    // FIXME: Remove this and related parameter when <rdar://problem/29448368> is fixed.
-    if (RuntimeEnabledFeatures::sharedFeatures().mediaStreamEnabled())
-        SandboxExtension::createHandleForGenericExtension("com.apple.webkit.microphone", parameters.audioCaptureExtensionHandle);
-#endif
-    
     parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession;
 
     parameters.cacheModel = cacheModel();
@@ -798,12 +791,8 @@ Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API:
     } else if (pageConfiguration->relatedPage()) {
         // Sharing processes, e.g. when creating the page via window.open().
         process = &pageConfiguration->relatedPage()->process();
-    } else {
-#if ENABLE(MEDIA_STREAM)
-        RuntimeEnabledFeatures::sharedFeatures().setMediaStreamEnabled(pageConfiguration->preferences()->store().getBoolValueForKey(WebPreferencesKey::mediaStreamEnabledKey()));
-#endif
+    } else
         process = &createNewWebProcessRespectingProcessCountLimit();
-    }
 
     return process->createWebPage(pageClient, WTFMove(pageConfiguration));
 }