Title: [212451] trunk/Source/WebKit2
Revision
212451
Author
bfulg...@apple.com
Date
2017-02-16 11:40:43 -0800 (Thu, 16 Feb 2017)

Log Message

[WebRTC][Mac] Conditionally add sandbox extensions to the Network Process
https://bugs.webkit.org/show_bug.cgi?id=168010
<rdar://problem/30245503>

Reviewed by Youenn Fablet.

Conditionally add sandbox extensions to the Network Process when the WebRTC/Media Capture
features are enabled.

* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode): Serialize new process configuration flag.
(WebKit::NetworkProcessCreationParameters::decode): Ditto.
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/mac/NetworkProcessMac.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):  Remember state of WebRTC for when the
sandbox is established.
(WebKit::NetworkProcess::initializeSandbox): Add ENABLE_WEB_RTC parameter to sandbox launch state.
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Add conditional sandbox expansion to allow
bidirectional network access when the ENABLE_LIBWEBRTC flag is present in the sandbox launch parameters.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess): Use proper compile guards and check media stream
preference, rather than the peer connection preference.
(WebKit::WebProcessPool::platformInitializeNetworkProcess): Notify NetworkProcess at launch time whether the
user wants WebRTC support.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (212450 => 212451)


--- trunk/Source/WebKit2/ChangeLog	2017-02-16 19:23:50 UTC (rev 212450)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-16 19:40:43 UTC (rev 212451)
@@ -1,5 +1,33 @@
 2017-02-16  Brent Fulgham  <bfulg...@apple.com>
 
+        [WebRTC][Mac] Conditionally add sandbox extensions to the Network Process
+        https://bugs.webkit.org/show_bug.cgi?id=168010
+        <rdar://problem/30245503>
+
+        Reviewed by Youenn Fablet.
+
+        Conditionally add sandbox extensions to the Network Process when the WebRTC/Media Capture
+        features are enabled.
+
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode): Serialize new process configuration flag.
+        (WebKit::NetworkProcessCreationParameters::decode): Ditto.
+        * NetworkProcess/NetworkProcessCreationParameters.h:
+        * NetworkProcess/mac/NetworkProcessMac.mm:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcess):  Remember state of WebRTC for when the
+        sandbox is established.
+        (WebKit::NetworkProcess::initializeSandbox): Add ENABLE_WEB_RTC parameter to sandbox launch state.
+        * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in: Add conditional sandbox expansion to allow
+        bidirectional network access when the ENABLE_LIBWEBRTC flag is present in the sandbox launch parameters.
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess): Use proper compile guards and check media stream
+        preference, rather than the peer connection preference.
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess): Notify NetworkProcess at launch time whether the
+        user wants WebRTC support.
+
+2017-02-16  Brent Fulgham  <bfulg...@apple.com>
+
         [WebRTC][Mac][WebKit2] Initial WebProcess does not support WebRTC
         https://bugs.webkit.org/show_bug.cgi?id=168438
         <rdar://problem/30401818>

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (212450 => 212451)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2017-02-16 19:23:50 UTC (rev 212450)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2017-02-16 19:40:43 UTC (rev 212451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -215,6 +215,10 @@
     HashMap<uint64_t, Function<void ()>> m_sandboxExtensionForBlobsCompletionHandlers;
     HashMap<uint64_t, Ref<NetworkResourceLoader>> m_waitingNetworkResourceLoaders;
 
+#if ENABLE(WEB_RTC)
+    bool m_webRTCEnabled { false };
+#endif
+
 #if PLATFORM(COCOA)
     void platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters&);
     void setCookieStoragePartitioningEnabled(bool);

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp (212450 => 212451)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp	2017-02-16 19:23:50 UTC (rev 212450)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp	2017-02-16 19:40:43 UTC (rev 212451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -102,6 +102,9 @@
     encoder << recordReplayMode;
     encoder << recordReplayCacheLocation;
 #endif
+#if ENABLE(WEB_RTC)
+    encoder << webRTCEnabled;
+#endif
 }
 
 bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProcessCreationParameters& result)
@@ -205,6 +208,10 @@
     if (!decoder.decode(result.recordReplayCacheLocation))
         return false;
 #endif
+#if ENABLE(WEB_RTC)
+    if (!decoder.decode(result.webRTCEnabled))
+        return false;
+#endif
 
     return true;
 }

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h (212450 => 212451)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h	2017-02-16 19:23:50 UTC (rev 212450)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h	2017-02-16 19:40:43 UTC (rev 212451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -113,6 +113,10 @@
     String recordReplayMode;
     String recordReplayCacheLocation;
 #endif
+
+#if ENABLE(WEB_RTC)
+    bool webRTCEnabled { false };
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkProcessMac.mm (212450 => 212451)


--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkProcessMac.mm	2017-02-16 19:23:50 UTC (rev 212450)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkProcessMac.mm	2017-02-16 19:40:43 UTC (rev 212451)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -105,6 +105,10 @@
 
     if (!parameters.httpProxy.isNull() || !parameters.httpsProxy.isNull())
         overrideSystemProxies(parameters.httpProxy, parameters.httpsProxy);
+
+#if ENABLE(WEB_RTC)
+    m_webRTCEnabled = parameters.webRTCEnabled;
+#endif
 }
 
 void NetworkProcess::allowSpecificHTTPSCertificateForHost(const CertificateInfo& certificateInfo, const String& host)
@@ -118,6 +122,11 @@
     NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@"WKView")];
     sandboxParameters.setOverrideSandboxProfilePath([webkit2Bundle pathForResource:@"com.apple.WebKit.NetworkProcess" ofType:@"sb"]);
 
+#if ENABLE(WEB_RTC)
+    if (m_webRTCEnabled)
+        sandboxParameters.addParameter("ENABLE_WEB_RTC", "TRUE");
+#endif
+
     ChildProcess::initializeSandbox(parameters, sandboxParameters);
 }
 

Modified: trunk/Source/WebKit2/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in (212450 => 212451)


--- trunk/Source/WebKit2/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in	2017-02-16 19:23:50 UTC (rev 212450)
+++ trunk/Source/WebKit2/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in	2017-02-16 19:40:43 UTC (rev 212451)
@@ -1,4 +1,4 @@
-; Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+; Copyright (C) 2013-2017 Apple Inc. All rights reserved.
 ;
 ; Redistribution and use in source and binary forms, with or without
 ; modification, are permitted provided that the following conditions
@@ -208,3 +208,9 @@
     ;; FIXME: Should be removed after <rdar://problem/10463881> is fixed.
     (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2")
     (home-literal "/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2-journal"))
+
+#if ENABLE_WEB_RTC
+;; FIXME should be removed when <rdar://problem/30498072> is fixed.
+(if (positive? (string-length (param "ENABLE_WEB_RTC")))
+    (allow network*))
+#endif

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (212450 => 212451)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2017-02-16 19:23:50 UTC (rev 212450)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2017-02-16 19:40:43 UTC (rev 212451)
@@ -246,12 +246,12 @@
     parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
 #endif
 #if ENABLE(MEDIA_STREAM)
-    bool webRTCEnabled = m_defaultPageGroup->preferences().peerConnectionEnabled();
+    bool mediaStreamEnabled = m_defaultPageGroup->preferences().mediaStreamEnabled();
     if ([defaults objectForKey:@"ExperimentalPeerConnectionEnabled"])
-        webRTCEnabled = [defaults boolForKey:@"ExperimentalPeerConnectionEnabled"];
+        mediaStreamEnabled = [defaults boolForKey:@"ExperimentalPeerConnectionEnabled"];
     
     // FIXME: Remove this and related parameter when <rdar://problem/29448368> is fixed.
-    if (webRTCEnabled)
+    if (mediaStreamEnabled)
         SandboxExtension::createHandleForGenericExtension("com.apple.webkit.microphone", parameters.audioCaptureExtensionHandle);
 #endif
 }
@@ -304,6 +304,13 @@
     if (parameters.recordReplayCacheLocation.isEmpty())
         parameters.recordReplayCacheLocation = parameters.diskCacheDirectory;
 #endif
+#if ENABLE(WEB_RTC)
+    bool webRTCEnabled = m_defaultPageGroup->preferences().peerConnectionEnabled();
+    if ([defaults objectForKey:@"ExperimentalPeerConnectionEnabled"])
+        webRTCEnabled = [defaults boolForKey:@"ExperimentalPeerConnectionEnabled"];
+    
+    parameters.webRTCEnabled = webRTCEnabled;
+#endif
 }
 
 void WebProcessPool::platformInvalidateContext()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to