<!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>[190257] trunk</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/190257">190257</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2015-09-25 15:36:09 -0700 (Fri, 25 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] Media tests start to time out after a few days of bot uptime
https://bugs.webkit.org/show_bug.cgi?id=149468

Reviewed by Darin Adler.

Source/WebKit2:

Make the fix work with WebKit2, and avoid touching user's media cache for WebKit1.

When UI process is not sandboxed, inherit DIRHELPER_USER_DIR_SUFFIX from it.
This means that during testing, WebContent uses a temporary directory of the form
/private/var/folders/.../T/WebKitTestRunner-VKjmz0/com.apple.WebKit.WebContent.Development,
instead of /private/var/folders/.../T/com.apple.WebKit.WebContent.Development+WebKitTestRunner.

WebKit1 now also better respects a temporary directory of the form
/private/var/folders/.../T/DumpRenderTree-VKjmz0, instead of the default, which
makes CoreMedia put its cache inside it.

As a result, almost everything is isolated per testing process, and deleted at the end.
Same with cache directories. The only outliers that I know of are plug-in directories,
which are per-process, but are not under the testing root, and thus aren't deleted.

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::initializeSandbox):
* Shared/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::fromConnection):
(WebKit::ChildProcessProxy::getLaunchOptions):
(WebKit::ChildProcessProxy::connect):
* Shared/ChildProcessProxy.h:
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
* Shared/SandboxInitializationParameters.h:
(WebKit::SandboxInitializationParameters::sandboxProfile):
(WebKit::SandboxInitializationParameters::setUserDirectorySuffix):
(WebKit::SandboxInitializationParameters::userDirectorySuffix):
(WebKit::SandboxInitializationParameters::setSystemDirectorySuffix): Deleted.
(WebKit::SandboxInitializationParameters::systemDirectorySuffix): Deleted.
* Shared/ios/ChildProcessIOS.mm:
(WebKit::ChildProcess::initializeSandbox):
* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::initializeSandbox):
* UIProcess/Databases/DatabaseProcessProxy.cpp:
(WebKit::DatabaseProcessProxy::getLaunchOptions):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getLaunchOptions):
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::getLaunchOptions):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getLaunchOptions):

Tools:

Delete cache directory in addition to the temporary one. Don't delete /private/tmp/MediaCache,
as it's not longer used by tests. Set TMPDIR and DIRHELPER_USER_DIR_SUFFIX to make
all temporary and cache files go to a custom location.

* Scripts/webkitpy/port/base.py:
* Scripts/webkitpy/port/driver.py:
* Scripts/webkitpy/port/mac.py:
* Scripts/webkitpy/port/win.py:
(WinPort._driver_tempdir_for_environment): Deleted unused function.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessmacPluginProcessMacmm">trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedChildProcessProxycpp">trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedChildProcessProxyh">trunk/Source/WebKit2/Shared/ChildProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceEntryPointmm">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedSandboxInitializationParametersh">trunk/Source/WebKit2/Shared/SandboxInitializationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2SharediosChildProcessIOSmm">trunk/Source/WebKit2/Shared/ios/ChildProcessIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedmacChildProcessMacmm">trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxycpp">trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPluginsPluginProcessProxycpp">trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessProxycpp">trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyportbasepy">trunk/Tools/Scripts/webkitpy/port/base.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdriverpy">trunk/Tools/Scripts/webkitpy/port/driver.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportmacpy">trunk/Tools/Scripts/webkitpy/port/mac.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportwinpy">trunk/Tools/Scripts/webkitpy/port/win.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/ChangeLog        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2015-09-25  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] Media tests start to time out after a few days of bot uptime
+        https://bugs.webkit.org/show_bug.cgi?id=149468
+
+        Reviewed by Darin Adler.
+
+        Make the fix work with WebKit2, and avoid touching user's media cache for WebKit1.
+
+        When UI process is not sandboxed, inherit DIRHELPER_USER_DIR_SUFFIX from it.
+        This means that during testing, WebContent uses a temporary directory of the form
+        /private/var/folders/.../T/WebKitTestRunner-VKjmz0/com.apple.WebKit.WebContent.Development,
+        instead of /private/var/folders/.../T/com.apple.WebKit.WebContent.Development+WebKitTestRunner.
+
+        WebKit1 now also better respects a temporary directory of the form
+        /private/var/folders/.../T/DumpRenderTree-VKjmz0, instead of the default, which
+        makes CoreMedia put its cache inside it.
+
+        As a result, almost everything is isolated per testing process, and deleted at the end.
+        Same with cache directories. The only outliers that I know of are plug-in directories,
+        which are per-process, but are not under the testing root, and thus aren't deleted.
+
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::PluginProcess::initializeSandbox):
+        * Shared/ChildProcessProxy.cpp:
+        (WebKit::ChildProcessProxy::fromConnection):
+        (WebKit::ChildProcessProxy::getLaunchOptions):
+        (WebKit::ChildProcessProxy::connect):
+        * Shared/ChildProcessProxy.h:
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
+        (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
+        * Shared/SandboxInitializationParameters.h:
+        (WebKit::SandboxInitializationParameters::sandboxProfile):
+        (WebKit::SandboxInitializationParameters::setUserDirectorySuffix):
+        (WebKit::SandboxInitializationParameters::userDirectorySuffix):
+        (WebKit::SandboxInitializationParameters::setSystemDirectorySuffix): Deleted.
+        (WebKit::SandboxInitializationParameters::systemDirectorySuffix): Deleted.
+        * Shared/ios/ChildProcessIOS.mm:
+        (WebKit::ChildProcess::initializeSandbox):
+        * Shared/mac/ChildProcessMac.mm:
+        (WebKit::ChildProcess::initializeSandbox):
+        * UIProcess/Databases/DatabaseProcessProxy.cpp:
+        (WebKit::DatabaseProcessProxy::getLaunchOptions):
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::getLaunchOptions):
+        * UIProcess/Plugins/PluginProcessProxy.cpp:
+        (WebKit::PluginProcessProxy::getLaunchOptions):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::getLaunchOptions):
+
</ins><span class="cx"> 2015-09-25  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Clicking on a data detected item inside a form control always pops up a map 
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessmacPluginProcessMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -508,7 +508,7 @@
</span><span class="cx">         exit(EX_OSERR);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    sandboxParameters.setSystemDirectorySuffix([[[[NSFileManager defaultManager] stringWithFileSystemRepresentation:temporaryDirectory length:strlen(temporaryDirectory)] lastPathComponent] fileSystemRepresentation]);
</del><ins>+    sandboxParameters.setUserDirectorySuffix([[[[NSFileManager defaultManager] stringWithFileSystemRepresentation:temporaryDirectory length:strlen(temporaryDirectory)] lastPathComponent] fileSystemRepresentation]);
</ins><span class="cx"> 
</span><span class="cx">     sandboxParameters.addPathParameter(&quot;PLUGIN_PATH&quot;, m_pluginPath);
</span><span class="cx">     sandboxParameters.addPathParameter(&quot;NSURL_CACHE_DIR&quot;, m_nsurlCacheDirectory);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedChildProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/Shared/ChildProcessProxy.cpp        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -56,6 +56,12 @@
</span><span class="cx">     return childProcessProxy;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ChildProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions&amp; launchOptions)
+{
+    if (const char* userDirectorySuffix = getenv(&quot;DIRHELPER_USER_DIR_SUFFIX&quot;))
+        launchOptions.extraInitializationData.add(ASCIILiteral(&quot;user-directory-suffix&quot;), userDirectorySuffix);
+}
+
</ins><span class="cx"> void ChildProcessProxy::connect()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_processLauncher);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedChildProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ChildProcessProxy.h (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ChildProcessProxy.h        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/Shared/ChildProcessProxy.h        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -82,8 +82,9 @@
</span><span class="cx">     bool dispatchMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;);
</span><span class="cx">     bool dispatchSyncMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;, std::unique_ptr&lt;IPC::MessageEncoder&gt;&amp;);
</span><span class="cx">     
</span><ins>+    virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&amp;);
+
</ins><span class="cx"> private:
</span><del>-    virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&amp;) = 0;
</del><span class="cx">     virtual void connectionWillOpen(IPC::Connection&amp;);
</span><span class="cx">     virtual void processWillShutDown(IPC::Connection&amp;) = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceEntryPointmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -97,6 +97,12 @@
</span><span class="cx">     if (!inspectorProcess.isEmpty())
</span><span class="cx">         extraInitializationData.add(ASCIILiteral(&quot;inspector-process&quot;), inspectorProcess);
</span><span class="cx"> 
</span><ins>+    if (!isClientSandboxed()) {
+        String userDirectorySuffix = xpc_dictionary_get_string(extraDataInitializationDataObject, &quot;user-directory-suffix&quot;);
+        if (!userDirectorySuffix.isEmpty())
+            extraInitializationData.add(ASCIILiteral(&quot;user-directory-suffix&quot;), userDirectorySuffix);
+    }
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedSandboxInitializationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/SandboxInitializationParameters.h (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/SandboxInitializationParameters.h        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/Shared/SandboxInitializationParameters.h        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -86,8 +86,8 @@
</span><span class="cx">         return m_overrideSandboxProfilePathOrSandboxProfile;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void setSystemDirectorySuffix(const String&amp; suffix) { m_systemDirectorySuffix = suffix; }
-    const String&amp; systemDirectorySuffix() const { return m_systemDirectorySuffix; }
</del><ins>+    void setUserDirectorySuffix(const String&amp; suffix) { m_userDirectorySuffix = suffix; }
+    const String&amp; userDirectorySuffix() const { return m_userDirectorySuffix; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">     void appendPathInternal(const char* name, const char* path);
</span><span class="cx"> 
</span><span class="cx">     mutable Vector&lt;const char*&gt; m_namedParameters;
</span><del>-    String m_systemDirectorySuffix;
</del><ins>+    String m_userDirectorySuffix;
</ins><span class="cx"> 
</span><span class="cx">     ProfileSelectionMode m_profileSelectionMode;
</span><span class="cx">     String m_overrideSandboxProfilePathOrSandboxProfile;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharediosChildProcessIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ios/ChildProcessIOS.mm (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ios/ChildProcessIOS.mm        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/Shared/ios/ChildProcessIOS.mm        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -73,9 +73,9 @@
</span><span class="cx"> #if ENABLE(MANUAL_SANDBOXING)
</span><span class="cx">     NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@&quot;WKWebView&quot;)];
</span><span class="cx">     String defaultProfilePath = [webkit2Bundle pathForResource:[[NSBundle mainBundle] bundleIdentifier] ofType:@&quot;sb&quot;];
</span><del>-    if (sandboxParameters.systemDirectorySuffix().isNull()) {
-        String defaultSystemDirectorySuffix = String([[NSBundle mainBundle] bundleIdentifier]) + &quot;+&quot; + parameters.clientIdentifier;
-        sandboxParameters.setSystemDirectorySuffix(defaultSystemDirectorySuffix);
</del><ins>+    if (sandboxParameters.userDirectorySuffix().isNull()) {
+        String defaultUserDirectorySuffix = makeString(String([[NSBundle mainBundle] bundleIdentifier]), '+', parameters.clientIdentifier);
+        sandboxParameters.setUserDirectorySuffix(defaultUserDirectorySuffix);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     String sandboxImportPath = &quot;/usr/local/share/sandbox/imports&quot;;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacChildProcessMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -90,9 +90,14 @@
</span><span class="cx">     NSBundle *webkit2Bundle = [NSBundle bundleForClass:NSClassFromString(@&quot;WKView&quot;)];
</span><span class="cx">     String defaultProfilePath = [webkit2Bundle pathForResource:[[NSBundle mainBundle] bundleIdentifier] ofType:@&quot;sb&quot;];
</span><span class="cx"> 
</span><del>-    if (sandboxParameters.systemDirectorySuffix().isNull()) {
-        String defaultSystemDirectorySuffix = String([[NSBundle mainBundle] bundleIdentifier]) + &quot;+&quot; + parameters.clientIdentifier;
-        sandboxParameters.setSystemDirectorySuffix(defaultSystemDirectorySuffix);
</del><ins>+    if (sandboxParameters.userDirectorySuffix().isNull()) {
+        auto userDirectorySuffix = parameters.extraInitializationData.find(&quot;user-directory-suffix&quot;);
+        if (userDirectorySuffix != parameters.extraInitializationData.end())
+            sandboxParameters.setUserDirectorySuffix([makeString(userDirectorySuffix-&gt;value, '/', String([[NSBundle mainBundle] bundleIdentifier])) fileSystemRepresentation]);
+        else {
+            String defaultUserDirectorySuffix = makeString(String([[NSBundle mainBundle] bundleIdentifier]), '+', parameters.clientIdentifier);
+            sandboxParameters.setUserDirectorySuffix(defaultUserDirectorySuffix);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;String&gt; osVersionParts;
</span><span class="lines">@@ -106,7 +111,7 @@
</span><span class="cx">     sandboxParameters.addParameter(&quot;_OS_VERSION&quot;, osVersion.utf8().data());
</span><span class="cx"> 
</span><span class="cx">     // Use private temporary and cache directories.
</span><del>-    setenv(&quot;DIRHELPER_USER_DIR_SUFFIX&quot;, fileSystemRepresentation(sandboxParameters.systemDirectorySuffix()).data(), 0);
</del><ins>+    setenv(&quot;DIRHELPER_USER_DIR_SUFFIX&quot;, fileSystemRepresentation(sandboxParameters.userDirectorySuffix()).data(), 1);
</ins><span class="cx">     char temporaryDirectory[PATH_MAX];
</span><span class="cx">     if (!confstr(_CS_DARWIN_USER_TEMP_DIR, temporaryDirectory, sizeof(temporaryDirectory))) {
</span><span class="cx">         WTFLogAlways(&quot;%s: couldn't retrieve private temporary directory path: %d\n&quot;, getprogname(), errno);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessDatabasesDatabaseProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> void DatabaseProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions&amp; launchOptions)
</span><span class="cx"> {
</span><span class="cx">     launchOptions.processType = ProcessLauncher::DatabaseProcess;
</span><ins>+    ChildProcessProxy::getLaunchOptions(launchOptions);
</ins><span class="cx">     platformGetLaunchOptions(launchOptions);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions&amp; launchOptions)
</span><span class="cx"> {
</span><span class="cx">     launchOptions.processType = ProcessLauncher::NetworkProcess;
</span><ins>+    ChildProcessProxy::getLaunchOptions(launchOptions);
</ins><span class="cx">     platformGetLaunchOptions(launchOptions);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPluginsPluginProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx"> void PluginProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions&amp; launchOptions)
</span><span class="cx"> {
</span><span class="cx">     launchOptions.processType = ProcessLauncher::PluginProcess;
</span><ins>+    ChildProcessProxy::getLaunchOptions(launchOptions);
</ins><span class="cx">     platformGetLaunchOptions(launchOptions, m_pluginProcessAttributes);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -130,6 +130,8 @@
</span><span class="cx"> {
</span><span class="cx">     launchOptions.processType = ProcessLauncher::WebProcess;
</span><span class="cx"> 
</span><ins>+    ChildProcessProxy::getLaunchOptions(launchOptions);
+
</ins><span class="cx">     if (WebInspectorProxy::isInspectorProcessPool(m_processPool))
</span><span class="cx">         launchOptions.extraInitializationData.add(ASCIILiteral(&quot;inspector-process&quot;), ASCIILiteral(&quot;1&quot;));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Tools/ChangeLog        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2015-09-25  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] Media tests start to time out after a few days of bot uptime
+        https://bugs.webkit.org/show_bug.cgi?id=149468
+
+        Reviewed by Darin Adler.
+
+        Delete cache directory in addition to the temporary one. Don't delete /private/tmp/MediaCache,
+        as it's not longer used by tests. Set TMPDIR and DIRHELPER_USER_DIR_SUFFIX to make
+        all temporary and cache files go to a custom location.
+
+        * Scripts/webkitpy/port/base.py:
+        * Scripts/webkitpy/port/driver.py:
+        * Scripts/webkitpy/port/mac.py:
+        * Scripts/webkitpy/port/win.py:
+        (WinPort._driver_tempdir_for_environment): Deleted unused function.
+
</ins><span class="cx"> 2015-09-25  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Removed MiniBrowser.entitlements.
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportbasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/base.py (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/base.py        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Tools/Scripts/webkitpy/port/base.py        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -1154,8 +1154,8 @@
</span><span class="cx">     def _driver_tempdir(self):
</span><span class="cx">         return self._filesystem.mkdtemp(prefix='%s-' % self.driver_name())
</span><span class="cx"> 
</span><del>-    def _driver_tempdir_for_environment(self):
-        return self._driver_tempdir()
</del><ins>+    def remove_cache_directory(self, name):
+        pass
</ins><span class="cx"> 
</span><span class="cx">     def _path_to_webcore_library(self):
</span><span class="cx">         &quot;&quot;&quot;Returns the full path to a built copy of WebCore.&quot;&quot;&quot;
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver.py        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -313,10 +313,11 @@
</span><span class="cx">     def _setup_environ_for_driver(self, environment):
</span><span class="cx">         environment['DYLD_LIBRARY_PATH'] = self._port._build_path()
</span><span class="cx">         environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path()
</span><del>-        # FIXME: We're assuming that WebKitTestRunner checks this DumpRenderTree-named environment variable.
-        # FIXME: Commented out for now to avoid tests breaking. Re-enable after
-        # we cut over to NRWT
-        #environment['DUMPRENDERTREE_TEMP'] = str(self._port._driver_tempdir_for_environment())
</del><ins>+        # Use an isolated temp directory that can be deleted after testing (especially important on Mac, as
+        # CoreMedia disk cache is in the temp directory).
+        environment['TMPDIR'] = str(self._driver_tempdir)
+        environment['DIRHELPER_USER_DIR_SUFFIX'] = os.path.basename(str(self._driver_tempdir))
+        # Put certain normally persistent files into the temp directory (e.g. IndexedDB storage).
</ins><span class="cx">         environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
</span><span class="cx">         environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
</span><span class="cx">         environment['ASAN_OPTIONS'] = &quot;allocator_may_return_null=1&quot;
</span><span class="lines">@@ -358,6 +359,7 @@
</span><span class="cx"> 
</span><span class="cx">         if self._driver_tempdir:
</span><span class="cx">             self._port._filesystem.rmtree(str(self._driver_tempdir))
</span><ins>+            self._port.remove_cache_directory(os.path.basename(str(self._driver_tempdir)))
</ins><span class="cx">             self._driver_tempdir = None
</span><span class="cx"> 
</span><span class="cx">     def cmd_line(self, pixel_tests, per_test_args):
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportmacpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/mac.py (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/mac.py        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Tools/Scripts/webkitpy/port/mac.py        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -108,12 +108,14 @@
</span><span class="cx">         return env
</span><span class="cx"> 
</span><span class="cx">     def _clear_global_caches_and_temporary_files(self):
</span><del>-        self._filesystem.rmtree('/private/tmp/MediaCache')
</del><span class="cx">         self._filesystem.rmtree(os.path.expanduser('~/Library/' + self.driver_name()))
</span><span class="cx">         self._filesystem.rmtree(os.path.expanduser('~/Library/Application Support/' + self.driver_name()))
</span><span class="cx">         self._filesystem.rmtree(os.path.expanduser('~/Library/Caches/' + self.driver_name()))
</span><span class="cx">         self._filesystem.rmtree(os.path.expanduser('~/Library/WebKit/' + self.driver_name()))
</span><span class="cx"> 
</span><ins>+    def remove_cache_directory(self, name):
+        self._filesystem.rmtree(os.confstr(65538) + name)
+
</ins><span class="cx">     def operating_system(self):
</span><span class="cx">         return 'mac'
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportwinpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/win.py (190256 => 190257)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/win.py        2015-09-25 22:06:09 UTC (rev 190256)
+++ trunk/Tools/Scripts/webkitpy/port/win.py        2015-09-25 22:36:09 UTC (rev 190257)
</span><span class="lines">@@ -138,9 +138,6 @@
</span><span class="cx">     def _path_to_lighttpd_php(self):
</span><span class="cx">         return &quot;/usr/bin/php-cgi&quot;
</span><span class="cx"> 
</span><del>-    def _driver_tempdir_for_environment(self):
-        return cygpath(self._driver_tempdir())
-
</del><span class="cx">     def test_search_path(self):
</span><span class="cx">         test_fallback_names = [path for path in self.baseline_search_path() if not path.startswith(self._webkit_baseline_path('mac'))]
</span><span class="cx">         return map(self._webkit_baseline_path, test_fallback_names)
</span></span></pre>
</div>
</div>

</body>
</html>