RESOLVED FIXED 67870
Private Browsing is a per-page setting that sets a global value
https://bugs.webkit.org/show_bug.cgi?id=67870
Summary Private Browsing is a per-page setting that sets a global value
Jessie Berlin
Reported 2011-09-09 15:35:20 PDT
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.
Attachments
WIP (73.43 KB, patch)
2012-11-14 16:59 PST, Alexey Proskuryakov
buildbot: commit-queue-
proposed patch (99.71 KB, patch)
2012-11-15 16:20 PST, Alexey Proskuryakov
no flags
updated patch (99.56 KB, patch)
2012-11-15 17:27 PST, Alexey Proskuryakov
sam: review+
webkit.review.bot: commit-queue-
Jessie Berlin
Comment 1 2011-09-09 15:36:39 PDT
Jessie Berlin
Comment 2 2011-09-09 17:03:31 PDT
Re-titling to express the interest that Private Browsing should be able to be something done per-page.
Alexey Proskuryakov
Comment 3 2012-11-14 16:59:32 PST
WebKit Review Bot
Comment 4 2012-11-14 17:02:30 PST
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.
Build Bot
Comment 5 2012-11-14 21:12:21 PST
Alexey Proskuryakov
Comment 6 2012-11-15 16:20:18 PST
Created attachment 174545 [details] proposed patch
WebKit Review Bot
Comment 7 2012-11-15 16:23:56 PST
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.
Alexey Proskuryakov
Comment 8 2012-11-15 16:26:18 PST
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.
Sam Weinig
Comment 9 2012-11-15 16:41:32 PST
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().
Alexey Proskuryakov
Comment 10 2012-11-15 17:22:21 PST
> 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.
Alexey Proskuryakov
Comment 11 2012-11-15 17:27:52 PST
Created attachment 174567 [details] updated patch
Alexey Proskuryakov
Comment 12 2012-11-15 17:39:06 PST
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 :)
Build Bot
Comment 13 2012-11-15 20:28:54 PST
Comment on attachment 174567 [details] updated patch Attachment 174567 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/14845747
WebKit Review Bot
Comment 14 2012-11-15 21:19:11 PST
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
Alexey Proskuryakov
Comment 15 2012-11-16 09:47:43 PST
Note You need to log in before you can comment on or make changes to this bug.