Bug 67874

Summary: Cookies are not available after turning off Private Browsing after the last window has been closed
Product: WebKit Reporter: Jessie Berlin <jberlin>
Component: WebCore Misc.Assignee: Jessie Berlin <jberlin>
Status: RESOLVED FIXED    
Severity: Normal CC: adachan, andersca, ap, jberlin, mitz, sam
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Jessie Berlin 2011-09-09 16:31:17 PDT
Private Browsing is a global setting, but it is treated as a per-page setting (see https://bugs.webkit.org/show_bug.cgi?id=67870).

When Private Browsing is turned on, a (global) Private Browsing Storage Session is created as a result of the call to Settings::setPrivateBrowsingEnabled(true);

When the last Page goes away, the last Settings object goes away.

When a new Page is created, a new Settings object is created and it's m_privateBrowsingEnabled value is initialized to false in the constructor.

When the PageGroup preferences are then applied to that Settings object to set the value to false, the early return if (m_privateBrowsingEnabled == privateBrowsingEnabled) in Settings::privateBrowsingStorageSession prevents the Private Browsing Storage Session from being destroyed.

Hence, when any request asks for the current storage session, it gets the Private Browsing storage session - where there are no cookies available from the normal browsing session.

<rdar://problem/9998144>
Comment 1 Jessie Berlin 2011-09-09 16:47:30 PDT
Created attachment 106940 [details]
Patch
Comment 2 Jessie Berlin 2011-09-09 17:13:22 PDT
The references to the PageGroup updating the settings after the Page is created in the comments are wrong. It should be the WebPage, not the PageGroup. I will fix the comments.
Comment 3 Ada Chan 2011-09-09 17:28:20 PDT
Comment on attachment 106940 [details]
Patch

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

> Source/WebCore/ChangeLog:20
> +           global value for the storage session from being destroyed.

Is "from being reset" better?
Comment 4 Ada Chan 2011-09-09 17:36:57 PDT
(In reply to comment #3)
> (From update of attachment 106940 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=106940&action=review
> 
> > Source/WebCore/ChangeLog:20
> > +           global value for the storage session from being destroyed.
> 
> Is "from being reset" better?

Actually what you have is fine.  Nevermind.
Comment 5 Jessie Berlin 2011-09-09 17:57:59 PDT
Comment on attachment 106940 [details]
Patch

Thanks for the review! Committed in http://trac.webkit.org/changeset/94892.