Bug 238402 - Don't create directories on iOS if we are only using ephemeral storages
Summary: Don't create directories on iOS if we are only using ephemeral storages
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-25 19:02 PDT by Alex Christensen
Modified: 2022-03-29 21:07 PDT (History)
4 users (show)

See Also:


Attachments
Patch (20.70 KB, patch)
2022-03-25 19:05 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (33.09 KB, patch)
2022-03-28 10:52 PDT, Alex Christensen
cdumez: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2022-03-25 19:02:24 PDT
Don't create directories on iOS if we are only using ephemeral storages
Comment 1 Alex Christensen 2022-03-25 19:05:21 PDT
Created attachment 455813 [details]
Patch
Comment 2 Chris Dumez 2022-03-26 13:55:13 PDT
Looks like iOS failures may be real?
Comment 3 Alex Christensen 2022-03-28 10:39:18 PDT
Comment on attachment 455813 [details]
Patch

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

> Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:334
> +    if (!process.sessionID().isEphemeral()) {

This was asserting because when we initialize the web process we don't always have a session ID yet.  I'm moving this to WebProcess::setWebsiteDataStoreParameters
Comment 4 Alex Christensen 2022-03-28 10:52:28 PDT
Created attachment 455929 [details]
Patch
Comment 5 Chris Dumez 2022-03-28 13:32:48 PDT
Comment on attachment 455929 [details]
Patch

r=me assuming the bots are happy.
Comment 6 Sihui Liu 2022-03-28 14:58:51 PDT
Comment on attachment 455929 [details]
Patch

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

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:290
> +        m_cookieStorageDirectory = resolveAndCreateReadWriteDirectoryForSandboxExtension(WebProcessPool::cookieStorageDirectory());

It's a bit weird that WebsiteDataStore asks WebProcessPool for directory. I
If we think the directory is per WebsiteDataStore, maybe we should move cookieStorageDirectory() to WebsiteDataStore? 
If we don't think it's per WebsiteDataStore, maybe we should not send it in WebsiteDataStoreParameters?

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1905
> +        if (String cookieStorageDirectory = WebProcessPool::cookieStorageDirectory(); !cookieStorageDirectory.isEmpty())

If we already call resolveDirectoriesIfNecessary() above, shouldn't we just check if (!m_cookieStorageDirectory.isEmpty())?
Comment 7 Alex Christensen 2022-03-29 12:30:27 PDT
This is indeed weird code that is quite old so I'm trying to minimize functional changes.  It is taking another step in its transition from process pool to data store.
Comment 8 Alex Christensen 2022-03-29 13:57:13 PDT
r292068
Comment 9 Alex Christensen 2022-03-29 13:57:51 PDT
(by the way, I agree with Sihui's cleanup suggestions and think they should be done, but not right now)
Comment 10 Radar WebKit Bug Importer 2022-03-29 21:06:35 PDT
<rdar://problem/91022750>
Comment 11 David Kilzer (:ddkilzer) 2022-03-29 21:07:15 PDT
<rdar://problem/79639418>