https://bugs.webkit.org/show_bug.cgi?id=55435
Reviewed by Adam Roben.
Add the ability to create a Private Browsing storage session.
* wtf/Platform.h:
Add a new #define for using CF Storage Sessions.
Source/WebCore: WebKit2: Use CFNetwork Sessions API.
https://bugs.webkit.org/show_bug.cgi?id=55435
Reviewed by Adam Roben.
Add the ability to create a Private Browsing Storage Session.
* WebCore.exp.in:
Export the symbol for ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase.
* page/Settings.cpp:
(WebCore::Settings::setPrivateBrowsingEnabled):
Propagate the private browsing state to the ResourceHandle.
* platform/mac/WebCoreSystemInterface.h:
Add the function declaration for wkCreatePrivateStorageSession.
* platform/mac/WebCoreSystemInterface.mm:
* platform/network/ResourceHandle.cpp:
(WebCore::privateStorageSession):
Since the same Private Browsing Storage Session will need to be accessed throughout the loading
code and will need to be used by all web pages and page groups, make it a global static.
(WebCore::privateBrowsingStorageSessionIdentifierBase):
Ditto, since the identifier is needed to create the Private Browsing Storage Session.
(WebCore::ResourceHandle::setPrivateBrowsingEnabled):
If enabled, create and store the Private Browsing Storage Session.
(WebCore::ResourceHandle::privateBrowsingStorageSession):
(WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase):
* platform/network/ResourceHandle.h:
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::createPrivateBrowsingStorageSession):
The call to wkCreatePrivateStorageSession needs to be in a file including the correct
version of WKSI.
(WebCore::ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase):
Return the bundle identifier.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createPrivateBrowsingStorageSession):
The call to wkCreatePrivateStorageSession needs to be in a file importing the correct
version of WKSI.
(WebCore::ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase):
Return the bundle identifier.
Source/WebKit/mac: WebKit2: Use CFNetwork Sessions API.
https://bugs.webkit.org/show_bug.cgi?id=55435.
Reviewed by Adam Roben.
Add the ability to create a Private Browsing Storage Session.
* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
Support calling wkCreatePrivateStorageSession from WebCore.
Source/WebKit2: WebKit2: Use CFNetwork Sessions API.
https://bugs.webkit.org/show_bug.cgi?id=55435
Reviewed by Adam Roben.
Add the ability to create a Private Browsing Storage Session.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
Encode the UI Process bundle identifier.
(WebKit::WebProcessCreationParameters::decode):
Decode the UI Process bundle identifier.
* Shared/WebProcessCreationParameters.h:
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess):
Grab the bundle identifier and use it to set the WebProcessCreationParameter.
* UIProcess/win/WebContextWin.cpp:
(WebKit::WebContext::platformInitializeWebProcess):
Ditto.
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):
Support using the wkCreatePrivateStorageSession WKSI in WebCore.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
Set the base for the Private Browsing Storage Session identifier to be the bundle identifier
from the UI Process so that WebKit1 would create a Private Browsing Storage Session with the
same identifier as WebKit2.
WebKitLibraries: WebKit2: Use CFNetwork Sessions API.
https://bugs.webkit.org/show_bug.cgi?id=55435
Rubber-stamped by Adam Roben.
Add the ability to create a Private Browsing Storage Session.
Update WebKitSystemInterface headers and libraries with the new functions.
* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLeopard.a:
* libWebKitSystemInterfaceSnowLeopard.a:
* win/include/WebKitSystemInterface/WebKitSystemInterface.h:
* win/lib/WebKitSystemInterface.lib:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80180
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-03-02 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit2: Use CFNetwork Sessions API.
+ https://bugs.webkit.org/show_bug.cgi?id=55435
+
+ Add the ability to create a Private Browsing storage session.
+
+ * wtf/Platform.h:
+ Add a new #define for using CF Storage Sessions.
+
2011-03-02 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough.
#if USE(CFNETWORK) || PLATFORM(MAC)
#define WTF_USE_CFURLCACHE 1
+#define WTF_USE_CFURLSTORAGESESSIONS 1
#endif
#if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(CHROMIUM) && !PLATFORM(QT)
+2011-03-02 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit2: Use CFNetwork Sessions API.
+ https://bugs.webkit.org/show_bug.cgi?id=55435
+
+ Add the ability to create a Private Browsing Storage Session.
+
+ * WebCore.exp.in:
+ Export the symbol for ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase.
+
+ * page/Settings.cpp:
+ (WebCore::Settings::setPrivateBrowsingEnabled):
+ Propagate the private browsing state to the ResourceHandle.
+
+ * platform/mac/WebCoreSystemInterface.h:
+ Add the function declaration for wkCreatePrivateStorageSession.
+ * platform/mac/WebCoreSystemInterface.mm:
+
+ * platform/network/ResourceHandle.cpp:
+ (WebCore::privateStorageSession):
+ Since the same Private Browsing Storage Session will need to be accessed throughout the loading
+ code and will need to be used by all web pages and page groups, make it a global static.
+ (WebCore::privateBrowsingStorageSessionIdentifierBase):
+ Ditto, since the identifier is needed to create the Private Browsing Storage Session.
+ (WebCore::ResourceHandle::setPrivateBrowsingEnabled):
+ If enabled, create and store the Private Browsing Storage Session.
+ (WebCore::ResourceHandle::privateBrowsingStorageSession):
+ (WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase):
+ * platform/network/ResourceHandle.h:
+
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::ResourceHandle::createPrivateBrowsingStorageSession):
+ The call to wkCreatePrivateStorageSession needs to be in a file including the correct
+ version of WKSI.
+ (WebCore::ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase):
+ Return the bundle identifier.
+ * platform/network/mac/ResourceHandleMac.mm:
+ (WebCore::ResourceHandle::createPrivateBrowsingStorageSession):
+ The call to wkCreatePrivateStorageSession needs to be in a file importing the correct
+ version of WKSI.
+ (WebCore::ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase):
+ Return the bundle identifier.
+
2011-03-02 Daniel Cheng <dcheng@chromium.org>
Revert frame-specific WebClipboard changes
_wkSignalCFReadStreamEnd
_wkSignalCFReadStreamError
_wkSignalCFReadStreamHasBytes
+_wkCreatePrivateStorageSession
#if !defined(NDEBUG)
__ZN7WebCore20LogNotYetImplementedE
#if ENABLE(GESTURE_EVENTS)
__ZN7WebCore12EventHandler18handleGestureEventERKNS_20PlatformGestureEventE
#endif
+
+#if USE(CFURLSTORAGESESSIONS)
+__ZN7WebCore14ResourceHandle46setPrivateBrowsingStorageSessionIdentifierBaseERKN3WTF6StringE
+#endif
#include "HistoryItem.h"
#include "Page.h"
#include "PageCache.h"
+#include "ResourceHandle.h"
#include "StorageMap.h"
#include <limits>
if (m_privateBrowsingEnabled == privateBrowsingEnabled)
return;
+#if USE(CFURLSTORAGESESSIONS)
+ ResourceHandle::setPrivateBrowsingEnabled(privateBrowsingEnabled);
+#endif
+
// FIXME: We can only enable cookie private browsing mode globally, so it's misleading to have it as a per-page setting.
setCookieStoragePrivateBrowsingEnabled(privateBrowsingEnabled);
extern BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
extern AXUIElementRef (*wkCreateAXUIElementRef)(id element);
+typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+extern CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
+
}
#endif
BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length);
AXUIElementRef (*wkCreateAXUIElementRef)(id element);
+CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
+
#include "ResourceHandleClient.h"
#include "Timer.h"
#include <algorithm>
+#include <wtf/text/CString.h>
namespace WebCore {
// Optionally implemented by platform.
}
+#if USE(CFURLSTORAGESESSIONS)
+
+static RetainPtr<CFURLStorageSessionRef>& privateStorageSession()
+{
+ DEFINE_STATIC_LOCAL(RetainPtr<CFURLStorageSessionRef>, storageSession, ());
+ return storageSession;
+}
+
+static String& privateBrowsingStorageSessionIdentifierBase()
+{
+ DEFINE_STATIC_LOCAL(String, base, ());
+ return base;
+}
+
+void ResourceHandle::setPrivateBrowsingEnabled(bool enabled)
+{
+ if (!enabled) {
+ privateStorageSession() = nullptr;
+ return;
+ }
+
+ if (privateStorageSession())
+ return;
+
+ String base = privateBrowsingStorageSessionIdentifierBase().isNull() ? privateBrowsingStorageSessionIdentifierDefaultBase() : privateBrowsingStorageSessionIdentifierBase();
+ RetainPtr<CFStringRef> cfIdentifier(AdoptCF, String::format("%s.PrivateBrowsing", base.utf8().data()).createCFString());
+
+ privateStorageSession() = createPrivateBrowsingStorageSession(cfIdentifier.get());
+}
+
+CFURLStorageSessionRef ResourceHandle::privateBrowsingStorageSession()
+{
+ return privateStorageSession().get();
+}
+
+void ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(const String& identifier)
+{
+ privateBrowsingStorageSessionIdentifierBase() = identifier;
+}
+
+#endif // USE(CFURLSTORAGESESSIONS)
+
} // namespace WebCore
typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
#endif
+#if USE(CFURLSTORAGESESSIONS)
+typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+#endif
+
namespace WebCore {
class AuthenticationChallenge;
void fireFailure(Timer<ResourceHandle>*);
+#if USE(CFURLSTORAGESESSIONS)
+ static void setPrivateBrowsingEnabled(bool);
+ static CFURLStorageSessionRef privateBrowsingStorageSession();
+ static void setPrivateBrowsingStorageSessionIdentifierBase(const String&);
+#endif
+
using RefCounted<ResourceHandle>::ref;
using RefCounted<ResourceHandle>::deref;
void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff);
#endif
+#if USE(CFURLSTORAGESESSIONS)
+ static RetainPtr<CFURLStorageSessionRef> createPrivateBrowsingStorageSession(CFStringRef identifier);
+ static String privateBrowsingStorageSessionIdentifierDefaultBase();
+#endif
+
friend class ResourceHandleInternal;
OwnPtr<ResourceHandleInternal> d;
};
return cached;
}
+RetainPtr<CFURLStorageSessionRef> ResourceHandle::createPrivateBrowsingStorageSession(CFStringRef identifier)
+{
+ return RetainPtr<CFURLStorageSessionRef>(AdoptCF, wkCreatePrivateStorageSession(identifier));
+}
+
+String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
+{
+ return String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
+}
+
void WebCoreSynchronousLoaderClient::willSendRequest(ResourceHandle* handle, ResourceRequest& request, const ResourceResponse& /*redirectResponse*/)
{
// FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests.
client()->receivedCancellation(this, challenge);
}
+RetainPtr<CFURLStorageSessionRef> ResourceHandle::createPrivateBrowsingStorageSession(CFStringRef identifier)
+{
+ return RetainPtr<CFURLStorageSessionRef>(AdoptCF, wkCreatePrivateStorageSession(identifier));
+}
+
+String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
+{
+ return String([[NSBundle mainBundle] bundleIdentifier]);
+}
+
} // namespace WebCore
@implementation WebCoreResourceHandleAsDelegate
+2011-03-02 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit2: Use CFNetwork Sessions API.
+ https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+ Add the ability to create a Private Browsing Storage Session.
+
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+ Support calling wkCreatePrivateStorageSession from WebCore.
+
2011-03-02 Daniel Cheng <dcheng@chromium.org>
Reviewed by David Levin.
INIT(ContentAreaDidShow);
INIT(ContentAreaDidHide);
INIT(ScrollbarPainterUsesOverlayScrollers);
+ INIT(CreatePrivateStorageSession);
#endif
INIT(GetAXTextMarkerTypeID);
+2011-03-02 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKit2: Use CFNetwork Sessions API.
+ https://bugs.webkit.org/show_bug.cgi?id=55435
+
+ Add the ability to create a Private Browsing Storage Session.
+
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::encode):
+ Encode the UI Process bundle identifier.
+ (WebKit::WebProcessCreationParameters::decode):
+ Decode the UI Process bundle identifier.
+ * Shared/WebProcessCreationParameters.h:
+
+ * UIProcess/mac/WebContextMac.mm:
+ (WebKit::WebContext::platformInitializeWebProcess):
+ Grab the bundle identifier and use it to set the WebProcessCreationParameter.
+ * UIProcess/win/WebContextWin.cpp:
+ (WebKit::WebContext::platformInitializeWebProcess):
+ Ditto.
+
+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+ Support using the wkCreatePrivateStorageSession WKSI in WebCore.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::initializeWebProcess):
+ Set the base for the Private Browsing Storage Session identifier to be the bundle identifier
+ from the UI Process so that WebKit1 would create a Private Browsing Storage Session with the
+ same identifier as WebKit2.
+
2011-03-01 Brian Weinstein <bweinstein@apple.com>
Reviewed by Adam Roben.
encoder->encode(languageCode);
encoder->encode(textCheckerState);
encoder->encode(defaultRequestTimeoutInterval);
+#if USE(CFURLSTORAGESESSIONS)
+ encoder->encode(uiProcessBundleIdentifier);
+#endif
#if PLATFORM(MAC)
encoder->encode(parentProcessName);
encoder->encode(presenterApplicationPid);
return false;
if (!decoder->decode(parameters.defaultRequestTimeoutInterval))
return false;
+#if USE(CFURLSTORAGESESSIONS)
+ if (!decoder->decode(parameters.uiProcessBundleIdentifier))
+ return false;
+#endif
#if PLATFORM(MAC)
if (!decoder->decode(parameters.parentProcessName))
double defaultRequestTimeoutInterval;
+#if USE(CFURLSTORAGESESSIONS)
+ String uiProcessBundleIdentifier;
+#endif
+
#if PLATFORM(MAC)
String parentProcessName;
// FIXME: This should really be configurable; we shouldn't just blindly allow read access to the UI process bundle.
parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]);
+
+ parameters.uiProcessBundleIdentifier = String([[NSBundle mainBundle] bundleIdentifier]);
}
String WebContext::platformDefaultDatabaseDirectory() const
ASSERT(parameters.cfURLCachePath.length());
if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '/')
parameters.cfURLCachePath.remove(parameters.cfURLCachePath.length() - 1);
+
+ parameters.uiProcessBundleIdentifier = String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
#endif
}
INIT(SignalCFReadStreamEnd);
INIT(SignalCFReadStreamError);
INIT(SignalCFReadStreamHasBytes);
+ INIT(CreatePrivateStorageSession);
#if !defined(BUILDING_ON_SNOW_LEOPARD)
INIT(IOSurfaceContextCreate);
#include <WebCore/MemoryCache.h>
#include <WebCore/Page.h>
#include <WebCore/PageGroup.h>
+#include <WebCore/ResourceHandle.h>
#include <WebCore/SchemeRegistry.h>
#include <WebCore/SecurityOrigin.h>
#include <WebCore/Settings.h>
if (parameters.shouldAlwaysUseComplexTextCodePath)
setAlwaysUsesComplexTextCodePath(true);
+
+#if USE(CFURLSTORAGESESSIONS)
+ WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier);
+#endif
}
void WebProcess::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks)
+2011-03-02 Jessie Berlin <jberlin@apple.com>
+
+ Rubber-stamped by Adam Roben.
+
+ WebKit2: Use CFNetwork Sessions API.
+ https://bugs.webkit.org/show_bug.cgi?id=55435
+
+ Add the ability to create a Private Browsing Storage Session.
+
+ Update WebKitSystemInterface headers and libraries with the new functions.
+
+ * WebKitSystemInterface.h:
+ * libWebKitSystemInterfaceLeopard.a:
+ * libWebKitSystemInterfaceSnowLeopard.a:
+ * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
+ * win/lib/WebKitSystemInterface.lib:
+
2011-03-02 Daniel Cheng <dcheng@chromium.org>
Reviewed by David Levin.
CFStringRef WKCopyFoundationCacheDirectory(void);
+typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
+
void WKSetVisibleApplicationName(CFStringRef);
typedef enum {
typedef struct _CAImageQueue *CAImageQueueRef;
typedef unsigned long CFTypeID;
typedef struct _CFURLCredential* WKCFURLCredentialRef;
+typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
void wkSetFontSmoothingLevel(int type);
int wkGetFontSmoothingLevel();
CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
+CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier);
+
CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);