Bug 194075 - [SOUP] Move cookiePersistentStoragePath and cookiePersistentStorageType from NetworkProcess to NetworkSession
Summary: [SOUP] Move cookiePersistentStoragePath and cookiePersistentStorageType from ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on: 194209
Blocks:
  Show dependency treegraph
 
Reported: 2019-01-30 20:53 PST by Michael Catanzaro
Modified: 2019-02-05 08:03 PST (History)
8 users (show)

See Also:


Attachments
Patch (24.19 KB, patch)
2019-01-30 20:59 PST, Michael Catanzaro
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2019-01-30 20:53:44 PST
Move cookiePersistentStoragePath and cookiePersistentStorageType from NetworkProcess to NetworkSession to reduce globals. This removes two of the six soup-specific variables in NetworkProcessCreationParameters. More to come....
Comment 1 Michael Catanzaro 2019-01-30 20:59:01 PST
Created attachment 360687 [details]
Patch
Comment 2 EWS Watchlist 2019-01-30 21:02:09 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Carlos Garcia Campos 2019-01-31 00:31:28 PST
Comment on attachment 360687 [details]
Patch

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

> Source/WebKit/UIProcess/API/glib/WebKitCookieManager.cpp:169
> +    auto sessionID = webkitWebsiteDataManagerGetDataStore(manager->priv->dataManager).websiteDataStore().sessionID();

We should not allow to set a persistent cookie storage in ephemeral sessions. Return early here if sessionID is ephemeral. That's the reason why we used the default session ID unconditionally, for now in soup based ports all sessions but the default one are ephemeral.

> Source/WebKit/UIProcess/soup/WebCookieManagerProxySoup.cpp:44
> +    auto pair = m_cookiePersistentStorageMap.get(sessionID);
> +    storagePath = pair.first;
> +    storageType = static_cast<uint32_t>(pair.second);

You should check the return value in case the sessionID is not present in the map. Or add an assert if it should always be.
Comment 4 Michael Catanzaro 2019-01-31 06:19:08 PST
(In reply to Carlos Garcia Campos from comment #3)
> > Source/WebKit/UIProcess/API/glib/WebKitCookieManager.cpp:169
> > +    auto sessionID = webkitWebsiteDataManagerGetDataStore(manager->priv->dataManager).websiteDataStore().sessionID();
> 
> We should not allow to set a persistent cookie storage in ephemeral
> sessions. Return early here if sessionID is ephemeral. That's the reason why
> we used the default session ID unconditionally, for now in soup based ports
> all sessions but the default one are ephemeral.

OK.

> > Source/WebKit/UIProcess/soup/WebCookieManagerProxySoup.cpp:44
> > +    auto pair = m_cookiePersistentStorageMap.get(sessionID);
> > +    storagePath = pair.first;
> > +    storageType = static_cast<uint32_t>(pair.second);
> 
> You should check the return value in case the sessionID is not present in
> the map. Or add an assert if it should always be.

If it's not present then an empty value gets used (I think empty string and the first storage type policy) so the end result would be the same, right?
Comment 5 Michael Catanzaro 2019-01-31 07:02:14 PST
(In reply to Michael Catanzaro from comment #4)
> If it's not present then an empty value gets used (I think empty string and
> the first storage type policy) so the end result would be the same, right?

Verified it returns empty string for path, and 0 (SoupCookiePersistentStorageText) for type.
Comment 6 Michael Catanzaro 2019-01-31 07:04:37 PST
Committed r240785: <https://trac.webkit.org/changeset/240785>