Changeset 80180 in webkit


Ignore:
Timestamp:
Mar 2, 2011 4:07:15 PM (13 years ago)
Author:
jberlin@webkit.org
Message:

Source/JavaScriptCore: 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.

  • 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:
Location:
trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r80179 r80180  
     12011-03-02  Jessie Berlin  <jberlin@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Use CFNetwork Sessions API.
     6        https://bugs.webkit.org/show_bug.cgi?id=55435
     7
     8        Add the ability to create a Private Browsing storage session.
     9
     10        * wtf/Platform.h:
     11        Add a new #define for using CF Storage Sessions.
     12
    1132011-03-02  Oliver Hunt  <oliver@apple.com>
    214
  • trunk/Source/JavaScriptCore/wtf/Platform.h

    r80166 r80180  
    696696#if USE(CFNETWORK) || PLATFORM(MAC)
    697697#define WTF_USE_CFURLCACHE 1
     698#define WTF_USE_CFURLSTORAGESESSIONS 1
    698699#endif
    699700
  • trunk/Source/WebCore/ChangeLog

    r80177 r80180  
     12011-03-02  Jessie Berlin  <jberlin@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Use CFNetwork Sessions API.
     6        https://bugs.webkit.org/show_bug.cgi?id=55435
     7
     8        Add the ability to create a Private Browsing Storage Session.
     9
     10        * WebCore.exp.in:
     11        Export the symbol for ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase.
     12
     13        * page/Settings.cpp:
     14        (WebCore::Settings::setPrivateBrowsingEnabled):
     15        Propagate the private browsing state to the ResourceHandle.
     16
     17        * platform/mac/WebCoreSystemInterface.h:
     18        Add the function declaration for wkCreatePrivateStorageSession.
     19        * platform/mac/WebCoreSystemInterface.mm:
     20
     21        * platform/network/ResourceHandle.cpp:
     22        (WebCore::privateStorageSession):
     23        Since the same Private Browsing Storage Session will need to be accessed throughout the loading
     24        code and will need to be used by all web pages and page groups, make it a global static.
     25        (WebCore::privateBrowsingStorageSessionIdentifierBase):
     26        Ditto, since the identifier is needed to create the Private Browsing Storage Session.
     27        (WebCore::ResourceHandle::setPrivateBrowsingEnabled):
     28        If enabled, create and store the Private Browsing Storage Session.
     29        (WebCore::ResourceHandle::privateBrowsingStorageSession):
     30        (WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase):
     31        * platform/network/ResourceHandle.h:
     32
     33        * platform/network/cf/ResourceHandleCFNet.cpp:
     34        (WebCore::ResourceHandle::createPrivateBrowsingStorageSession):
     35        The call to wkCreatePrivateStorageSession needs to be in a file including the correct
     36        version of WKSI.
     37        (WebCore::ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase):
     38        Return the bundle identifier.
     39        * platform/network/mac/ResourceHandleMac.mm:
     40        (WebCore::ResourceHandle::createPrivateBrowsingStorageSession):
     41        The call to wkCreatePrivateStorageSession needs to be in a file importing the correct
     42        version of WKSI.
     43        (WebCore::ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase):
     44        Return the bundle identifier.
     45
    1462011-03-02  Daniel Cheng  <dcheng@chromium.org>
    247
  • trunk/Source/WebCore/WebCore.exp.in

    r80059 r80180  
    13341334_wkSignalCFReadStreamError
    13351335_wkSignalCFReadStreamHasBytes
     1336_wkCreatePrivateStorageSession
    13361337
    13371338#if !defined(NDEBUG)
     
    17821783__ZN7WebCore12EventHandler18handleGestureEventERKNS_20PlatformGestureEventE
    17831784#endif
     1785
     1786#if USE(CFURLSTORAGESESSIONS)
     1787__ZN7WebCore14ResourceHandle46setPrivateBrowsingStorageSessionIdentifierBaseERKN3WTF6StringE
     1788#endif
  • trunk/Source/WebCore/page/Settings.cpp

    r78788 r80180  
    3838#include "Page.h"
    3939#include "PageCache.h"
     40#include "ResourceHandle.h"
    4041#include "StorageMap.h"
    4142#include <limits>
     
    338339        return;
    339340
     341#if USE(CFURLSTORAGESESSIONS)
     342    ResourceHandle::setPrivateBrowsingEnabled(privateBrowsingEnabled);
     343#endif
     344
    340345    // FIXME: We can only enable cookie private browsing mode globally, so it's misleading to have it as a per-page setting.
    341346    setCookieStoragePrivateBrowsingEnabled(privateBrowsingEnabled);
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h

    r78241 r80180  
    236236extern AXUIElementRef (*wkCreateAXUIElementRef)(id element);
    237237
     238typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
     239extern CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
     240
    238241}
    239242
  • trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm

    r78241 r80180  
    173173AXUIElementRef (*wkCreateAXUIElementRef)(id element);
    174174
     175CFURLStorageSessionRef (*wkCreatePrivateStorageSession)(CFStringRef);
     176
  • trunk/Source/WebCore/platform/network/ResourceHandle.cpp

    r67291 r80180  
    3434#include "Timer.h"
    3535#include <algorithm>
     36#include <wtf/text/CString.h>
    3637
    3738namespace WebCore {
     
    186187}
    187188
     189#if USE(CFURLSTORAGESESSIONS)
     190
     191static RetainPtr<CFURLStorageSessionRef>& privateStorageSession()
     192{
     193    DEFINE_STATIC_LOCAL(RetainPtr<CFURLStorageSessionRef>, storageSession, ());
     194    return storageSession;
     195}
     196
     197static String& privateBrowsingStorageSessionIdentifierBase()
     198{
     199    DEFINE_STATIC_LOCAL(String, base, ());
     200    return base;
     201}
     202
     203void ResourceHandle::setPrivateBrowsingEnabled(bool enabled)
     204{
     205    if (!enabled) {
     206        privateStorageSession() = nullptr;
     207        return;
     208    }
     209
     210    if (privateStorageSession())
     211        return;
     212
     213    String base = privateBrowsingStorageSessionIdentifierBase().isNull() ? privateBrowsingStorageSessionIdentifierDefaultBase() : privateBrowsingStorageSessionIdentifierBase();
     214    RetainPtr<CFStringRef> cfIdentifier(AdoptCF, String::format("%s.PrivateBrowsing", base.utf8().data()).createCFString());
     215
     216    privateStorageSession() = createPrivateBrowsingStorageSession(cfIdentifier.get());
     217}
     218
     219CFURLStorageSessionRef ResourceHandle::privateBrowsingStorageSession()
     220{
     221    return privateStorageSession().get();
     222}
     223
     224void ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(const String& identifier)
     225{
     226    privateBrowsingStorageSessionIdentifierBase() = identifier;
     227}
     228
     229#endif // USE(CFURLSTORAGESESSIONS)
     230
    188231} // namespace WebCore
  • trunk/Source/WebCore/platform/network/ResourceHandle.h

    r79434 r80180  
    7272#endif
    7373
     74#if USE(CFURLSTORAGESESSIONS)
     75typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
     76#endif
     77
    7478namespace WebCore {
    7579
     
    187191    void fireFailure(Timer<ResourceHandle>*);
    188192
     193#if USE(CFURLSTORAGESESSIONS)
     194    static void setPrivateBrowsingEnabled(bool);
     195    static CFURLStorageSessionRef privateBrowsingStorageSession();
     196    static void setPrivateBrowsingStorageSessionIdentifierBase(const String&);
     197#endif
     198
    189199    using RefCounted<ResourceHandle>::ref;
    190200    using RefCounted<ResourceHandle>::deref;
     
    215225#endif
    216226
     227#if USE(CFURLSTORAGESESSIONS)
     228    static RetainPtr<CFURLStorageSessionRef> createPrivateBrowsingStorageSession(CFStringRef identifier);
     229    static String privateBrowsingStorageSessionIdentifierDefaultBase();
     230#endif
     231
    217232    friend class ResourceHandleInternal;
    218233    OwnPtr<ResourceHandleInternal> d;
  • trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

    r76472 r80180  
    717717}
    718718
     719RetainPtr<CFURLStorageSessionRef> ResourceHandle::createPrivateBrowsingStorageSession(CFStringRef identifier)
     720{
     721    return RetainPtr<CFURLStorageSessionRef>(AdoptCF, wkCreatePrivateStorageSession(identifier));
     722}
     723
     724String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
     725{
     726    return String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
     727}
     728
    719729void WebCoreSynchronousLoaderClient::willSendRequest(ResourceHandle* handle, ResourceRequest& request, const ResourceResponse& /*redirectResponse*/)
    720730{
  • trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm

    r76472 r80180  
    694694}
    695695
     696RetainPtr<CFURLStorageSessionRef> ResourceHandle::createPrivateBrowsingStorageSession(CFStringRef identifier)
     697{
     698    return RetainPtr<CFURLStorageSessionRef>(AdoptCF, wkCreatePrivateStorageSession(identifier));
     699}
     700
     701String ResourceHandle::privateBrowsingStorageSessionIdentifierDefaultBase()
     702{
     703    return String([[NSBundle mainBundle] bundleIdentifier]);
     704}
     705
    696706} // namespace WebCore
    697707
  • trunk/Source/WebKit/mac/ChangeLog

    r80166 r80180  
     12011-03-02  Jessie Berlin  <jberlin@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Use CFNetwork Sessions API.
     6        https://bugs.webkit.org/show_bug.cgi?id=55435.
     7
     8        Add the ability to create a Private Browsing Storage Session.
     9
     10        * WebCoreSupport/WebSystemInterface.mm:
     11        (InitWebCoreSystemInterface):
     12        Support calling wkCreatePrivateStorageSession from WebCore.
     13
    1142011-03-02  Daniel Cheng  <dcheng@chromium.org>
    215
  • trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm

    r78241 r80180  
    155155    INIT(ContentAreaDidHide);
    156156    INIT(ScrollbarPainterUsesOverlayScrollers);
     157    INIT(CreatePrivateStorageSession);
    157158#endif
    158159
  • trunk/Source/WebKit2/ChangeLog

    r80145 r80180  
     12011-03-02  Jessie Berlin  <jberlin@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Use CFNetwork Sessions API.
     6        https://bugs.webkit.org/show_bug.cgi?id=55435
     7
     8        Add the ability to create a Private Browsing Storage Session.
     9
     10        * Shared/WebProcessCreationParameters.cpp:
     11        (WebKit::WebProcessCreationParameters::encode):
     12        Encode the UI Process bundle identifier.
     13        (WebKit::WebProcessCreationParameters::decode):
     14        Decode the UI Process bundle identifier.
     15        * Shared/WebProcessCreationParameters.h:
     16
     17        * UIProcess/mac/WebContextMac.mm:
     18        (WebKit::WebContext::platformInitializeWebProcess):
     19        Grab the bundle identifier and use it to set the WebProcessCreationParameter.
     20        * UIProcess/win/WebContextWin.cpp:
     21        (WebKit::WebContext::platformInitializeWebProcess):
     22        Ditto.
     23
     24        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
     25        (InitWebCoreSystemInterface):
     26        Support using the wkCreatePrivateStorageSession WKSI in WebCore.
     27
     28        * WebProcess/WebProcess.cpp:
     29        (WebKit::WebProcess::initializeWebProcess):
     30        Set the base for the Private Browsing Storage Session identifier to be the bundle identifier
     31        from the UI Process so that WebKit1 would create a Private Browsing Storage Session with the
     32        same identifier as WebKit2.
     33
    1342011-03-01  Brian Weinstein  <bweinstein@apple.com>
    235
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp

    r79253 r80180  
    6060    encoder->encode(textCheckerState);
    6161    encoder->encode(defaultRequestTimeoutInterval);
     62#if USE(CFURLSTORAGESESSIONS)
     63    encoder->encode(uiProcessBundleIdentifier);
     64#endif
    6265#if PLATFORM(MAC)
    6366    encoder->encode(parentProcessName);
     
    106109    if (!decoder->decode(parameters.defaultRequestTimeoutInterval))
    107110        return false;
     111#if USE(CFURLSTORAGESESSIONS)
     112    if (!decoder->decode(parameters.uiProcessBundleIdentifier))
     113        return false;
     114#endif
    108115
    109116#if PLATFORM(MAC)
  • trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h

    r79927 r80180  
    7676    double defaultRequestTimeoutInterval;
    7777
     78#if USE(CFURLSTORAGESESSIONS)
     79    String uiProcessBundleIdentifier;
     80#endif
     81
    7882#if PLATFORM(MAC)
    7983    String parentProcessName;
  • trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm

    r79927 r80180  
    9494    // FIXME: This should really be configurable; we shouldn't just blindly allow read access to the UI process bundle.
    9595    parameters.uiProcessBundleResourcePath = fileSystemRepresentation([[NSBundle mainBundle] resourcePath]);
     96
     97    parameters.uiProcessBundleIdentifier = String([[NSBundle mainBundle] bundleIdentifier]);
    9698}
    9799
  • trunk/Source/WebKit2/UIProcess/win/WebContextWin.cpp

    r79927 r80180  
    6969    if (parameters.cfURLCachePath[parameters.cfURLCachePath.length() - 1] == '/')
    7070        parameters.cfURLCachePath.remove(parameters.cfURLCachePath.length() - 1);
     71
     72    parameters.uiProcessBundleIdentifier = String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey)));
    7173#endif
    7274}
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm

    r78241 r80180  
    9494        INIT(SignalCFReadStreamError);
    9595        INIT(SignalCFReadStreamHasBytes);
     96        INIT(CreatePrivateStorageSession);
    9697
    9798#if !defined(BUILDING_ON_SNOW_LEOPARD)
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r79654 r80180  
    5959#include <WebCore/Page.h>
    6060#include <WebCore/PageGroup.h>
     61#include <WebCore/ResourceHandle.h>
    6162#include <WebCore/SchemeRegistry.h>
    6263#include <WebCore/SecurityOrigin.h>
     
    213214    if (parameters.shouldAlwaysUseComplexTextCodePath)
    214215        setAlwaysUsesComplexTextCodePath(true);
     216
     217#if USE(CFURLSTORAGESESSIONS)
     218    WebCore::ResourceHandle::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier);
     219#endif
    215220}
    216221
  • trunk/WebKitLibraries/ChangeLog

    r80166 r80180  
     12011-03-02  Jessie Berlin  <jberlin@apple.com>
     2
     3        Rubber-stamped by Adam Roben.
     4
     5        WebKit2: Use CFNetwork Sessions API.
     6        https://bugs.webkit.org/show_bug.cgi?id=55435
     7
     8        Add the ability to create a Private Browsing Storage Session.
     9
     10        Update WebKitSystemInterface headers and libraries with the new functions.
     11
     12        * WebKitSystemInterface.h:
     13        * libWebKitSystemInterfaceLeopard.a:
     14        * libWebKitSystemInterfaceSnowLeopard.a:
     15        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
     16        * win/lib/WebKitSystemInterface.lib:
     17
    1182011-03-02  Daniel Cheng  <dcheng@chromium.org>
    219
  • trunk/WebKitLibraries/WebKitSystemInterface.h

    r80011 r80180  
    233233
    234234CFStringRef WKCopyFoundationCacheDirectory(void);
     235
     236typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
     237CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
    235238
    236239void WKSetVisibleApplicationName(CFStringRef);
  • trunk/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h

    r79252 r80180  
    6565typedef unsigned long CFTypeID;
    6666typedef struct _CFURLCredential* WKCFURLCredentialRef;
     67typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
    6768
    6869void wkSetFontSmoothingLevel(int type);
     
    9596CFArrayRef wkCFURLRequestCopyHTTPRequestBodyParts(CFURLRequestRef);
    9697void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bodyParts);
     98
     99CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier);
    97100
    98101CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
Note: See TracChangeset for help on using the changeset viewer.