Bug 226086 - [Cocoa] GPU Process should recognize that pathForProcessContainer() might fail and handle it gracefully
Summary: [Cocoa] GPU Process should recognize that pathForProcessContainer() might fai...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-21 09:22 PDT by Brent Fulgham
Modified: 2021-05-21 14:08 PDT (History)
7 users (show)

See Also:


Attachments
Patch (5.50 KB, patch)
2021-05-21 09:48 PDT, Brent Fulgham
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (5.47 KB, patch)
2021-05-21 10:10 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2021-05-21 09:22:34 PDT
The various implementations of WebProcessPool::networkingCachesDirectory(), WebProcessPool::webContentCachesDirectory(), etc., recognize that a process might not be containerized (e.g., system daemons that use WebKit) and so have a clean fallback path for that case.

The GPU Process does not, and so can fail to get a clean cache directory resulting in file access errors and other problems.

We should use the same logic we do in WebContent.
Comment 1 Brent Fulgham 2021-05-21 09:30:47 PDT
<rdar://problem/78288016>
Comment 2 Brent Fulgham 2021-05-21 09:48:54 PDT
Created attachment 429298 [details]
Patch
Comment 3 Brent Fulgham 2021-05-21 10:10:58 PDT
Created attachment 429303 [details]
Patch
Comment 4 Brent Fulgham 2021-05-21 13:11:49 PDT
This patch is compiled out of Mac builds, so landing now that iOS tests are done.
Comment 5 EWS 2021-05-21 13:19:27 PDT
Committed r277879 (238017@main): <https://commits.webkit.org/238017@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429303 [details].
Comment 6 Darin Adler 2021-05-21 14:08:36 PDT
Comment on attachment 429303 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429303&action=review

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:200
>      String path = pathForProcessContainer();
>      if (path.isEmpty())
>          path = NSHomeDirectory();
>  
> -    path = path + "/Library/Cookies";
> +    path = path + subpath;
>      path = stringByResolvingSymlinksInPath(path);
>      return path;

Could improve performance by correctly using makeString.

> Source/WebKit/UIProcess/WebProcessPool.h:514
> +    static String cacheDirectoryInContainerOrHomeDirectory(const String& subpath);

This argument should be ASCIILiteral.