[WK2][macOS][iOS] Don't request microphone access for clients that don't need it.
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jun 2017 04:04:37 +0000 (04:04 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Jun 2017 04:04:37 +0000 (04:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173948
<rdar://problem/32103275>

Reviewed by Eric Carlson.

Don't bother requesting a sandbox extension to access the microphone for any clients
on the Cocoa platform that are not Safari. Other clients don't have the necessary
system entitlements, and always fail leading to annoying SandboxViolation reports.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):

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

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

index ecfc6ca..e88860e 100644 (file)
@@ -1,3 +1,18 @@
+2017-06-28  Brent Fulgham  <bfulgham@apple.com>
+
+        [WK2][macOS][iOS] Don't request microphone access for clients that don't need it.
+        https://bugs.webkit.org/show_bug.cgi?id=173948
+        <rdar://problem/32103275>
+
+        Reviewed by Eric Carlson.
+
+        Don't bother requesting a sandbox extension to access the microphone for any clients
+        on the Cocoa platform that are not Safari. Other clients don't have the necessary
+        system entitlements, and always fail leading to annoying SandboxViolation reports.
+
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess): 
+
 2017-06-29  Zalan Bujtas  <zalan@apple.com>
 
         Move RenderEmbeddedObject::isReplacementObscured to HTMLPlugInElement
index 05bf8d0..7064159 100644 (file)
@@ -251,9 +251,18 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
     bool webRTCEnabled = m_defaultPageGroup->preferences().peerConnectionEnabled();
     if ([defaults objectForKey:@"ExperimentalPeerConnectionEnabled"])
         webRTCEnabled = [defaults boolForKey:@"ExperimentalPeerConnectionEnabled"];
-    
+
+    bool isSafari = false;
+#if PLATFORM(IOS)
+    if (WebCore::IOSApplication::isMobileSafari())
+        isSafari = true;
+#elif PLATFORM(MAC)
+    if (WebCore::MacApplication::isSafari())
+        isSafari = true;
+#endif
+
     // FIXME: Remove this and related parameter when <rdar://problem/29448368> is fixed.
-    if (!parameters.shouldCaptureAudioInUIProcess && (mediaDevicesEnabled || webRTCEnabled))
+    if (isSafari && !parameters.shouldCaptureAudioInUIProcess && mediaDevicesEnabled)
         SandboxExtension::createHandleForGenericExtension("com.apple.webkit.microphone", parameters.audioCaptureExtensionHandle);
 #endif
 }