We use WKCopyFoundationCacheDirectory() to pass NSURL_CACHE_DIR parameter to PluginProcess sandbox. But calling WKCopyFoundationCacheDirectory() implicitly instantiates a shared cache, which is then created on disk on a secondary thread. Our code then uses setenv to change DIRHELPER_USER_DIR_SUFFIX, and CFNetwork uses getenv, which results in a crash if timing is right. We really shouldn't be creating a cache just to find out what its path will be. <rdar://problem/14165329>
Created attachment 228666 [details] proposed fix As a side effect, this will change plug-in NSURL cache location from ~/Library/Caches/com.apple.PluginProcess to /var/folders/blah/blah/C/com.apple.PluginProcess for most users. CFNetwork uses complicated logic to fall back to the latter if the former isn't appropriate (namely, for network home directory users). It doesn't make much sense to try replicating this logic, as we can just always use the latter directory that works for everyone. CFNetwork behavior is of course subject to change, so trying to approximate it is futile. Perhaps we should have separate caches for different plug-ins (or even separate them by UI process bundle identifier too), but this patch doesn't change this aspect of the behavior.
Comment on attachment 228666 [details] proposed fix Clearing flags on attachment: 228666 Committed r166845: <http://trac.webkit.org/changeset/166845>
All reviewed patches have been landed. Closing bug.