In WebCore’s Settings.cpp’s setPrivateBrowsingEnabled, both of the following methods for turning on or off Private Browsing affect global settings: // This modifies a static on ResourceHandle. #if USE(CFURLSTORAGESESSIONS) ResourceHandle::setPrivateBrowsingEnabled(privateBrowsingEnabled); #endif and // This modifies the shared NSHTTPCookieStorage. setCookieStoragePrivateBrowsingEnabled(privateBrowsingEnabled); However, the Settings object is the Settings for a single Page. It should not be modifying global settings.
<rdar://problem/10103215>
Re-titling to express the interest that Private Browsing should be able to be something done per-page.
Created attachment 174291 [details] WIP
Attachment 174291 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/WebCore.exp.in', u'Source/W..." exit_code: 1 Source/WebCore/platform/network/cf/CookieJarCFNet.cpp:35: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 36 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 174291 [details] WIP Attachment 174291 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/14844336
Created attachment 174545 [details] proposed patch
Attachment 174545 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/platform/network/cf/CookieJarCFNet.cpp:35: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 45 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 174545 [details] proposed patch Actually, this doesn't work. A Web Inspector page created while private browsing is active would kill the private session.
Comment on attachment 174545 [details] proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=174545&action=review > Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp:422 > + RetainPtr<CFArrayRef> cookies(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cfCookieStorage.get(), cfURL.get(), false)); This should use the adoptCF() function (like above). > Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp:827 > + RetainPtr<CFDataRef> data(AdoptCF, CFURLConnectionSendSynchronousRequest(request.cfURLRequest(), &cfResponse, &cfError, request.timeoutInterval())); This should use adoptCF() > Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:113 > + if (CFURLStorageSessionRef session = WebFrameNetworkingContext::defaultStorageSession()) > + return RetainPtr<CFHTTPCookieStorageRef>(AdoptCF, WKCopyHTTPCookieStorage(session)); This should use the adoptCF() function, rather than the RetainPtr constructor (we are moving to that to be consistent with RefPtr. > Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPlatformStrategiesMac.mm:39 > + if (CFURLStorageSessionRef session = WebFrameNetworkingContext::defaultStorageSession()) > + return RetainPtr<CFHTTPCookieStorageRef>(AdoptCF, WKCopyHTTPCookieStorage(session)); This should use adoptCF(). > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:2185 > +#if PLATFORM(MAC) || USE(CFNETWORK) > + if (privateBrowsingEnabled) > + WebFrameNetworkingContext::ensurePrivateBrowsingSession(); > + else > + WebFrameNetworkingContext::destroyPrivateBrowsingSession(); > +#endif Can this go in platformPreferencesDidChange()? > Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm:87 > + if (CFURLStorageSessionRef session = WebFrameNetworkingContext::defaultStorageSession()) > + return RetainPtr<CFHTTPCookieStorageRef>(AdoptCF, WKCopyHTTPCookieStorage(session)); This should use adoptCF(). > Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp:84 > + if (CFURLStorageSessionRef session = WebFrameNetworkingContext::defaultStorageSession()) > + return RetainPtr<CFHTTPCookieStorageRef>(AdoptCF, wkCopyHTTPCookieStorage(session)); Please use adoptCF().
> Can this go in platformPreferencesDidChange()? Probably not - it's a cross platform preference with some semi-temporary platform specific implementation details, not something entirely specific to a platform. So, we'd have the code to support it confusingly sprinkled around the code base.
Created attachment 174567 [details] updated patch
By the way, I'm shamelessly using this bug, because it's in WebCore component, and I'm fixing it for WebCore, if not for WebKit :)
Comment on attachment 174567 [details] updated patch Attachment 174567 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/14845747
Comment on attachment 174567 [details] updated patch Rejecting attachment 174567 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: ommit-queue/Source/WebKit/chromium/third_party/snappy/src --revision 63 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' 50>At revision 63. ________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' ________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' Updating webkit projects from gyp files... Full output: http://queues.webkit.org/results/14848677
Committed <http://trac.webkit.org/changeset/134960>.