<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183209] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183209">183209</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2015-04-23 14:14:56 -0700 (Thu, 23 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] WebKit services should inherit environment variables for home
https://bugs.webkit.org/show_bug.cgi?id=144078
rdar://problem/20571678

Reviewed by Dan Bernstein.

Source/WebCore:

Added an SPI header for a drive-by fix.

* WebCore.xcodeproj/project.pbxproj:
* platform/spi/cf/CFBundleSPI.h: Added.

Source/WebKit2:

Pass current environment variables as XPC bootstrap. Also while at it, made
_CFBundleSetupXPCBootstrap not soft linked.

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
(main):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService):

Source/WTF:

* wtf/spi/darwin/XPCSPI.h: Added xpc_copy_bootstrap and xpc_dictionary_apply.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfspidarwinXPCSPIh">trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainmm">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessLaunchermacProcessLauncherMacmm">trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformspicfCFBundleSPIh">trunk/Source/WebCore/platform/spi/cf/CFBundleSPI.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (183208 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-04-23 21:03:46 UTC (rev 183208)
+++ trunk/Source/WTF/ChangeLog        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -1,5 +1,15 @@
</span><span class="cx"> 2015-04-23  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [iOS] WebKit services should inherit environment variables for home
+        https://bugs.webkit.org/show_bug.cgi?id=144078
+        rdar://problem/20571678
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/spi/darwin/XPCSPI.h: Added xpc_copy_bootstrap and xpc_dictionary_apply.
+
+2015-04-23  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
</ins><span class="cx">         Undo the WTF part of the previous build fix, we don't use private headers in WTF.
</span><span class="cx"> 
</span><span class="cx">         * WTF.xcodeproj/project.pbxproj:
</span></span></pre></div>
<a id="trunkSourceWTFwtfspidarwinXPCSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h (183208 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h        2015-04-23 21:03:46 UTC (rev 183208)
+++ trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if COMPILER_SUPPORTS(BLOCKS)
</span><span class="cx"> typedef bool (^xpc_array_applier_t)(size_t index, xpc_object_t);
</span><ins>+typedef bool (^xpc_dictionary_applier_t)(const char *key, xpc_object_t value);
</ins><span class="cx"> typedef void (^xpc_handler_t)(xpc_object_t);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -98,6 +99,7 @@
</span><span class="cx"> EXTERN_C xpc_object_t xpc_array_create(const xpc_object_t*, size_t count);
</span><span class="cx"> #if COMPILER_SUPPORTS(BLOCKS)
</span><span class="cx"> EXTERN_C bool xpc_array_apply(xpc_object_t, xpc_array_applier_t);
</span><ins>+EXTERN_C bool xpc_dictionary_apply(xpc_object_t xdict, xpc_dictionary_applier_t applier);
</ins><span class="cx"> #endif
</span><span class="cx"> EXTERN_C size_t xpc_array_get_count(xpc_object_t);
</span><span class="cx"> EXTERN_C const char* xpc_array_get_string(xpc_object_t, size_t index);
</span><span class="lines">@@ -142,6 +144,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="cx"> EXTERN_C void xpc_connection_set_bootstrap(xpc_connection_t, xpc_object_t bootstrap);
</span><ins>+EXTERN_C xpc_object_t xpc_copy_bootstrap(void);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if !defined(xpc_retain) &amp;&amp; OS_OBJECT_USE_OBJC_RETAIN_RELEASE
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183208 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-23 21:03:46 UTC (rev 183208)
+++ trunk/Source/WebCore/ChangeLog        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-04-22  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [iOS] WebKit services should inherit environment variables for home
+        https://bugs.webkit.org/show_bug.cgi?id=144078
+        rdar://problem/20571678
+
+        Reviewed by Dan Bernstein.
+
+        Added an SPI header for a drive-by fix.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/spi/cf/CFBundleSPI.h: Added.
+
</ins><span class="cx"> 2015-04-23  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Use less memory when compiling content extensions.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (183208 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-04-23 21:03:46 UTC (rev 183208)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -5998,6 +5998,7 @@
</span><span class="cx">                 E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */; };
</span><span class="cx">                 E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */; };
</span><span class="cx">                 E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E107400C0E77BDC00033AF24 /* JSMessageChannel.h */; };
</span><ins>+                E10A39E21AE84E7100A29AE3 /* CFBundleSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E10A39E11AE84E7100A29AE3 /* CFBundleSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 E10B937C0B73C00A003ED890 /* JSCustomXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */; };
</span><span class="cx">                 E10B93C30B73C291003ED890 /* JSCustomXPathNSResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */; };
</span><span class="cx">                 E10B9B6C0B747599003ED890 /* NativeXPathNSResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E10B9B6A0B747599003ED890 /* NativeXPathNSResolver.h */; };
</span><span class="lines">@@ -13604,6 +13605,7 @@
</span><span class="cx">                 E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSource.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannel.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E107400C0E77BDC00033AF24 /* JSMessageChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannel.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E10A39E11AE84E7100A29AE3 /* CFBundleSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFBundleSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomXPathNSResolver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomXPathNSResolver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E10B9B6A0B747599003ED890 /* NativeXPathNSResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeXPathNSResolver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16491,6 +16493,7 @@
</span><span class="cx">                 65086DA619AC1719009AF46B /* cf */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                E10A39E11AE84E7100A29AE3 /* CFBundleSPI.h */,
</ins><span class="cx">                                 65086DA719AC1719009AF46B /* CFLocaleSPI.h */,
</span><span class="cx">                                 CE8245EF19B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h */,
</span><span class="cx">                                 CE12525A1A1C018200864480 /* CFNetworkSPI.h */,
</span><span class="lines">@@ -27155,6 +27158,7 @@
</span><span class="cx">                                 2E4346510F546A8200B0F1BA /* WorkerObjectProxy.h in Headers */,
</span><span class="cx">                                 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */,
</span><span class="cx">                                 2E4346530F546A8200B0F1BA /* WorkerRunLoop.h in Headers */,
</span><ins>+                                E10A39E21AE84E7100A29AE3 /* CFBundleSPI.h in Headers */,
</ins><span class="cx">                                 F3820899147D35F90010BC06 /* WorkerRuntimeAgent.h in Headers */,
</span><span class="cx">                                 E1A643F20EC0972500779668 /* WorkerScriptController.h in Headers */,
</span><span class="cx">                                 F34742E91343635000531BC2 /* WorkerScriptDebugServer.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspicfCFBundleSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/spi/cf/CFBundleSPI.h (0 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/cf/CFBundleSPI.h                                (rev 0)
+++ trunk/Source/WebCore/platform/spi/cf/CFBundleSPI.h        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef CFBundleSPI_h
+#define CFBundleSPI_h
+
+#include &lt;CoreFoundation/CoreFoundation.h&gt;
+
+#if USE(APPLE_INTERNAL_SDK)
+#import &lt;CoreFoundation/CFPriv.h&gt;
+#else
+#include &lt;wtf/spi/darwin/XPCSPI.h&gt;
+#endif
+
+extern &quot;C&quot; {
+void _CFBundleSetupXPCBootstrap(xpc_object_t bootstrap);
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (183208 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-04-23 21:03:46 UTC (rev 183208)
+++ trunk/Source/WebKit2/ChangeLog        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-04-22  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [iOS] WebKit services should inherit environment variables for home
+        https://bugs.webkit.org/show_bug.cgi?id=144078
+        rdar://problem/20571678
+
+        Reviewed by Dan Bernstein.
+
+        Pass current environment variables as XPC bootstrap. Also while at it, made
+        _CFBundleSetupXPCBootstrap not soft linked.
+
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
+        (main):
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::connectToService):
+
</ins><span class="cx"> 2015-04-23  Enrica Casucci  &lt;enrica@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support share button.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm (183208 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm        2015-04-23 21:03:46 UTC (rev 183208)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -77,6 +77,15 @@
</span><span class="cx"> 
</span><span class="cx"> int main(int argc, char** argv)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    auto bootstrap = adoptOSObject(xpc_copy_bootstrap());
+    auto containerEnvironmentVariables = xpc_dictionary_get_value(bootstrap.get(), &quot;ContainerEnvironmentVariables&quot;);
+    xpc_dictionary_apply(containerEnvironmentVariables, ^(const char *key, xpc_object_t value) {
+        setenv(key, xpc_string_get_string_ptr(value), 1);
+        return true;
+    });
+#endif
+
</ins><span class="cx">     xpc_main(XPCServiceEventHandler);
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessLaunchermacProcessLauncherMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (183208 => 183209)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm        2015-04-23 21:03:46 UTC (rev 183208)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm        2015-04-23 21:14:56 UTC (rev 183209)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;DynamicLinkerEnvironmentExtractor.h&quot;
</span><span class="cx"> #import &quot;EnvironmentVariables.h&quot;
</span><ins>+#import &lt;WebCore/CFBundleSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/ServersSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/SoftLinking.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreNSStringExtras.h&gt;
</span><span class="lines">@@ -45,12 +46,6 @@
</span><span class="cx"> #import &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
-// FIXME: Soft linking is temporary, make this into a regular function call once this function is available everywhere we need.
-SOFT_LINK_FRAMEWORK(CoreFoundation)
-SOFT_LINK_OPTIONAL(CoreFoundation, _CFBundleSetupXPCBootstrap, void, unused, (xpc_object_t))
-#endif
-
</del><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> namespace {
</span><span class="lines">@@ -222,12 +217,21 @@
</span><span class="cx">     // 1. When the application and system frameworks simply have different localized resources available, we should match the application.
</span><span class="cx">     // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks.
</span><span class="cx">     // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes.
</span><del>-    if (_CFBundleSetupXPCBootstrapPtr()) {
-        auto initializationMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
-        _CFBundleSetupXPCBootstrapPtr()(initializationMessage.get());
-        xpc_connection_set_bootstrap(connection.get(), initializationMessage.get());
-    }
</del><ins>+    auto initializationMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
+    _CFBundleSetupXPCBootstrap(initializationMessage.get());
+#if PLATFORM(IOS)
+    // Clients that set these environment variables explicitly do not have the values automatically forwarded by libxpc.
+    auto containerEnvironmentVariables = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
+    if (const char* environmentHOME = getenv(&quot;HOME&quot;))
+        xpc_dictionary_set_string(containerEnvironmentVariables.get(), &quot;HOME&quot;, environmentHOME);
+    if (const char* environmentCFFIXED_USER_HOME = getenv(&quot;CFFIXED_USER_HOME&quot;))
+        xpc_dictionary_set_string(containerEnvironmentVariables.get(), &quot;CFFIXED_USER_HOME&quot;, environmentCFFIXED_USER_HOME);
+    if (const char* environmentTMPDIR = getenv(&quot;TMPDIR&quot;))
+        xpc_dictionary_set_string(containerEnvironmentVariables.get(), &quot;TMPDIR&quot;, environmentTMPDIR);
+    xpc_dictionary_set_value(initializationMessage.get(), &quot;ContainerEnvironmentVariables&quot;, containerEnvironmentVariables.get());
</ins><span class="cx"> #endif
</span><ins>+    xpc_connection_set_bootstrap(connection.get(), initializationMessage.get());
+#endif
</ins><span class="cx"> 
</span><span class="cx">     // XPC requires having an event handler, even if it is not used.
</span><span class="cx">     xpc_connection_set_event_handler(connection.get(), ^(xpc_object_t event) { });
</span></span></pre>
</div>
</div>

</body>
</html>