Bug 186205

Summary: REGRESSION (r229872): Unable to log into twitter.com in private sessions
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, cgarcia, commit-queue, dbates, ews-watchlist, ggaren, hendrex.jakai, shalin_i_parmar, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar, Regression
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=186617
Bug Depends on: 183921    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2018-06-01 13:18:28 PDT
Unable to log into twitter.com in private sessions since http://trac.webkit.org/r230567.
Comment 1 Chris Dumez 2018-06-01 13:18:44 PDT
<rdar://problem/40670799>
Comment 2 Chris Dumez 2018-06-01 13:45:27 PDT
Created attachment 341783 [details]
Patch
Comment 3 youenn fablet 2018-06-01 14:42:49 PDT
Comment on attachment 341783 [details]
Patch

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

> Source/WebCore/workers/service/server/SWServer.cpp:-75
> -    RELEASE_ASSERT(m_jobQueues.isEmpty());

Shouldn't we also remove the first assert?

> Source/WebKit/UIProcess/WebProcessPool.cpp:734
> +    }

You might be able to use sendToNetworkingProcess/sendToStorageProcess to improve the readability.
Something like:
if (privateBrowsingEnabled) {
   ...
   return;
}

sendToNetworkingProcess(Messages::NetworkProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()), 0);
sendToStorageProcess(Messages::StorageProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()), 0);
sendToAllProcesses(Messages::WebProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()));

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1482
> +            weakThis->removePrevalentDomains(domainsToRemove);

Lambdas do not seem to make things better here.
How about passing the weakThis once to WebResourceLoadStatisticsStore, which could then call the removePrevalentDomains/removeAllStorageAccessHandler/grantStorageAccessHandler/... methods directly.
Comment 4 Chris Dumez 2018-06-01 14:45:16 PDT
Comment on attachment 341783 [details]
Patch

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

>> Source/WebCore/workers/service/server/SWServer.cpp:-75
>> -    RELEASE_ASSERT(m_jobQueues.isEmpty());
> 
> Shouldn't we also remove the first assert?

I am not sure. It seems to work. When a session is destroyed, all its web processes should have been destroyed so we should no longer have connections to them.

>> Source/WebKit/UIProcess/WebProcessPool.cpp:734
>> +    }
> 
> You might be able to use sendToNetworkingProcess/sendToStorageProcess to improve the readability.
> Something like:
> if (privateBrowsingEnabled) {
>    ...
>    return;
> }
> 
> sendToNetworkingProcess(Messages::NetworkProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()), 0);
> sendToStorageProcess(Messages::StorageProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()), 0);
> sendToAllProcesses(Messages::WebProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()));

Ok.

>> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1482
>> +            weakThis->removePrevalentDomains(domainsToRemove);
> 
> Lambdas do not seem to make things better here.
> How about passing the weakThis once to WebResourceLoadStatisticsStore, which could then call the removePrevalentDomains/removeAllStorageAccessHandler/grantStorageAccessHandler/... methods directly.

This is a larger refactoring. I'll try and see how big it ends up being.
Comment 5 Chris Dumez 2018-06-01 15:16:02 PDT
Created attachment 341793 [details]
Patch
Comment 6 WebKit Commit Bot 2018-06-01 15:56:35 PDT
Comment on attachment 341793 [details]
Patch

Clearing flags on attachment: 341793

Committed r232423: <https://trac.webkit.org/changeset/232423>
Comment 7 WebKit Commit Bot 2018-06-01 15:56:37 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Chris Dumez 2018-06-14 11:56:10 PDT
*** Bug 186617 has been marked as a duplicate of this bug. ***
Comment 9 shalin_i_parmar 2018-10-02 18:42:42 PDT
I still see that this issue is happening for all Safari browsers and it is not consistent, i.e. it send with most of GET requests but not all.

In two of our apps, we see that the request was not being sent with cookies at all for variety of requests including GET and POST.

Please fix this as it is very annoying and hard to detect.