platform/network/HTTPValidation.cpp
platform/network/MIMEHeader.cpp
platform/network/NetworkStateNotifier.cpp
+ platform/network/NetworkStorageSessionStub.cpp
platform/network/ParsedContentType.cpp
platform/network/ProtectionSpace.cpp
platform/network/ProxyServer.cpp
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ NetworkingContext combines a reference to storage (cookies and more) and data that's
+ only meaningful when loading. This makes it very ugly to use for cookie manipulation
+ when there is no load (e.g. for document.cookie).
+
+ Adding NetworkStorageSession, which encorportes network-related sesion data, such
+ as cookies and session HTTP credentials.
+
+ For some ports, refactoring is not finished, NetworkStorageSession being a wrapper
+ for NetworkingContext.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.exp.in:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ Updated for new files and functions.
+
+ * platform/network/PlatformCookieJar.h:
+ * loader/CookieJar.cpp:
+ * platform/CookiesStrategy.h:
+ * platform/network/cf/CookieJarCFNet.cpp:
+ * platform/network/chromium/CookieJarChromium.cpp:
+ * platform/network/curl/CookieJarCurl.cpp:
+ * platform/network/mac/CookieJarMac.mm:
+ * platform/network/qt/CookieJarQt.cpp:
+ * platform/network/soup/CookieJarSoup.cpp:
+ * platform/network/win/CookieJarWin.cpp:
+ PlatformCookieJar and strategy cookie functions now take a NetworkStorageSession
+ instead of NetworkingContext.
+ Note that they take a const reference to support creating a temporary session
+ wrapper for ports that just wrap a NetworkingContext.
+
+ * loader/ResourceLoader.cpp:
+ * loader/cache/CachedResource.h:
+ * platform/network/BlobResourceHandle.cpp:
+ * platform/network/ResourceHandle.cpp:
+ * platform/network/ResourceHandle.h:
+ * platform/network/ResourceHandleInternal.h:
+ * platform/network/chromium/ResourceHandle.cpp:
+ * platform/network/curl/ResourceHandleCurl.cpp:
+ * platform/network/mac/ResourceHandleMac.mm:
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ * platform/network/soup/DNSSoup.cpp:
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ * platform/network/win/ResourceHandleWin.cpp:
+ ResourceHandle no longer includes unneeded NetworkingContext.h and AuthenticationClient.h.
+ This avoids near-world rebuilds on any NetworkingContext change.
+
+ * platform/network/NetworkStorageSession.h: Added.
+ * platform/network/NetworkStorageSessionStub.cpp: Added.
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp: Added.
+ Good new stuff. Stub version just wraps NetworkingContext for platforms that still
+ need to finish the refactoring.
+
+ * platform/network/NetworkingContext.h:
+ The context now has a NetworkStorageSession, and doesn't expose CFNet level objects directly.
+
+ * platform/network/cf/CookieStorageCFNet.cpp:
+ * platform/network/cf/CookieStorageCFNet.h: Removed.
+ We no longer have separate free functions to track storage, it's part of NetworkStorageSession now.
+
+ * platform/network/cf/ResourceHandleCFNet.cpp: Updated to use NetworkStorageSession.
+
+ * platform/network/mac/CookieStorageMac.mm: Dont include CookieStorageCFNet.h, it
+ was not needed.
+
2012-12-22 Nico Weber <thakis@chromium.org>
InlineTextBox: Remove potentially confusing "} if" pattern.
Source/WebCore/platform/network/ProxyServer.h \
Source/WebCore/platform/network/NetworkStateNotifier.cpp \
Source/WebCore/platform/network/NetworkStateNotifier.h \
+ Source/WebCore/platform/network/NetworkStorageSessionStub.cpp \
Source/WebCore/platform/network/ParsedContentType.cpp \
Source/WebCore/platform/network/ParsedContentType.h \
Source/WebCore/platform/network/PlatformCookieJar.h \
platform/network/HTTPValidation.cpp \
platform/network/MIMEHeader.cpp \
platform/network/NetworkStateNotifier.cpp \
+ platform/network/NetworkStorageSessionStub.cpp \
platform/network/ParsedContentType.cpp \
platform/network/ProtectionSpace.cpp \
platform/network/ProxyServer.cpp \
platform/network/HTTPValidation.h \
platform/network/HTTPStatusCodes.h \
platform/network/MIMESniffing.h \
+ platform/network/NetworkStorageSession.h \
platform/network/NetworkingContext.h \
platform/network/NetworkStateNotifier.h \
platform/network/ParsedContentType.h \
__ZN7WebCore12cacheStorageEv
__ZN7WebCore12createMarkupEPKNS_4NodeENS_13EChildrenOnlyEPN3WTF6VectorIPS0_Lm0EEENS_13EAbsoluteURLsEPNS5_INS_13QualifiedNameELm0EEE
__ZN7WebCore12createMarkupEPKNS_5RangeEPN3WTF6VectorIPNS_4NodeELm0EEENS_23EAnnotateForInterchangeEbNS_13EAbsoluteURLsE
-__ZN7WebCore12deleteCookieEPNS_17NetworkingContextERKNS_4KURLERKN3WTF6StringE
+__ZN7WebCore12deleteCookieERKNS_21NetworkStorageSessionERKNS_4KURLERKN3WTF6StringE
__ZN7WebCore12gcControllerEv
__ZN7WebCore12iconDatabaseEv
__ZN7WebCore12toUint8ArrayEN3JSC7JSValueE
__ZN7WebCore13ResourceErrorC1EP9__CFError
__ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDERKN3WTF6StringEb
__ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDEdNS_17CSSPrimitiveValue9UnitTypesEb
-__ZN7WebCore13cookiesForDOMEPNS_17NetworkingContextERKNS_4KURLES4_
+__ZN7WebCore13cookiesForDOMERKNS_21NetworkStorageSessionERKNS_4KURLES5_
__ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE
__ZN7WebCore13directoryNameERKN3WTF6StringE
-__ZN7WebCore13getRawCookiesEPNS_17NetworkingContextERKNS_4KURLES4_RN3WTF6VectorINS_6CookieELm0EEE
+__ZN7WebCore13getRawCookiesERKNS_21NetworkStorageSessionERKNS_4KURLES5_RN3WTF6VectorINS_6CookieELm0EEE
__ZN7WebCore13toArrayBufferEN3JSC7JSValueE
__ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE
__ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE
__ZN7WebCore14DocumentLoader15detachFromFrameEv
__ZN7WebCore14DocumentLoader18addArchiveResourceEN3WTF10PassRefPtrINS_15ArchiveResourceEEE
__ZN7WebCore14ResourceLoader32didCancelAuthenticationChallengeERKNS_23AuthenticationChallengeE
+__ZN7WebCore14cookiesEnabledERKNS_21NetworkStorageSessionERKNS_4KURLES5_
+__ZN7WebCore17setCookiesFromDOMERKNS_21NetworkStorageSessionERKNS_4KURLES5_RKN3WTF6StringE
+__ZN7WebCore21NetworkStorageSession21defaultStorageSessionEv
+__ZN7WebCore21NetworkStorageSession25switchToNewTestingSessionEv
__ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELm1EEENS_22SerializationErrorModeE
__ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueEPN3WTF6VectorINS5_6RefPtrINS_11MessagePortEEELm1EEEPNS6_INS7_INS5_11ArrayBufferEEELm1EEENS_22SerializationErrorModeE
__ZN7WebCore21SerializedScriptValue6createERKN3WTF6StringE
__ZN7WebCore14FrameSelectionC1EPNS_5FrameE
__ZN7WebCore14LoaderStrategy21resourceLoadSchedulerEv
__ZN7WebCore14PluginDocument10pluginNodeEv
-__ZN7WebCore14cookiesEnabledEPNS_17NetworkingContextERKNS_4KURLES4_
__ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv
__ZN7WebCore9FrameView17setTracksRepaintsEb
__ZN7WebCore9FrameView20resetTrackedRepaintsEv
__ZN7WebCore16VisibleSelectionC1ERKNS_15VisiblePositionEb
__ZN7WebCore16createFullMarkupEPKNS_4NodeE
__ZN7WebCore16createFullMarkupEPKNS_5RangeE
-__ZN7WebCore16deleteAllCookiesEPNS_17NetworkingContextE
+__ZN7WebCore16deleteAllCookiesERKNS_21NetworkStorageSessionE
__ZN7WebCore16enclosingIntRectERKNS_9FloatRectE
__ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
__ZN7WebCore16isUserVisibleURLEP8NSString
__ZN7WebCore17ViewportArguments19deprecatedTargetDPIE
__ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE
__ZN7WebCore17openTemporaryFileERKN3WTF6StringERi
-__ZN7WebCore17setCookiesFromDOMEPNS_17NetworkingContextERKNS_4KURLES4_RKN3WTF6StringE
__ZN7WebCore17userVisibleStringEP5NSURL
__ZN7WebCore18DOMWindowExtensionC1EPNS_5FrameEPNS_15DOMWrapperWorldE
__ZN7WebCore18HTMLContentElement6createEPNS_8DocumentE
__ZN7WebCore20SpaceSplitStringDataD1Ev
__ZN7WebCore21BackForwardController11itemAtIndexEi
__ZN7WebCore21MemoryPressureHandler7installEv
+__ZN7WebCore21NetworkStorageSession28createPrivateBrowsingSessionERKN3WTF6StringE
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS_13PlatformEvent4TypeEb
__ZN7WebCore21ResourceLoadScheduler19startResourceLoaderEPNS_14ResourceLoaderE
__ZN7WebCore21ResourceLoadScheduler20servePendingRequestsENS_20ResourceLoadPriorityE
__ZN7WebCore23dataForURLComponentTypeEP5NSURLl
__ZN7WebCore23decodeHostNameWithRangeEP8NSString8_NSRange
__ZN7WebCore23encodeHostNameWithRangeEP8NSString8_NSRange
-__ZN7WebCore23getHostnamesWithCookiesEPNS_17NetworkingContextERN3WTF7HashSetINS2_6StringENS2_10StringHashENS2_10HashTraitsIS4_EEEE
+__ZN7WebCore23getHostnamesWithCookiesERKNS_21NetworkStorageSessionERN3WTF7HashSetINS3_6StringENS3_10StringHashENS3_10HashTraitsIS5_EEEE
__ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv
__ZN7WebCore24CachedResourceHandleBase11setResourceEPNS_14CachedResourceE
__ZN7WebCore24ComposedShadowTreeWalker10firstChildEv
__ZN7WebCore24FrameDestructionObserverD2Ev
__ZN7WebCore24createFragmentFromMarkupEPNS_8DocumentERKN3WTF6StringES5_NS_27FragmentScriptingPermissionE
__ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE
-__ZN7WebCore24deleteCookiesForHostnameEPNS_17NetworkingContextERKN3WTF6StringE
+__ZN7WebCore24deleteCookiesForHostnameERKNS_21NetworkStorageSessionERKN3WTF6StringE
__ZN7WebCore24fileSystemRepresentationERKN3WTF6StringE
__ZN7WebCore24notifyHistoryItemChangedE
__ZN7WebCore25HistoryPropertyListWriter11releaseDataEv
__ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_21DeviceOrientationDataEEE
__ZN7WebCore27DeviceOrientationClientMockC1Ev
__ZN7WebCore27startObservingCookieChangesEv
-__ZN7WebCore26defaultCFHTTPCookieStorageEv
__ZN7WebCore28encodeWithURLEscapeSequencesERKN3WTF6StringE
__ZN7WebCore28removeLanguageChangeObserverEPv
-__ZN7WebCore29cookieRequestHeaderFieldValueEPNS_17NetworkingContextERKNS_4KURLES4_
+__ZN7WebCore29cookieRequestHeaderFieldValueERKNS_21NetworkStorageSessionERKNS_4KURLES5_
__ZN7WebCore29isCharacterSmartReplaceExemptEib
__ZN7WebCore30hostNameNeedsDecodingWithRangeEP8NSString8_NSRange
__ZN7WebCore30hostNameNeedsEncodingWithRangeEP8NSString8_NSRange
__ZNK7WebCore20ResourceResponseBase8mimeTypeEv
__ZNK7WebCore21BackForwardController12forwardCountEv
__ZNK7WebCore21BackForwardController9backCountEv
+__ZNK7WebCore21NetworkStorageSession13cookieStorageEv
__ZNK7WebCore21RenderLayerCompositor11scrollLayerEv
__ZNK7WebCore21RenderLayerCompositor15rootRenderLayerEv
__ZNK7WebCore21UserContentURLPattern7matchesERKNS_4KURLE
'platform/network/MIMEHeader.cpp',
'platform/network/NetworkStateNotifier.cpp',
'platform/network/NetworkStateNotifier.h',
+ 'platform/network/NetworkStorageSessionStub.cpp',
'platform/network/ParsedContentType.cpp',
'platform/network/ParsedContentType.h',
'platform/network/ProtectionSpace.cpp',
'platform/network/cf/AuthenticationCF.h',
'platform/network/cf/CookieJarCFNet.cpp',
'platform/network/cf/CookieStorageCFNet.cpp',
- 'platform/network/cf/CookieStorageCFNet.h',
'platform/network/cf/CredentialStorageCFNet.cpp',
'platform/network/cf/DNSCFNet.cpp',
'platform/network/cf/DownloadBundle.h',
>
</File>
<File
+ RelativePath="..\platform\network\NetworkStorageSession.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\network\NetworkingContext.h"
>
</File>
</FileConfiguration>
</File>
<File
- RelativePath="..\platform\network\cf\CookieStorageCFNet.h"
- >
- </File>
- <File
RelativePath="..\platform\network\cf\CredentialStorageCFNet.cpp"
>
<FileConfiguration
>
</File>
<File
+ RelativePath="..\platform\network\cf\NetworkStorageSessionCFNet.cpp"
+ >
+ </File>
+ <File
RelativePath="..\platform\network\cf\ProxyServerCFNet.cpp"
>
<FileConfiguration
7EE6846112D26E3800E79415 /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
7EE6846212D26E3800E79415 /* CookieJarCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */; };
7EE6846312D26E3800E79415 /* CookieStorageCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */; };
- 7EE6846412D26E3800E79415 /* CookieStorageCFNet.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845112D26E3800E79415 /* CookieStorageCFNet.h */; settings = {ATTRIBUTES = (Private, ); }; };
7EE6846512D26E3800E79415 /* CredentialStorageCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845212D26E3800E79415 /* CredentialStorageCFNet.cpp */; };
7EE6846612D26E3800E79415 /* FormDataStreamCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845312D26E3800E79415 /* FormDataStreamCFNet.cpp */; };
7EE6846712D26E3800E79415 /* FormDataStreamCFNet.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845412D26E3800E79415 /* FormDataStreamCFNet.h */; };
E134F5AB12EE343F004EC58D /* IntRectHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E134F5AA12EE343F004EC58D /* IntRectHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
E139866315478474001E3F65 /* StyleResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E139866115478474001E3F65 /* StyleResolver.cpp */; };
E139866415478474001E3F65 /* StyleResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = E139866215478474001E3F65 /* StyleResolver.h */; };
+ E13EF3441684ECF40034C83F /* NetworkStorageSession.h in Headers */ = {isa = PBXBuildFile; fileRef = E13EF3421684ECF40034C83F /* NetworkStorageSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E13EF34916850C470034C83F /* NetworkStorageSessionCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E13EF34716850C470034C83F /* NetworkStorageSessionCFNet.cpp */; };
E13F01F11270E19000DFBA71 /* CookieStorageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E13F01F01270E19000DFBA71 /* CookieStorageMac.mm */; };
E1424C8A164B3B4E00F32D40 /* PlatformCookieJar.h in Headers */ = {isa = PBXBuildFile; fileRef = E1424C89164B3B4E00F32D40 /* PlatformCookieJar.h */; settings = {ATTRIBUTES = (Private, ); }; };
E1424C90164B460B00F32D40 /* CookieJarMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1424C8F164B460B00F32D40 /* CookieJarMac.mm */; };
7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallenge.h; sourceTree = "<group>"; };
7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieJarCFNet.cpp; sourceTree = "<group>"; };
7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieStorageCFNet.cpp; sourceTree = "<group>"; };
- 7EE6845112D26E3800E79415 /* CookieStorageCFNet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CookieStorageCFNet.h; sourceTree = "<group>"; };
7EE6845212D26E3800E79415 /* CredentialStorageCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CredentialStorageCFNet.cpp; sourceTree = "<group>"; };
7EE6845312D26E3800E79415 /* FormDataStreamCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormDataStreamCFNet.cpp; sourceTree = "<group>"; };
7EE6845412D26E3800E79415 /* FormDataStreamCFNet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormDataStreamCFNet.h; sourceTree = "<group>"; };
E134F5AA12EE343F004EC58D /* IntRectHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntRectHash.h; sourceTree = "<group>"; };
E139866115478474001E3F65 /* StyleResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleResolver.cpp; sourceTree = "<group>"; };
E139866215478474001E3F65 /* StyleResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleResolver.h; sourceTree = "<group>"; };
+ E13EF3421684ECF40034C83F /* NetworkStorageSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkStorageSession.h; sourceTree = "<group>"; };
+ E13EF34716850C470034C83F /* NetworkStorageSessionCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkStorageSessionCFNet.cpp; sourceTree = "<group>"; };
E13F01EA1270E10D00DFBA71 /* CookieStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CookieStorage.h; sourceTree = "<group>"; };
E13F01F01270E19000DFBA71 /* CookieStorageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CookieStorageMac.mm; sourceTree = "<group>"; };
E1424C89164B3B4E00F32D40 /* PlatformCookieJar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformCookieJar.h; path = network/PlatformCookieJar.h; sourceTree = "<group>"; };
37DDCD9213844FD50008B793 /* MIMEHeader.cpp */,
37DDCD9313844FD50008B793 /* MIMEHeader.h */,
628D214B12131ED10055DCFC /* NetworkingContext.h */,
+ E13EF3421684ECF40034C83F /* NetworkStorageSession.h */,
1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */,
1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */,
447958021643B47B001E0A7F /* ParsedContentType.cpp */,
7EE6844E12D26E3800E79415 /* AuthenticationChallenge.h */,
7EE6844F12D26E3800E79415 /* CookieJarCFNet.cpp */,
7EE6845012D26E3800E79415 /* CookieStorageCFNet.cpp */,
- 7EE6845112D26E3800E79415 /* CookieStorageCFNet.h */,
7EE6845212D26E3800E79415 /* CredentialStorageCFNet.cpp */,
B2F34FE80E82F82700F627CD /* DNSCFNet.cpp */,
7EE6845312D26E3800E79415 /* FormDataStreamCFNet.cpp */,
7EE6845412D26E3800E79415 /* FormDataStreamCFNet.h */,
7EE6845512D26E3800E79415 /* LoaderRunLoopCF.cpp */,
7EE6845612D26E3800E79415 /* LoaderRunLoopCF.h */,
+ E13EF34716850C470034C83F /* NetworkStorageSessionCFNet.cpp */,
1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */,
7EE6845712D26E3800E79415 /* ResourceError.h */,
7EE6845812D26E3800E79415 /* ResourceErrorCF.cpp */,
D8B6152F1032495100C8554A /* Cookie.h in Headers */,
339B5B63131DAA3200F48D02 /* CookiesStrategy.h in Headers */,
33D0212D131DB37B004091A8 /* CookieStorage.h in Headers */,
- 7EE6846412D26E3800E79415 /* CookieStorageCFNet.h in Headers */,
FE6FD4880F676E5700092873 /* Coordinates.h in Headers */,
A80E6D040A1989CA007FB8C5 /* Counter.h in Headers */,
BC5EB9790E82069200B25965 /* CounterContent.h in Headers */,
F37A56231679CF7B00C57046 /* HeapGraphSerializer.h in Headers */,
0FB8890A167D2FA10010CDA5 /* ScrollingTreeStickyNode.h in Headers */,
0FB8890F167D30160010CDA5 /* ScrollingStateStickyNode.h in Headers */,
+ E13EF3441684ECF40034C83F /* NetworkStorageSession.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0FB8890B167D2FA10010CDA5 /* ScrollingTreeStickyNode.mm in Sources */,
0FB8890E167D30160010CDA5 /* ScrollingStateStickyNode.cpp in Sources */,
209B456B16796A7E00E54E4E /* JSCryptoCustom.cpp in Sources */,
+ E13EF34916850C470034C83F /* NetworkStorageSessionCFNet.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#include "Document.h"
#include "Frame.h"
+#include "NetworkingContext.h"
#include "PlatformCookieJar.h"
#if USE(PLATFORM_STRATEGIES)
static NetworkingContext* networkingContext(const Document* document)
{
+ // FIXME: Returning 0 means falling back to default context. That's not a choice that is appropriate to do at runtime
if (!document)
return 0;
Frame* frame = document->frame();
return loader->networkingContext();
}
+#if PLATFORM(MAC) || USE(CFNETWORK)
+inline NetworkStorageSession& storageSession(const Document* document)
+{
+ NetworkingContext* context = networkingContext(document);
+ return context ? context->storageSession() : NetworkStorageSession::defaultStorageSession();
+}
+#define SESSION(document) storageSession(document)
+#else
+#define SESSION(document) NetworkStorageSession(networkingContext(document))
+#endif
+
String cookies(const Document* document, const KURL& url)
{
#if USE(PLATFORM_STRATEGIES)
- return platformStrategies()->cookiesStrategy()->cookiesForDOM(networkingContext(document), document->firstPartyForCookies(), url);
+ return platformStrategies()->cookiesStrategy()->cookiesForDOM(SESSION(document), document->firstPartyForCookies(), url);
#else
- return cookiesForDOM(networkingContext(document), document->firstPartyForCookies(), url);
+ return cookiesForDOM(SESSION(document), document->firstPartyForCookies(), url);
#endif
}
void setCookies(Document* document, const KURL& url, const String& cookieString)
{
#if USE(PLATFORM_STRATEGIES)
- platformStrategies()->cookiesStrategy()->setCookiesFromDOM(networkingContext(document), document->firstPartyForCookies(), url, cookieString);
+ platformStrategies()->cookiesStrategy()->setCookiesFromDOM(SESSION(document), document->firstPartyForCookies(), url, cookieString);
#else
- setCookiesFromDOM(networkingContext(document), document->firstPartyForCookies(), url, cookieString);
+ setCookiesFromDOM(SESSION(document), document->firstPartyForCookies(), url, cookieString);
#endif
}
bool cookiesEnabled(const Document* document)
{
#if USE(PLATFORM_STRATEGIES)
- return platformStrategies()->cookiesStrategy()->cookiesEnabled(networkingContext(document), document->firstPartyForCookies(), document->cookieURL());
+ return platformStrategies()->cookiesStrategy()->cookiesEnabled(SESSION(document), document->firstPartyForCookies(), document->cookieURL());
#else
- return cookiesEnabled(networkingContext(document), document->firstPartyForCookies(), document->cookieURL());
+ return cookiesEnabled(SESSION(document), document->firstPartyForCookies(), document->cookieURL());
#endif
}
String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
{
#if USE(PLATFORM_STRATEGIES)
- return platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(networkingContext(document), document->firstPartyForCookies(), url);
+ return platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(SESSION(document), document->firstPartyForCookies(), url);
#else
- return cookieRequestHeaderFieldValue(networkingContext(document), document->firstPartyForCookies(), url);
+ return cookieRequestHeaderFieldValue(SESSION(document), document->firstPartyForCookies(), url);
#endif
}
bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& cookies)
{
#if USE(PLATFORM_STRATEGIES)
- return platformStrategies()->cookiesStrategy()->getRawCookies(networkingContext(document), document->firstPartyForCookies(), url, cookies);
+ return platformStrategies()->cookiesStrategy()->getRawCookies(SESSION(document), document->firstPartyForCookies(), url, cookies);
#else
- return getRawCookies(networkingContext(document), document->firstPartyForCookies(), url, cookies);
+ return getRawCookies(SESSION(document), document->firstPartyForCookies(), url, cookies);
#endif
}
void deleteCookie(const Document* document, const KURL& url, const String& cookieName)
{
#if USE(PLATFORM_STRATEGIES)
- platformStrategies()->cookiesStrategy()->deleteCookie(networkingContext(document), url, cookieName);
+ platformStrategies()->cookiesStrategy()->deleteCookie(SESSION(document), url, cookieName);
#else
- deleteCookie(networkingContext(document), url, cookieName);
+ deleteCookie(SESSION(document), url, cookieName);
#endif
}
#include "ApplicationCacheHost.h"
#include "AsyncFileStream.h"
+#include "AuthenticationChallenge.h"
#include "DocumentLoader.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "CachePolicy.h"
#include "FrameLoaderTypes.h"
#include "PurgePriority.h"
+#include "ResourceError.h"
#include "ResourceLoadPriority.h"
#include "ResourceLoaderOptions.h"
#include "ResourceRequest.h"
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
-#if PLATFORM(MAC) || USE(CFNETWORK)
-typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
-#endif
-
namespace WebCore {
class KURL;
-class NetworkingContext;
+class NetworkStorageSession;
struct Cookie;
class CookiesStrategy {
public:
virtual void notifyCookiesChanged() = 0;
-#if PLATFORM(MAC) || USE(CFNETWORK)
- virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage() = 0;
-#endif
-
- virtual String cookiesForDOM(NetworkingContext*, const KURL& firstParty, const KURL&) = 0;
- virtual void setCookiesFromDOM(NetworkingContext*, const KURL& firstParty, const KURL&, const String& cookieString) = 0;
- virtual bool cookiesEnabled(NetworkingContext*, const KURL& firstParty, const KURL&) = 0;
- virtual String cookieRequestHeaderFieldValue(NetworkingContext*, const KURL& firstParty, const KURL&) = 0;
- virtual bool getRawCookies(NetworkingContext*, const KURL& firstParty, const KURL&, Vector<Cookie>&) = 0;
- virtual void deleteCookie(NetworkingContext*, const KURL&, const String& cookieName) = 0;
+ virtual String cookiesForDOM(const NetworkStorageSession&, const KURL& firstParty, const KURL&) = 0;
+ virtual void setCookiesFromDOM(const NetworkStorageSession&, const KURL& firstParty, const KURL&, const String& cookieString) = 0;
+ virtual bool cookiesEnabled(const NetworkStorageSession&, const KURL& firstParty, const KURL&) = 0;
+ virtual String cookieRequestHeaderFieldValue(const NetworkStorageSession&, const KURL& firstParty, const KURL&) = 0;
+ virtual bool getRawCookies(const NetworkStorageSession&, const KURL& firstParty, const KURL&, Vector<Cookie>&) = 0;
+ virtual void deleteCookie(const NetworkStorageSession&, const KURL&, const String& cookieName) = 0;
protected:
virtual ~CookiesStrategy() { }
#include "FileSystem.h"
#include "HTTPParsers.h"
#include "KURL.h"
+#include "NetworkingContext.h"
#include "ResourceError.h"
#include "ResourceHandleClient.h"
#include "ResourceRequest.h"
--- /dev/null
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetworkStorageSession_h
+#define NetworkStorageSession_h
+
+#include <wtf/RetainPtr.h>
+#include <wtf/text/WTFString.h>
+
+#if PLATFORM(MAC) || USE(CFNETWORK)
+typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
+#endif
+
+namespace WebCore {
+
+class NetworkingContext;
+
+class NetworkStorageSession {
+ WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED;
+public:
+ static NetworkStorageSession& defaultStorageSession();
+ static PassOwnPtr<NetworkStorageSession> createDefaultSession(const String& identifierBase);
+ static PassOwnPtr<NetworkStorageSession> createPrivateBrowsingSession(const String& identifierBase);
+
+ static void switchToNewTestingSession();
+
+#if PLATFORM(MAC) || USE(CFNETWORK)
+ // May be null, in which case a Foundation default should be used.
+ CFURLStorageSessionRef platformSession() { return m_platformSession.get(); }
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const;
+ bool isPrivateBrowsingSession() const { return m_isPrivate; }
+#else
+ NetworkStorageSession(NetworkingContext*);
+ ~NetworkStorageSession();
+ NetworkingContext* context() const;
+#endif
+
+private:
+#if PLATFORM(MAC) || USE(CFNETWORK)
+ NetworkStorageSession(CFURLStorageSessionRef platformSession);
+ NetworkStorageSession();
+ RetainPtr<CFURLStorageSessionRef> m_platformSession;
+ bool m_isPrivate;
+#else
+ RefPtr<NetworkingContext> m_context;
+#endif
+};
+
+#if PLATFORM(WIN)
+// Needed for WebKit1 API only.
+void overrideCookieStorage(CFHTTPCookieStorageRef);
+CFHTTPCookieStorageRef overridenCookieStorage();
+#endif
+
+}
+
+#endif // NetworkStorageSession_h
*/
#include "config.h"
-#include "WebPlatformStrategies.h"
+#include "NetworkStorageSession.h"
-#include "WebFrameNetworkingContext.h"
-#include <WebKitSystemInterface.h>
+#include "NetworkingContext.h"
+#include <wtf/PassOwnPtr.h>
-using namespace WebCore;
+namespace WebCore {
-namespace WebKit {
+NetworkStorageSession::NetworkStorageSession(NetworkingContext* context)
+ : m_context(context)
+{
+}
+
+NetworkStorageSession::~NetworkStorageSession()
+{
+}
+
+NetworkingContext* NetworkStorageSession::context() const
+{
+ return m_context.get();
+}
-RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage()
+PassOwnPtr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(const String&)
{
- if (CFURLStorageSessionRef session = WebFrameNetworkingContext::defaultStorageSession())
- return adoptCF(WKCopyHTTPCookieStorage(session));
-
-#if USE(CFNETWORK)
- return WKGetDefaultHTTPCookieStorage();
-#else
- // When using NSURLConnection, we also use its shared cookie storage.
- return 0;
-#endif
+ ASSERT_NOT_REACHED();
+ return nullptr;
}
-} // namespace WebKit
+NetworkStorageSession& NetworkStorageSession::defaultStorageSession()
+{
+ DEFINE_STATIC_LOCAL(NetworkStorageSession, session, (0));
+ return session;
+}
+
+void NetworkStorageSession::switchToNewTestingSession()
+{
+}
+
+}
#ifndef NetworkingContext_h
#define NetworkingContext_h
+#include "NetworkStorageSession.h"
#include <wtf/RefCounted.h>
+#include <wtf/RetainPtr.h>
#if PLATFORM(MAC)
#include "SchedulePair.h"
OBJC_CLASS NSOperationQueue;
#endif
-#if PLATFORM(MAC) || USE(CFNETWORK)
-typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
-#endif
-
#if PLATFORM(QT)
QT_BEGIN_NAMESPACE
class QObject;
virtual bool isValid() const { return true; }
#if PLATFORM(CHROMIUM)
+ // FIXME: Wrap WebCookieJar into a NetworkStorageSession to make the code cross-platform.
virtual WebKit::WebCookieJar* cookieJar() const = 0;
#endif
#endif
#if PLATFORM(MAC) || USE(CFNETWORK)
- virtual bool inPrivateBrowsingMode() const = 0;
- virtual CFURLStorageSessionRef storageSession() const = 0;
+
+ virtual NetworkStorageSession& storageSession() const = 0;
#endif
#if PLATFORM(QT)
+ // FIXME: Wrap QNetworkAccessManager into a NetworkStorageSession to make the code cross-platform.
virtual QObject* originatingObject() const = 0;
virtual QNetworkAccessManager* networkAccessManager() const = 0;
virtual bool mimeSniffingEnabled() const = 0;
#endif
#if USE(SOUP)
+ // FIXME: Wrap SoupSession into a NetworkStorageSession to make the code cross-platform.
virtual SoupSession* soupSession() const = 0;
virtual uint64_t initiatingPageID() const = 0;
#endif
/*
- * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2008, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
class KURL;
-class NetworkingContext;
+class NetworkStorageSession;
struct Cookie;
-// If networking context is null, default cookie storage is used.
-String cookiesForDOM(NetworkingContext*, const KURL& firstParty, const KURL&);
-void setCookiesFromDOM(NetworkingContext*, const KURL& firstParty, const KURL&, const String&);
-bool cookiesEnabled(NetworkingContext*, const KURL& firstParty, const KURL&);
-String cookieRequestHeaderFieldValue(NetworkingContext*, const KURL& firstParty, const KURL&);
-bool getRawCookies(NetworkingContext*, const KURL& firstParty, const KURL&, Vector<Cookie>&);
-void deleteCookie(NetworkingContext*, const KURL&, const String&);
-void getHostnamesWithCookies(NetworkingContext*, HashSet<String>& hostnames);
-void deleteCookiesForHostname(NetworkingContext*, const String& hostname);
-void deleteAllCookies(NetworkingContext*);
+// FIXME: These should probably be NetworkStorageSession member functions.
+
+String cookiesForDOM(const NetworkStorageSession&, const KURL& firstParty, const KURL&);
+void setCookiesFromDOM(const NetworkStorageSession&, const KURL& firstParty, const KURL&, const String&);
+bool cookiesEnabled(const NetworkStorageSession&, const KURL& firstParty, const KURL&);
+String cookieRequestHeaderFieldValue(const NetworkStorageSession&, const KURL& firstParty, const KURL&);
+bool getRawCookies(const NetworkStorageSession&, const KURL& firstParty, const KURL&, Vector<Cookie>&);
+void deleteCookie(const NetworkStorageSession&, const KURL&, const String&);
+void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames);
+void deleteCookiesForHostname(const NetworkStorageSession&, const String& hostname);
+void deleteAllCookies(const NetworkStorageSession&);
}
#include "BlobRegistry.h"
#include "Logging.h"
+#include "NetworkingContext.h"
#include "ResourceHandleClient.h"
#include "Timer.h"
#include <algorithm>
#ifndef ResourceHandle_h
#define ResourceHandle_h
-#include "AuthenticationChallenge.h"
#include "AuthenticationClient.h"
#include "HTTPHeaderMap.h"
-#include "NetworkingContext.h"
#include <wtf/OwnPtr.h>
+#include <wtf/RefCounted.h>
#if USE(SOUP)
+typedef struct _GTlsCertificate GTlsCertificate;
typedef struct _SoupSession SoupSession;
typedef struct _SoupRequest SoupRequest;
#endif
class Credential;
class Frame;
class KURL;
+class NetworkingContext;
class ProtectionSpace;
class ResourceError;
class ResourceHandleClient;
#ifndef ResourceHandleInternal_h
#define ResourceHandleInternal_h
+#include "NetworkingContext.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "AuthenticationChallenge.h"
#if USE(CFNETWORK)
#include "Cookie.h"
-#include "CookieStorageCFNet.h"
#include "KURL.h"
-#include "NetworkingContext.h"
+#include "NetworkStorageSession.h"
#include "ResourceHandle.h"
#include "SoftLinking.h"
#include <CFNetwork/CFHTTPCookiesPriv.h>
return filteredCookies;
}
-void setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& value)
+void setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& value)
{
// <rdar://problem/5632883> CFHTTPCookieStorage stores an empty cookie, which would be sent as "Cookie: =".
if (value.isEmpty())
return;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
-
RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
RetainPtr<CFURLRef> firstPartyForCookiesCF(AdoptCF, firstParty.createCFURL());
RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
headerFieldsCF.get(), urlCF.get()));
- CFHTTPCookieStorageSetCookies(cookieStorage.get(), filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
+ CFHTTPCookieStorageSetCookies(session.cookieStorage().get(), filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
}
-String cookiesForDOM(NetworkingContext* context, const KURL&, const KURL& url)
+String cookiesForDOM(const NetworkStorageSession& session, const KURL&, const KURL& url)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
-
RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
bool secure = url.protocolIs("https");
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage.get(), urlCF.get(), secure));
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, filterCookies(cookiesCF.get()).get()));
return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
}
-String cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url)
+String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
-
RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
bool secure = url.protocolIs("https");
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage.get(), urlCF.get(), secure));
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
}
-bool cookiesEnabled(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/)
+bool cookiesEnabled(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
-
- CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageGetCookieAcceptPolicy(cookieStorage.get());
+ CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageGetCookieAcceptPolicy(session.cookieStorage().get());
return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways;
}
-bool getRawCookies(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url, Vector<Cookie>& rawCookies)
+bool getRawCookies(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url, Vector<Cookie>& rawCookies)
{
rawCookies.clear();
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
bool sendSecureCookies = url.protocolIs("https");
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage.get(), urlCF.get(), sendSecureCookies));
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), sendSecureCookies));
CFIndex count = CFArrayGetCount(cookiesCF.get());
rawCookies.reserveCapacity(count);
return true;
}
-void deleteCookie(NetworkingContext* context, const KURL& url, const String& name)
+void deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& name)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
}
}
-void getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames)
+void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
-
- RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookies(cookieStorage.get()));
+ RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookies(session.cookieStorage().get()));
if (!cookiesCF)
return;
}
}
-void deleteCookiesForHostname(NetworkingContext* context, const String& hostname)
+void deleteCookiesForHostname(const NetworkStorageSession& session, const String& hostname)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookies(cookieStorage.get()));
if (!cookiesCF)
}
}
-void deleteAllCookies(NetworkingContext* context)
+void deleteAllCookies(const NetworkStorageSession& session)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- ASSERT(cookieStorage);
-
- CFHTTPCookieStorageDeleteAllCookies(cookieStorage.get());
+ CFHTTPCookieStorageDeleteAllCookies(session.cookieStorage().get());
}
} // namespace WebCore
#include "config.h"
#include "CookieStorage.h"
-#include "CookieStorageCFNet.h"
-
-#include "ResourceHandle.h"
+#include "NetworkStorageSession.h"
#include <wtf/MainThread.h>
#if PLATFORM(MAC)
#if PLATFORM(WIN)
-static RetainPtr<CFHTTPCookieStorageRef>& cookieStorageOverride()
-{
- DEFINE_STATIC_LOCAL(RetainPtr<CFHTTPCookieStorageRef>, cookieStorage, ());
- return cookieStorage;
-}
-
-#endif
-
-RetainPtr<CFHTTPCookieStorageRef> currentCFHTTPCookieStorage(NetworkingContext* context)
-{
-#if PLATFORM(WIN)
- if (RetainPtr<CFHTTPCookieStorageRef>& override = cookieStorageOverride())
- return override;
-#endif
-
- if (CFURLStorageSessionRef session = context->storageSession())
- return RetainPtr<CFHTTPCookieStorageRef>(AdoptCF, wkCopyHTTPCookieStorage(session));
-
-#if USE(CFNETWORK)
- return wkGetDefaultHTTPCookieStorage();
-#else
- // When using NSURLConnection, we also use its shared cookie storage.
- return 0;
-#endif
-}
-
-RetainPtr<CFHTTPCookieStorageRef> defaultCFHTTPCookieStorage()
-{
-#if PLATFORM(WIN)
- if (RetainPtr<CFHTTPCookieStorageRef>& override = cookieStorageOverride())
- return override;
-#endif
-
- return platformStrategies()->cookiesStrategy()->defaultCookieStorage();
-}
-
-#if PLATFORM(WIN)
-
-void overrideCookieStorage(CFHTTPCookieStorageRef cookieStorage)
-{
- ASSERT(isMainThread());
- // FIXME: Why don't we retain it? The only caller is an API method that takes cookie storage as a raw argument.
- cookieStorageOverride().adoptCF(cookieStorage);
-}
-
-CFHTTPCookieStorageRef overridenCookieStorage()
-{
- return cookieStorageOverride().get();
-}
-
static void notifyCookiesChangedOnMainThread(void*)
{
ASSERT(isMainThread());
CFRunLoopRef runLoop = cookieStorageObserverRunLoop();
ASSERT(runLoop);
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = defaultCFHTTPCookieStorage();
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage();
ASSERT(cookieStorage);
CFHTTPCookieStorageScheduleWithRunLoop(cookieStorage.get(), runLoop, kCFRunLoopCommonModes);
CFRunLoopRef runLoop = cookieStorageObserverRunLoop();
ASSERT(runLoop);
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = defaultCFHTTPCookieStorage();
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage();
ASSERT(cookieStorage);
CFHTTPCookieStorageRemoveObserver(cookieStorage.get(), runLoop, kCFRunLoopDefaultMode, notifyCookiesChanged, 0);
+++ /dev/null
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CookieStorageCFNet_h
-#define CookieStorageCFNet_h
-
-#include <wtf/RetainPtr.h>
-
-typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
-
-namespace WebCore {
-
-class NetworkingContext;
-
-RetainPtr<CFHTTPCookieStorageRef> currentCFHTTPCookieStorage(NetworkingContext*); // Will be null when using shared NSHTTPCookieStorage.
-RetainPtr<CFHTTPCookieStorageRef> defaultCFHTTPCookieStorage(); // Doesn't take current session into account.
-
-#if PLATFORM(WIN)
-// Needed for WebKit1 API only.
-void overrideCookieStorage(CFHTTPCookieStorageRef);
-CFHTTPCookieStorageRef overridenCookieStorage();
-#endif
-
-}
-
-#endif // CookieStorageCFNet_h
--- /dev/null
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkStorageSession.h"
+
+#include <wtf/MainThread.h>
+#include <wtf/PassOwnPtr.h>
+
+#if PLATFORM(MAC)
+#include "WebCoreSystemInterface.h"
+#else
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
+namespace WebCore {
+
+NetworkStorageSession::NetworkStorageSession(CFURLStorageSessionRef platformSession)
+ : m_platformSession(platformSession)
+ , m_isPrivate(false)
+{
+}
+
+static OwnPtr<NetworkStorageSession>& defaultNetworkStorageSession()
+{
+ ASSERT(isMainThread());
+ DEFINE_STATIC_LOCAL(OwnPtr<NetworkStorageSession>, session, ());
+ return session;
+}
+
+void NetworkStorageSession::switchToNewTestingSession()
+{
+ // Set a private session for testing to avoid interfering with global cookies. This should be different from private browsing session.
+ // FIXME: It looks like creating a new session with the same identifier may be just creating a reference to the same storage. See <rdar://problem/11571450> and <rdar://problem/12384380>.
+#if PLATFORM(MAC)
+ defaultNetworkStorageSession() = adoptPtr(new NetworkStorageSession(wkCreatePrivateStorageSession(CFSTR("Private WebKit Session"))));
+#else
+ defaultNetworkStorageSession() = adoptPtr(new NetworkStorageSession(wkCreatePrivateStorageSession(CFSTR("Private WebKit Session"), defaultNetworkStorageSession()->platformSession())));
+#endif
+}
+
+#if PLATFORM(WIN)
+static RetainPtr<CFHTTPCookieStorageRef>& cookieStorageOverride()
+{
+ DEFINE_STATIC_LOCAL(RetainPtr<CFHTTPCookieStorageRef>, cookieStorage, ());
+ return cookieStorage;
+}
+
+void overrideCookieStorage(CFHTTPCookieStorageRef cookieStorage)
+{
+ ASSERT(isMainThread());
+ // FIXME: Why don't we retain it? The only caller is an API method that takes cookie storage as a raw argument.
+ cookieStorageOverride().adoptCF(cookieStorage);
+}
+
+CFHTTPCookieStorageRef overridenCookieStorage()
+{
+ return cookieStorageOverride().get();
+}
+#endif
+
+NetworkStorageSession& NetworkStorageSession::defaultStorageSession()
+{
+ if (!defaultNetworkStorageSession())
+ defaultNetworkStorageSession() = adoptPtr(new NetworkStorageSession(0));
+ return *defaultNetworkStorageSession();
+}
+
+PassOwnPtr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(const String& identifierBase)
+{
+ RetainPtr<CFStringRef> cfIdentifier = String(identifierBase + ".PrivateBrowsing").createCFString();
+
+#if PLATFORM(MAC)
+ OwnPtr<NetworkStorageSession> session = adoptPtr(new NetworkStorageSession(wkCreatePrivateStorageSession(cfIdentifier.get())));
+#else
+ OwnPtr<NetworkStorageSession> session = adoptPtr(new NetworkStorageSession(wkCreatePrivateStorageSession(cfIdentifier.get(), defaultNetworkStorageSession()->platformSession())));
+#endif
+ session->m_isPrivate = true;
+
+ return session.release();
+}
+
+RetainPtr<CFHTTPCookieStorageRef> NetworkStorageSession::cookieStorage() const
+{
+#if PLATFORM(WIN)
+ if (RetainPtr<CFHTTPCookieStorageRef>& override = cookieStorageOverride())
+ return override;
+#endif
+
+ if (m_platformSession)
+ return RetainPtr<CFHTTPCookieStorageRef>(AdoptCF, wkCopyHTTPCookieStorage(m_platformSession.get()));
+
+#if USE(CFNETWORK)
+ return wkGetDefaultHTTPCookieStorage();
+#else
+ // When using NSURLConnection, we also use its shared cookie storage.
+ return 0;
+#endif
+}
+
+}
#include "AuthenticationCF.h"
#include "AuthenticationChallenge.h"
-#include "CookieStorageCFNet.h"
#include "CredentialStorage.h"
#include "CachedResourceLoader.h"
#include "FormDataStreamCFNet.h"
#include "LoaderRunLoopCF.h"
#include "Logging.h"
#include "MIMETypeRegistry.h"
+#include "NetworkingContext.h"
#include "ResourceError.h"
#include "ResourceHandleClient.h"
#include "ResourceResponse.h"
{
// If a URL already has cookies, then we'll relax the 3rd party cookie policy and accept new cookies.
- RetainPtr<CFHTTPCookieStorageRef> cfCookieStorage = currentCFHTTPCookieStorage(context);
+ RetainPtr<CFHTTPCookieStorageRef> cfCookieStorage = context->storageSession().cookieStorage();
CFHTTPCookieStorageAcceptPolicy cookieAcceptPolicy = CFHTTPCookieStorageGetCookieAcceptPolicy(cfCookieStorage.get());
if (cookieAcceptPolicy != CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain)
if (!context->isValid())
return false;
- d->m_storageSession = context->storageSession();
+ d->m_storageSession = context->storageSession().platformSession();
bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
- handle->d->m_storageSession = context->storageSession();
+ handle->d->m_storageSession = context->storageSession().platformSession();
if (handle->d->m_scheduledFailureType != NoFailure) {
error = context->blockedError(request);
namespace WebCore {
-void setCookiesFromDOM(NetworkingContext* context, const KURL& firstPartyForCookies, const KURL& url, const String& cookieStr)
+void setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstPartyForCookies, const KURL& url, const String& cookieStr)
{
- if (!context)
+ if (!session.context())
return;
- WebKit::WebCookieJar* cookieJar = context->cookieJar();
+ WebKit::WebCookieJar* cookieJar = session.context()->cookieJar();
if (cookieJar)
cookieJar->setCookie(url, firstPartyForCookies, cookieStr);
}
-String cookiesForDOM(NetworkingContext* context, const KURL& firstPartyForCookies, const KURL& url)
+String cookiesForDOM(const NetworkStorageSession& session, const KURL& firstPartyForCookies, const KURL& url)
{
- if (!context)
+ if (!session.context())
return String();
String result;
- WebKit::WebCookieJar* cookieJar = context->cookieJar();
+ WebKit::WebCookieJar* cookieJar = session.context()->cookieJar();
if (cookieJar)
result = cookieJar->cookies(url, firstPartyForCookies);
return result;
}
-String cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstPartyForCookies, const KURL& url)
+String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstPartyForCookies, const KURL& url)
{
- if (!context)
+ if (!session.context())
return String();
String result;
- WebKit::WebCookieJar* cookieJar = context->cookieJar();
+ WebKit::WebCookieJar* cookieJar = session.context()->cookieJar();
if (cookieJar)
result = cookieJar->cookieRequestHeaderFieldValue(url, firstPartyForCookies);
return result;
}
-bool cookiesEnabled(NetworkingContext* context, const KURL& cookieURL, const KURL& firstPartyForCookies)
+bool cookiesEnabled(const NetworkStorageSession& session, const KURL& cookieURL, const KURL& firstPartyForCookies)
{
bool result = false;
- if (!context)
+ if (!session.context())
return result;
- WebKit::WebCookieJar* cookieJar = context->cookieJar();
+ WebKit::WebCookieJar* cookieJar = session.context()->cookieJar();
if (cookieJar)
result = cookieJar->cookiesEnabled(cookieURL, firstPartyForCookies);
return result;
}
-bool getRawCookies(NetworkingContext* context, const KURL& firstPartyForCookies, const KURL& url, Vector<Cookie>& rawCookies)
+bool getRawCookies(const NetworkStorageSession& session, const KURL& firstPartyForCookies, const KURL& url, Vector<Cookie>& rawCookies)
{
rawCookies.clear();
- if (!context)
+ if (!session.context())
return false;
WebKit::WebVector<WebKit::WebCookie> webCookies;
- WebKit::WebCookieJar* cookieJar = context->cookieJar();
+ WebKit::WebCookieJar* cookieJar = session.context()->cookieJar();
if (cookieJar)
cookieJar->rawCookies(url, firstPartyForCookies, webCookies);
for (unsigned i = 0; i < webCookies.size(); ++i) {
return true;
}
-void deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
- if (!context)
+ if (!session.context())
return;
- WebKit::WebCookieJar* cookieJar = context->cookieJar();
+ WebKit::WebCookieJar* cookieJar = session.context()->cookieJar();
if (cookieJar)
cookieJar->deleteCookie(url, cookieName);
}
-void getHostnamesWithCookies(NetworkingContext* /*context*/, HashSet<String>& /*hostnames*/)
+void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& /*hostnames*/)
{
// FIXME: Not yet implemented
}
-void deleteCookiesForHostname(NetworkingContext* /*context*/, const String& /*hostname*/)
+void deleteCookiesForHostname(const NetworkStorageSession&, const String& /*hostname*/)
{
// FIXME: Not yet implemented
}
-void deleteAllCookies(NetworkingContext* /*context*/)
+void deleteAllCookies(const NetworkStorageSession&)
{
// FIXME: Not yet implemented
}
#include "config.h"
#include "ResourceHandle.h"
+#include "NetworkingContext.h"
+#include "ResourceError.h"
#include "ResourceHandleClient.h"
#include "ResourceHandleInternal.h"
#include "ResourceRequest.h"
+#include "ResourceResponse.h"
#include "SharedBuffer.h"
#include "WrappedResourceRequest.h"
#include "WrappedResourceResponse.h"
static HashMap<String, String> cookieJar;
-void setCookiesFromDOM(NetworkingContext*, const KURL&, const KURL& url, const String& value)
+void setCookiesFromDOM(const NetworkStorageSession&, const KURL&, const KURL& url, const String& value)
{
cookieJar.set(url.string(), value);
}
-String cookiesForDOM(NetworkingContext*, const KURL&, const KURL& url)
+String cookiesForDOM(const NetworkStorageSession&, const KURL&, const KURL& url)
{
return cookieJar.get(url.string());
}
-String cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url)
+String cookieRequestHeaderFieldValue(const NetworkStorageSession&, const KURL& /*firstParty*/, const KURL& url)
{
// FIXME: include HttpOnly cookie.
return cookieJar.get(url.string());
}
-bool cookiesEnabled(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/)
+bool cookiesEnabled(const NetworkStorageSession&, const KURL& /*firstParty*/, const KURL& /*url*/)
{
return true;
}
-bool getRawCookies(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/, Vector<Cookie>& rawCookies)
+bool getRawCookies(const NetworkStorageSession&, const KURL& /*firstParty*/, const KURL& /*url*/, Vector<Cookie>& rawCookies)
{
// FIXME: Not yet implemented
rawCookies.clear();
return false; // return true when implemented
}
-void deleteCookie(NetworkingContext*, const KURL&, const String&)
+void deleteCookie(const NetworkStorageSession&, const KURL&, const String&)
{
// FIXME: Not yet implemented
}
-void getHostnamesWithCookies(NetworkingContext*, HashSet<String>& hostnames)
+void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames)
{
// FIXME: Not yet implemented
}
-void deleteCookiesForHostname(NetworkingContext*, const String& hostname)
+void deleteCookiesForHostname(const NetworkStorageSession&, const String& hostname)
{
// FIXME: Not yet implemented
}
-void deleteAllCookies(NetworkingContext*)
+void deleteAllCookies(const NetworkStorageSession&)
{
// FIXME: Not yet implemented
}
#include "ResourceHandle.h"
#include "CachedResourceLoader.h"
+#include "NetworkingContext.h"
#include "NotImplemented.h"
#include "ResourceHandleInternal.h"
#include "ResourceHandleManager.h"
#import "BlockExceptions.h"
#import "Cookie.h"
#import "CookieStorage.h"
-#import "CookieStorageCFNet.h"
#import "KURL.h"
-#import "NetworkingContext.h"
+#import "NetworkStorageSession.h"
#import "WebCoreSystemInterface.h"
namespace WebCore {
return filteredCookies;
}
-String cookiesForDOM(NetworkingContext* context, const KURL&, const KURL& url)
+String cookiesForDOM(const NetworkStorageSession& session, const KURL&, const KURL& url)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), url);
+ NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);
return [[NSHTTPCookie requestHeaderFieldsWithCookies:filterCookies(cookies).get()] objectForKey:@"Cookie"];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
-String cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url)
+String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), url);
+ NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);
return [[NSHTTPCookie requestHeaderFieldsWithCookies:cookies] objectForKey:@"Cookie"];
END_BLOCK_OBJC_EXCEPTIONS;
return String();
}
-void setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieStr)
+void setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieStr)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
RetainPtr<NSArray> filteredCookies = filterCookies([NSHTTPCookie cookiesWithResponseHeaderFields:[NSDictionary dictionaryWithObject:cookieString forKey:@"Set-Cookie"] forURL:cookieURL]);
ASSERT([filteredCookies.get() count] <= 1);
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- wkSetHTTPCookiesForURL(cookieStorage.get(), filteredCookies.get(), cookieURL, firstParty);
+ wkSetHTTPCookiesForURL(session.cookieStorage().get(), filteredCookies.get(), cookieURL, firstParty);
END_BLOCK_OBJC_EXCEPTIONS;
}
-bool cookiesEnabled(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/)
+bool cookiesEnabled(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- NSHTTPCookieAcceptPolicy cookieAcceptPolicy = static_cast<NSHTTPCookieAcceptPolicy>(wkGetHTTPCookieAcceptPolicy(cookieStorage.get()));
+ NSHTTPCookieAcceptPolicy cookieAcceptPolicy = static_cast<NSHTTPCookieAcceptPolicy>(wkGetHTTPCookieAcceptPolicy(session.cookieStorage().get()));
return cookieAcceptPolicy == NSHTTPCookieAcceptPolicyAlways || cookieAcceptPolicy == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
END_BLOCK_OBJC_EXCEPTIONS;
return false;
}
-bool getRawCookies(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url, Vector<Cookie>& rawCookies)
+bool getRawCookies(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url, Vector<Cookie>& rawCookies)
{
rawCookies.clear();
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), url);
+ NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);
NSUInteger count = [cookies count];
rawCookies.reserveCapacity(count);
for (NSUInteger i = 0; i < count; ++i) {
return true;
}
-void deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSURL *cookieURL = url;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), cookieURL);
NSString *cookieNameString = cookieName;
END_BLOCK_OBJC_EXCEPTIONS;
}
-void getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames)
+void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- NSArray *cookies = wkHTTPCookies(cookieStorage.get());
+ NSArray *cookies = wkHTTPCookies(session.cookieStorage().get());
for (NSHTTPCookie* cookie in cookies)
hostnames.add([cookie domain]);
END_BLOCK_OBJC_EXCEPTIONS;
}
-void deleteCookiesForHostname(NetworkingContext* context, const String& hostname)
+void deleteCookiesForHostname(const NetworkStorageSession& session, const String& hostname)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
NSArray *cookies = wkHTTPCookies(cookieStorage.get());
if (!cookies)
return;
END_BLOCK_OBJC_EXCEPTIONS;
}
-void deleteAllCookies(NetworkingContext* context)
+void deleteAllCookies(const NetworkStorageSession& session)
{
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = context ? currentCFHTTPCookieStorage(context) : defaultCFHTTPCookieStorage();
- wkDeleteAllHTTPCookies(cookieStorage.get());
+ wkDeleteAllHTTPCookies(session.cookieStorage().get());
}
}
#include "config.h"
#include "CookieStorage.h"
-#include "CookieStorageCFNet.h"
#import "ResourceHandle.h"
#import "BlobRegistry.h"
#import "BlockExceptions.h"
#import "CookieStorage.h"
-#import "CookieStorageCFNet.h"
#import "CredentialStorage.h"
#import "CachedResourceLoader.h"
#import "EmptyProtocolDefinitions.h"
#import "FrameLoader.h"
#import "Logging.h"
#import "MIMETypeRegistry.h"
+#import "NetworkingContext.h"
#import "Page.h"
#import "ResourceError.h"
#import "ResourceResponse.h"
{
// If a URL already has cookies, then we'll relax the 3rd party cookie policy and accept new cookies.
- RetainPtr<CFHTTPCookieStorageRef> cfCookieStorage = currentCFHTTPCookieStorage(context);
+ RetainPtr<CFHTTPCookieStorageRef> cfCookieStorage = context->storageSession().cookieStorage();
NSHTTPCookieAcceptPolicy cookieAcceptPolicy = static_cast<NSHTTPCookieAcceptPolicy>(wkGetHTTPCookieAcceptPolicy(cfCookieStorage.get()));
if (cookieAcceptPolicy != NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain)
if (!context->isValid())
return false;
- d->m_storageSession = context->storageSession();
+ d->m_storageSession = context->storageSession().platformSession();
ASSERT(!d->m_proxy);
d->m_proxy.adoptNS(wkCreateNSURLConnectionDelegateProxy());
RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
- handle->d->m_storageSession = context->storageSession();
+ handle->d->m_storageSession = context->storageSession().platformSession();
if (context && handle->d->m_scheduledFailureType != NoFailure) {
error = context->blockedError(request);
static SharedCookieJarQt* s_sharedCookieJarQt = 0;
-void setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& value)
+void setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& value)
{
- QNetworkCookieJar* jar = context ? context->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
+ QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
if (!jar)
return;
QUrl urlForCookies(url);
QUrl firstPartyUrl(firstParty);
- if (!thirdPartyCookiePolicyPermits(context, urlForCookies, firstPartyUrl))
+ if (!thirdPartyCookiePolicyPermits(session.context(), urlForCookies, firstPartyUrl))
return;
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(QString(value).toLatin1());
jar->setCookiesFromUrl(cookies, urlForCookies);
}
-String cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- QNetworkCookieJar* jar = context ? context->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
+ QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
if (!jar)
return String();
QUrl urlForCookies(url);
QUrl firstPartyUrl(firstParty);
- if (!thirdPartyCookiePolicyPermits(context, urlForCookies, firstPartyUrl))
+ if (!thirdPartyCookiePolicyPermits(session.context(), urlForCookies, firstPartyUrl))
return String();
QList<QNetworkCookie> cookies = jar->cookiesForUrl(urlForCookies);
return resultCookies.join(QLatin1String("; "));
}
-String cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url)
+String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url)
{
- QNetworkCookieJar* jar = context ? context->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
+ QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
if (!jar)
return String();
return resultCookies.join(QLatin1String("; "));
}
-bool cookiesEnabled(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/)
+bool cookiesEnabled(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/)
{
- QNetworkCookieJar* jar = context ? context->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
+ QNetworkCookieJar* jar = session.context() ? session.context()->networkAccessManager()->cookieJar() : SharedCookieJarQt::shared();
return !!jar;
}
-bool getRawCookies(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/, Vector<Cookie>& rawCookies)
+bool getRawCookies(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/, Vector<Cookie>& rawCookies)
{
// FIXME: Not yet implemented
rawCookies.clear();
return false; // return true when implemented
}
-void deleteCookie(NetworkingContext*, const KURL&, const String&)
+void deleteCookie(const NetworkStorageSession&, const KURL&, const String&)
{
// FIXME: Not yet implemented
}
-void getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames)
+void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
- ASSERT_UNUSED(context, !context); // Not yet implemented for cookie jars other than the shared one.
+ ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one.
SharedCookieJarQt* jar = SharedCookieJarQt::shared();
if (jar)
jar->getHostnamesWithCookies(hostnames);
}
-void deleteCookiesForHostname(NetworkingContext* context, const String& hostname)
+void deleteCookiesForHostname(const NetworkStorageSession& session, const String& hostname)
{
- ASSERT_UNUSED(context, !context); // Not yet implemented for cookie jars other than the shared one.
+ ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one.
SharedCookieJarQt* jar = SharedCookieJarQt::shared();
if (jar)
jar->deleteCookiesForHostname(hostname);
}
-void deleteAllCookies(NetworkingContext* context)
+void deleteAllCookies(const NetworkStorageSession& session)
{
- ASSERT_UNUSED(context, !context); // Not yet implemented for cookie jars other than the shared one.
+ ASSERT_UNUSED(session, !session.context()); // Not yet implemented for cookie jars other than the shared one.
SharedCookieJarQt* jar = SharedCookieJarQt::shared();
if (jar)
jar->deleteAllCookies();
#include "BlobData.h"
#include "HTTPParsers.h"
#include "MIMETypeRegistry.h"
+#include "NetworkingContext.h"
#include "ResourceHandle.h"
#include "ResourceHandleClient.h"
#include "ResourceHandleInternal.h"
namespace WebCore {
-static SoupCookieJar* cookieJarForContext(NetworkingContext* context)
+static SoupCookieJar* cookieJarForSession(const NetworkStorageSession& session)
{
- return SOUP_COOKIE_JAR(soup_session_get_feature(context->soupSession(), SOUP_TYPE_COOKIE_JAR));
+ if (!session.context())
+ return soupCookieJar();
+ return SOUP_COOKIE_JAR(soup_session_get_feature(session.context()->soupSession(), SOUP_TYPE_COOKIE_JAR));
}
static GRefPtr<SoupCookieJar>& defaultCookieJar()
return false;
}
-void setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& value)
+void setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& value)
{
- SoupCookieJar* jar = context ? cookieJarForContext(context) : soupCookieJar();
+ SoupCookieJar* jar = cookieJarForSession(session);
if (!jar)
return;
soup_cookies_free(existingCookies);
}
-static String cookiesForContext(NetworkingContext* context, const KURL& url, bool forHTTPHeader)
+static String cookiesForSession(const NetworkStorageSession& session, const KURL& url, bool forHTTPHeader)
{
- SoupCookieJar* jar = context ? cookieJarForContext(context) : soupCookieJar();
+ SoupCookieJar* jar = cookieJarForSession(session);
if (!jar)
return String();
return String::fromUTF8(cookies.get());
}
-String cookiesForDOM(NetworkingContext* context, const KURL&, const KURL& url)
+String cookiesForDOM(const NetworkStorageSession& session, const KURL&, const KURL& url)
{
- return cookiesForContext(context, url, false);
+ return cookiesForSession(session, url, false);
}
-String cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url)
+String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url)
{
- return cookiesForContext(context, url, true);
+ return cookiesForSession(session, url, true);
}
-bool cookiesEnabled(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/)
+bool cookiesEnabled(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/)
{
- return !!cookieJarForContext(context);
+ return !!cookieJarForSession(session);
}
-bool getRawCookies(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& url, Vector<Cookie>& rawCookies)
+bool getRawCookies(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url, Vector<Cookie>& rawCookies)
{
rawCookies.clear();
- SoupCookieJar* jar = context ? cookieJarForContext(context) : soupCookieJar();
+ SoupCookieJar* jar = cookieJarForSession(session);
if (!jar)
return false;
return true;
}
-void deleteCookie(NetworkingContext* context, const KURL& url, const String& name)
+void deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& name)
{
- SoupCookieJar* jar = context ? cookieJarForContext(context) : soupCookieJar();
+ SoupCookieJar* jar = cookieJarForSession(session);
if (!jar)
return;
}
}
-void getHostnamesWithCookies(NetworkingContext* context, HashSet<String>& hostnames)
+void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
- SoupCookieJar* cookieJar = context ? cookieJarForContext(context) : soupCookieJar();
+ SoupCookieJar* cookieJar = cookieJarForSession(session);
GOwnPtr<GSList> cookies(soup_cookie_jar_all_cookies(cookieJar));
for (GSList* item = cookies.get(); item; item = g_slist_next(item)) {
GOwnPtr<SoupCookie> cookie(static_cast<SoupCookie*>(item->data));
}
}
-void deleteCookiesForHostname(NetworkingContext* context, const String& hostname)
+void deleteCookiesForHostname(const NetworkStorageSession& session, const String& hostname)
{
CString hostNameString = hostname.utf8();
- SoupCookieJar* cookieJar = context ? cookieJarForContext(context) : soupCookieJar();
+ SoupCookieJar* cookieJar = cookieJarForSession(session);
GOwnPtr<GSList> cookies(soup_cookie_jar_all_cookies(cookieJar));
for (GSList* item = cookies.get(); item; item = g_slist_next(item)) {
SoupCookie* cookie = static_cast<SoupCookie*>(item->data);
}
}
-void deleteAllCookies(NetworkingContext* context)
+void deleteAllCookies(const NetworkStorageSession& session)
{
- SoupCookieJar* cookieJar = context ? cookieJarForContext(context) : soupCookieJar();
+ SoupCookieJar* cookieJar = cookieJarForSession(session);
GOwnPtr<GSList> cookies(soup_cookie_jar_all_cookies(cookieJar));
for (GSList* item = cookies.get(); item; item = g_slist_next(item)) {
SoupCookie* cookie = static_cast<SoupCookie*>(item->data);
#include "GOwnPtrSoup.h"
#include "ResourceHandle.h"
+#include <libsoup/soup.h>
#include <wtf/MainThread.h>
#include <wtf/text/CString.h>
#include "LocalizedStrings.h"
#include "Logging.h"
#include "MIMETypeRegistry.h"
+#include "NetworkingContext.h"
#include "NotImplemented.h"
#include "Page.h"
#include "ResourceError.h"
#include "Cookie.h"
#include "KURL.h"
+#include "NetworkingContext.h"
#include "ResourceHandle.h"
#include <windows.h>
#include <Wininet.h>
namespace WebCore {
-void setCookiesFromDOM(NetworkingContext*, const KURL&, const KURL& url, const String& value)
+void setCookiesFromDOM(const NetworkStorageSession&, const KURL&, const KURL& url, const String& value)
{
// FIXME: Deal with firstParty argument.
String str = url.string();
InternetSetCookie(str.charactersWithNullTermination(), 0, val.charactersWithNullTermination());
}
-String cookiesForDOM(NetworkingContext*, const KURL&, const KURL& url)
+String cookiesForDOM(const NetworkStorageSession&, const KURL&, const KURL& url)
{
// FIXME: Deal with firstParty argument.
return String::adopt(buffer);
}
-String cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
// FIXME: include HttpOnly cookie
- return cookiesForDOM(context, firstParty, url);
+ return cookiesForDOM(session.context(), firstParty, url);
}
-bool cookiesEnabled(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/)
+bool cookiesEnabled(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/)
{
return true;
}
-bool getRawCookies(NetworkingContext* context, const KURL& /*firstParty*/, const KURL& /*url*/, Vector<Cookie>& rawCookies)
+bool getRawCookies(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& /*url*/, Vector<Cookie>& rawCookies)
{
// FIXME: Not yet implemented
rawCookies.clear();
return false; // return true when implemented
}
-void deleteCookie(NetworkingContext*, const KURL&, const String&)
+void deleteCookie(const NetworkStorageSession&, const KURL&, const String&)
{
// FIXME: Not yet implemented
}
-void getHostnamesWithCookies(NetworkingContext*, HashSet<String>& hostnames)
+void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames)
{
// FIXME: Not yet implemented
}
-void deleteCookiesForHostname(NetworkingContext*, const String& hostname)
+void deleteCookiesForHostname(const NetworkStorageSession&, const String& hostname)
{
// FIXME: Not yet implemented
}
-void deleteAllCookies(NetworkingContext*)
+void deleteAllCookies(const NetworkStorageSession&)
{
// FIXME: Not yet implemented
}
#include "DataURL.h"
#include "HTTPParsers.h"
#include "MIMETypeRegistry.h"
+#include "NetworkingContext.h"
#include "NotImplemented.h"
#include "ResourceError.h"
#include "ResourceHandleClient.h"
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ * WebCoreSupport/PlatformStrategiesEfl.cpp:
+ (PlatformStrategiesEfl::cookiesForDOM):
+ (PlatformStrategiesEfl::setCookiesFromDOM):
+ (PlatformStrategiesEfl::cookiesEnabled):
+ (PlatformStrategiesEfl::cookieRequestHeaderFieldValue):
+ (PlatformStrategiesEfl::getRawCookies):
+ (PlatformStrategiesEfl::deleteCookie):
+ * WebCoreSupport/PlatformStrategiesEfl.h:
+ Cookie functions now take a NetworkStorageSession, not a NetworkingContext.
+
2012-12-21 Seokju Kwon <seokju.kwon@gmail.com>
[EFL] Add guard around ContextMenuItemTagInspectElement
{
}
-String PlatformStrategiesEfl::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesEfl::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesForDOM(context, firstParty, url);
+ return WebCore::cookiesForDOM(session, firstParty, url);
}
-void PlatformStrategiesEfl::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString)
+void PlatformStrategiesEfl::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
{
- WebCore::setCookiesFromDOM(context, firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
}
-bool PlatformStrategiesEfl::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+bool PlatformStrategiesEfl::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesEnabled(context, firstParty, url);
+ return WebCore::cookiesEnabled(session, firstParty, url);
}
-String PlatformStrategiesEfl::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesEfl::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url);
+ return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
}
-bool PlatformStrategiesEfl::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
+bool PlatformStrategiesEfl::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
{
- return WebCore::getRawCookies(context, firstParty, url, rawCookies);
+ return WebCore::getRawCookies(session, firstParty, url, rawCookies);
}
-void PlatformStrategiesEfl::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void PlatformStrategiesEfl::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
- WebCore::deleteCookie(context, url, cookieName);
+ WebCore::deleteCookie(session, url, cookieName);
}
void PlatformStrategiesEfl::refreshPlugins()
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged();
- virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
- virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
- virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&);
+ virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
+ virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
+ virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::KURL&, const String&);
// WebCore::DatabaseStrategy
// - Using default implementation.
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ * WebCoreSupport/PlatformStrategiesGtk.cpp:
+ (PlatformStrategiesGtk::cookiesForDOM):
+ (PlatformStrategiesGtk::setCookiesFromDOM):
+ (PlatformStrategiesGtk::cookiesEnabled):
+ (PlatformStrategiesGtk::cookieRequestHeaderFieldValue):
+ (PlatformStrategiesGtk::getRawCookies):
+ (PlatformStrategiesGtk::deleteCookie):
+ * WebCoreSupport/PlatformStrategiesGtk.h:
+ Cookie functions now take a NetworkStorageSession, not a NetworkingContext.
+
2012-12-18 Alexey Proskuryakov <ap@apple.com>
Remove unnecessary functions from CookiesStrategy
{
}
-String PlatformStrategiesGtk::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesGtk::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesForDOM(context, firstParty, url);
+ return WebCore::cookiesForDOM(session, firstParty, url);
}
-void PlatformStrategiesGtk::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString)
+void PlatformStrategiesGtk::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
{
- WebCore::setCookiesFromDOM(context, firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
}
-bool PlatformStrategiesGtk::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+bool PlatformStrategiesGtk::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesEnabled(context, firstParty, url);
+ return WebCore::cookiesEnabled(session, firstParty, url);
}
-String PlatformStrategiesGtk::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesGtk::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url);
+ return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
}
-bool PlatformStrategiesGtk::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
+bool PlatformStrategiesGtk::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
{
- return WebCore::getRawCookies(context, firstParty, url, rawCookies);
+ return WebCore::getRawCookies(session, firstParty, url, rawCookies);
}
-void PlatformStrategiesGtk::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void PlatformStrategiesGtk::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
- WebCore::deleteCookie(context, url, cookieName);
+ WebCore::deleteCookie(session, url, cookieName);
}
// PluginStrategy
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged();
- virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
- virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
- virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&);
+ virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
+ virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
+ virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::KURL&, const String&);
// WebCore::DatabaseStrategy
// - Using default implementation.
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ Updated for ResourceHandle include changes.
+
+ * WebCoreSupport/WebFrameNetworkingContext.h:
+ * WebCoreSupport/WebFrameNetworkingContext.mm:
+ This class is now simpler, with more session tracking being in WebCore now.
+
+ * WebCoreSupport/WebPlatformStrategies.h:
+ * WebCoreSupport/WebPlatformStrategies.mm:
+ (WebPlatformStrategies::cookiesForDOM):
+ (WebPlatformStrategies::setCookiesFromDOM):
+ (WebPlatformStrategies::cookiesEnabled):
+ (WebPlatformStrategies::cookieRequestHeaderFieldValue):
+ (WebPlatformStrategies::getRawCookies):
+ (WebPlatformStrategies::deleteCookie):
+ We no longer need a function for default cookie storage! Other cookie functions
+ now take a session.
+
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences _switchNetworkLoaderToNewTestingSession]): Initialize WCSI before
+ calling a WebCore that uses it.
+ (+[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]): Use
+ NetworkStorageSession for session tracking.
+
+ * WebView/WebView.mm: (-[WebView _cachedResponseForURL:]): Updated for networking
+ context now returning a class for session.
+
2012-12-20 Ilya Tikhonovsky <loislo@chromium.org>
Unreviewed build fix for chromium mac after r138206.
#import <WebCore/MouseEvent.h>
#import <WebCore/Page.h>
#import <WebCore/PluginViewBase.h>
+#import <WebCore/ProtectionSpace.h>
#import <WebCore/ResourceError.h>
#import <WebCore/ResourceHandle.h>
#import <WebCore/ResourceLoader.h>
return adoptRef(new WebFrameNetworkingContext(frame));
}
- static void setPrivateBrowsingStorageSessionIdentifierBase(const String&);
- static void switchToNewTestingSession();
static void ensurePrivateBrowsingSession();
static void destroyPrivateBrowsingSession();
- static CFURLStorageSessionRef defaultStorageSession();
-
- static void setCookieAcceptPolicyForTestingContext(NSHTTPCookieAcceptPolicy);
private:
WebFrameNetworkingContext(WebCore::Frame* frame)
virtual bool needsSiteSpecificQuirks() const OVERRIDE;
virtual bool localFileContentSniffingEnabled() const OVERRIDE;
- virtual bool inPrivateBrowsingMode() const OVERRIDE;
- virtual CFURLStorageSessionRef storageSession() const OVERRIDE;
+ virtual WebCore::NetworkStorageSession& storageSession() const OVERRIDE;
virtual WebCore::SchedulePairHashSet* scheduledRunLoopPairs() const OVERRIDE;
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const OVERRIDE;
};
#import "WebFrameNetworkingContext.h"
#import <WebCore/FrameLoaderClient.h>
+#import <WebCore/NetworkStorageSession.h>
#import <WebCore/Page.h>
#import <WebCore/ResourceError.h>
#import <WebCore/Settings.h>
using namespace WebCore;
-static CFURLStorageSessionRef defaultCFStorageSession;
-static CFURLStorageSessionRef privateBrowsingStorageSession;
+static OwnPtr<NetworkStorageSession>& privateBrowsingStorageSession()
+{
+ DEFINE_STATIC_LOCAL(OwnPtr<NetworkStorageSession>, session, ());
+ return session;
+}
bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
{
return frame()->loader()->client()->blockedError(request);
}
-static String& privateBrowsingStorageSessionIdentifierBase()
-{
- ASSERT(isMainThread());
- DEFINE_STATIC_LOCAL(String, base, ());
- return base;
-}
-
-void WebFrameNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(const String& identifier)
-{
- privateBrowsingStorageSessionIdentifierBase() = identifier;
-}
-
-void WebFrameNetworkingContext::switchToNewTestingSession()
-{
- // Set a private session for testing to avoid interfering with global cookies. This should be different from private browsing session.
- if (defaultCFStorageSession)
- CFRelease(defaultCFStorageSession);
- defaultCFStorageSession = WKCreatePrivateStorageSession(CFSTR("Private WebKit Session"));
-}
-
void WebFrameNetworkingContext::ensurePrivateBrowsingSession()
{
ASSERT(isMainThread());
- if (privateBrowsingStorageSession)
+ if (privateBrowsingStorageSession())
return;
- String base = privateBrowsingStorageSessionIdentifierBase().isNull() ? String([[NSBundle mainBundle] bundleIdentifier]) : privateBrowsingStorageSessionIdentifierBase();
- RetainPtr<CFStringRef> cfIdentifier = String(base + ".PrivateBrowsing").createCFString();
-
- privateBrowsingStorageSession = WKCreatePrivateStorageSession(cfIdentifier.get());
+ privateBrowsingStorageSession() = NetworkStorageSession::createPrivateBrowsingSession([[NSBundle mainBundle] bundleIdentifier]);
}
void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
{
- if (!privateBrowsingStorageSession)
- return;
-
- CFRelease(privateBrowsingStorageSession);
- privateBrowsingStorageSession = 0;
-}
-
-CFURLStorageSessionRef WebFrameNetworkingContext::defaultStorageSession()
-{
- return defaultCFStorageSession;
+ privateBrowsingStorageSession() = nullptr;
}
-bool WebFrameNetworkingContext::inPrivateBrowsingMode() const
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
{
- return frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled();
-}
-
-CFURLStorageSessionRef WebFrameNetworkingContext::storageSession() const
-{
- if (inPrivateBrowsingMode()) {
- ASSERT(privateBrowsingStorageSession);
- return privateBrowsingStorageSession;
+ bool inPrivateBrowsingMode = frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled();
+ if (inPrivateBrowsingMode) {
+ ASSERT(privateBrowsingStorageSession());
+ return *privateBrowsingStorageSession();
}
- return defaultCFStorageSession;
+ return NetworkStorageSession::defaultStorageSession();
}
-void WebFrameNetworkingContext::setCookieAcceptPolicyForTestingContext(NSHTTPCookieAcceptPolicy policy)
-{
- ASSERT(defaultCFStorageSession);
- RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage = adoptCF(WKCopyHTTPCookieStorage(defaultCFStorageSession));
- WKSetHTTPCookieAcceptPolicy(defaultCookieStorage.get(), policy);
-}
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged() OVERRIDE;
- virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage() OVERRIDE;
- virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
- virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&) OVERRIDE;
- virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
- virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
- virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&) OVERRIDE;
- virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&) OVERRIDE;
+ virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&) OVERRIDE;
+ virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
+ virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&) OVERRIDE;
+ virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::KURL&, const String&) OVERRIDE;
// WebCore::DatabaseStrategy
// - Using default implementation.
{
}
-RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage()
+String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- if (CFURLStorageSessionRef session = WebFrameNetworkingContext::defaultStorageSession())
- return adoptCF(WKCopyHTTPCookieStorage(session));
-
-#if USE(CFNETWORK)
- return WKGetDefaultHTTPCookieStorage();
-#else
- // When using NSURLConnection, we also use its shared cookie storage.
- return 0;
-#endif
-}
-
-String WebPlatformStrategies::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
-{
- return WebCore::cookiesForDOM(context, firstParty, url);
+ return WebCore::cookiesForDOM(session, firstParty, url);
}
-void WebPlatformStrategies::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString)
+void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
{
- WebCore::setCookiesFromDOM(context, firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
}
-bool WebPlatformStrategies::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesEnabled(context, firstParty, url);
+ return WebCore::cookiesEnabled(session, firstParty, url);
}
-String WebPlatformStrategies::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url);
+ return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
}
-bool WebPlatformStrategies::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
+bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
{
- return WebCore::getRawCookies(context, firstParty, url, rawCookies);
+ return WebCore::getRawCookies(session, firstParty, url, rawCookies);
}
-void WebPlatformStrategies::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
- WebCore::deleteCookie(context, url, cookieName);
+ WebCore::deleteCookie(session, url, cookieName);
}
void WebPlatformStrategies::refreshPlugins()
#import "WebKitVersionChecks.h"
#import "WebNSDictionaryExtras.h"
#import "WebNSURLExtras.h"
+#import "WebSystemInterface.h"
#import <WebCore/ApplicationCacheStorage.h>
-#import <WebCore/CookieStorageCFNet.h>
+#import <WebCore/NetworkStorageSession.h>
#import <WebCore/ResourceHandle.h>
#import <wtf/RetainPtr.h>
+ (void)_switchNetworkLoaderToNewTestingSession
{
- WebFrameNetworkingContext::switchToNewTestingSession();
+ InitWebCoreSystemInterface();
+ NetworkStorageSession::switchToNewTestingSession();
}
+ (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
{
- WebFrameNetworkingContext::setCookieAcceptPolicyForTestingContext(policy);
+ WKSetHTTPCookieAcceptPolicy(NetworkStorageSession::defaultStorageSession().cookieStorage().get(), policy);
}
- (BOOL)isDOMPasteAllowed
if (!_private->page)
return nil;
- if (CFURLStorageSessionRef storageSession = _private->page->mainFrame()->loader()->networkingContext()->storageSession())
+ if (CFURLStorageSessionRef storageSession = _private->page->mainFrame()->loader()->networkingContext()->storageSession().platformSession())
cachedResponse = WKCachedResponseForRequest(storageSession, request.get());
else
cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request.get()];
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ * WebCoreSupport/PlatformStrategiesQt.cpp:
+ (PlatformStrategiesQt::cookiesForDOM):
+ (PlatformStrategiesQt::setCookiesFromDOM):
+ (PlatformStrategiesQt::cookiesEnabled):
+ (PlatformStrategiesQt::cookieRequestHeaderFieldValue):
+ (PlatformStrategiesQt::getRawCookies):
+ (PlatformStrategiesQt::deleteCookie):
+ * WebCoreSupport/PlatformStrategiesQt.h:
+ Cookie functions now take a NetworkStorageSession, not a NetworkingContext.
+
+ * WebCoreSupport/QWebFrameAdapter.cpp:
+ * WebCoreSupport/QWebPageAdapter.cpp:
+ Updated for ResourceHandle include changes.
+
2012-12-18 Alexey Proskuryakov <ap@apple.com>
Remove unnecessary functions from CookiesStrategy
{
}
-String PlatformStrategiesQt::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesQt::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesForDOM(context, firstParty, url);
+ return WebCore::cookiesForDOM(session, firstParty, url);
}
-void PlatformStrategiesQt::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString)
+void PlatformStrategiesQt::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
{
- WebCore::setCookiesFromDOM(context, firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
}
-bool PlatformStrategiesQt::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+bool PlatformStrategiesQt::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesEnabled(context, firstParty, url);
+ return WebCore::cookiesEnabled(session, firstParty, url);
}
-String PlatformStrategiesQt::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesQt::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url);
+ return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
}
-bool PlatformStrategiesQt::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
+bool PlatformStrategiesQt::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
{
- return WebCore::getRawCookies(context, firstParty, url, rawCookies);
+ return WebCore::getRawCookies(session, firstParty, url, rawCookies);
}
-void PlatformStrategiesQt::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void PlatformStrategiesQt::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
- WebCore::deleteCookie(context, url, cookieName);
+ WebCore::deleteCookie(session, url, cookieName);
}
void PlatformStrategiesQt::refreshPlugins()
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged();
- virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
- virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
- virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&);
+ virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
+ virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
+ virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::KURL&, const String&);
// WebCore::DatabaseStrategy
// - Using default implementation.
#include "JSDOMWindowBase.h"
#include "KURL.h"
#include "NavigationScheduler.h"
+#include "NetworkingContext.h"
#include "NodeList.h"
#include "Page.h"
#include "QWebPageAdapter.h"
#include "LocalizedStrings.h"
#include "MIMETypeRegistry.h"
#include "MemoryCache.h"
+#include "NetworkingContext.h"
#include "NodeList.h"
#include "NotificationPresenterClientQt.h"
#include "PageGroup.h"
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ * WebCookieManagerCFNet.cpp:
+ * WebView.cpp:
+ Updated includes.
+
+ * WebCoreSupport/WebFrameNetworkingContext.cpp:
+ * WebCoreSupport/WebFrameNetworkingContext.h:
+ This class is now simpler, with most session tracking being in WebCore.
+
+ * WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebPlatformStrategies::cookiesForDOM):
+ (WebPlatformStrategies::setCookiesFromDOM):
+ (WebPlatformStrategies::cookiesEnabled):
+ (WebPlatformStrategies::cookieRequestHeaderFieldValue):
+ (WebPlatformStrategies::getRawCookies):
+ (WebPlatformStrategies::deleteCookie):
+ * WebCoreSupport/WebPlatformStrategies.h:
+ We no longer need a function for default storage! Other functions now take a session.
+
2012-12-21 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r138331.
#include "WebCookieManager.h"
#include <CFNetwork/CFHTTPCookiesPriv.h>
-#include <WebCore/CookieStorageCFNet.h>
+#include <WebCore/NetworkStorageSession.h>
using namespace WebCore;
#include "FrameLoaderClient.h"
#if USE(CFNETWORK)
#include <CFNetwork/CFHTTPCookiesPriv.h>
-#include <WebCore/CookieStorageCFNet.h>
#endif
#include <WebCore/Settings.h>
#if USE(CFNETWORK)
using namespace WebCore;
#if USE(CFNETWORK)
-static CFURLStorageSessionRef defaultCFStorageSession;
-static CFURLStorageSessionRef privateBrowsingStorageSession;
+static OwnPtr<NetworkStorageSession>& privateBrowsingStorageSession()
+{
+ DEFINE_STATIC_LOCAL(OwnPtr<NetworkStorageSession>, session, ());
+ return session;
+}
#endif
PassRefPtr<WebFrameNetworkingContext> WebFrameNetworkingContext::create(Frame* frame, const String& userAgent)
privateBrowsingStorageSessionIdentifierBase() = identifier;
}
-void WebFrameNetworkingContext::switchToNewTestingSession()
-{
-#if USE(CFNETWORK)
- // Set a private session for testing to avoid interfering with global cookies. This should be different from private browsing session.
- defaultCFStorageSession = wkCreatePrivateStorageSession(CFSTR("Private WebKit Session"), defaultCFStorageSession);
-#endif
-}
-
void WebFrameNetworkingContext::ensurePrivateBrowsingSession()
{
ASSERT(isMainThread());
#if USE(CFNETWORK)
- if (privateBrowsingStorageSession)
+ if (privateBrowsingStorageSession())
return;
- String base = privateBrowsingStorageSessionIdentifierBase().isNull() ? String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey))) : privateBrowsingStorageSessionIdentifierBase();
- RetainPtr<CFStringRef> cfIdentifier = String(base + ".PrivateBrowsing").createCFString();
+ String identifierBase = privateBrowsingStorageSessionIdentifierBase().isNull() ? String(reinterpret_cast<CFStringRef>(CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleIdentifierKey))) : privateBrowsingStorageSessionIdentifierBase();
- privateBrowsingStorageSession = wkCreatePrivateStorageSession(cfIdentifier.get(), defaultCFStorageSession);
+ privateBrowsingStorageSession() = NetworkStorageSession::createPrivateBrowsingSession(identifierBase);
#endif
}
void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
{
#if USE(CFNETWORK)
- if (!privateBrowsingStorageSession)
- return;
-
- CFRelease(privateBrowsingStorageSession);
- privateBrowsingStorageSession = 0;
+ privateBrowsingStorageSession() = nullptr;
#endif
}
#if USE(CFNETWORK)
-CFURLStorageSessionRef WebFrameNetworkingContext::defaultStorageSession()
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
{
- return defaultCFStorageSession;
-}
-
-bool WebFrameNetworkingContext::inPrivateBrowsingMode() const
-{
- return frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled();
-}
-
-CFURLStorageSessionRef WebFrameNetworkingContext::storageSession() const
-{
- bool privateBrowsingEnabled = inPrivateBrowsingMode();
- if (privateBrowsingEnabled) {
- ASSERT(privateBrowsingStorageSession);
- return privateBrowsingStorageSession;
+ bool inPrivateBrowsingMode = frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled();
+ if (inPrivateBrowsingMode) {
+ ASSERT(privateBrowsingStorageSession());
+ return *privateBrowsingStorageSession();
}
- return defaultCFStorageSession;
-}
-
-void WebFrameNetworkingContext::setCookieAcceptPolicyForTestingContext(CFHTTPCookieStorageAcceptPolicy policy)
-{
- ASSERT(defaultCFStorageSession);
- RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage = adoptCF(wkCopyHTTPCookieStorage(defaultCFStorageSession));
- CFHTTPCookieStorageSetCookieAcceptPolicy(defaultCookieStorage.get(), policy);
+ return NetworkStorageSession::defaultStorageSession();
}
void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(CFHTTPCookieStorageAcceptPolicy policy)
{
- if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = defaultCFHTTPCookieStorage())
+ if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage())
CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
- if (privateBrowsingStorageSession) {
- RetainPtr<CFHTTPCookieStorageRef> privateBrowsingCookieStorage = adoptCF(wkCopyHTTPCookieStorage(privateBrowsingStorageSession));
- CFHTTPCookieStorageSetCookieAcceptPolicy(privateBrowsingCookieStorage.get(), policy);
- }
+ if (privateBrowsingStorageSession())
+ CFHTTPCookieStorageSetCookieAcceptPolicy(privateBrowsingStorageSession()->cookieStorage().get(), policy);
}
#endif
static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame*, const WTF::String& userAgent);
static void setPrivateBrowsingStorageSessionIdentifierBase(const String&);
- static void switchToNewTestingSession();
static void ensurePrivateBrowsingSession();
static void destroyPrivateBrowsingSession();
#if USE(CFNETWORK)
- static CFURLStorageSessionRef defaultStorageSession();
-
- static void setCookieAcceptPolicyForTestingContext(CFHTTPCookieStorageAcceptPolicy);
static void setCookieAcceptPolicyForAllContexts(CFHTTPCookieStorageAcceptPolicy);
#endif
virtual WTF::String userAgent() const;
virtual WTF::String referrer() const;
#if USE(CFNETWORK)
- virtual bool inPrivateBrowsingMode() const;
- virtual CFURLStorageSessionRef storageSession() const;
+ virtual WebCore::NetworkStorageSession& storageSession() const;
#endif
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const;
{
}
-#if USE(CFNETWORK)
-RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage()
-{
- if (CFURLStorageSessionRef session = WebFrameNetworkingContext::defaultStorageSession())
- return adoptCF(wkCopyHTTPCookieStorage(session));
-
- return wkGetDefaultHTTPCookieStorage();
-}
-#endif
-
-String WebPlatformStrategies::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesForDOM(context, firstParty, url);
+ return WebCore::cookiesForDOM(session, firstParty, url);
}
-void WebPlatformStrategies::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString)
+void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
{
- WebCore::setCookiesFromDOM(context, firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
}
-bool WebPlatformStrategies::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesEnabled(context, firstParty, url);
+ return WebCore::cookiesEnabled(session, firstParty, url);
}
-String WebPlatformStrategies::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url);
+ return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
}
-bool WebPlatformStrategies::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
+bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
{
- return WebCore::getRawCookies(context, firstParty, url, rawCookies);
+ return WebCore::getRawCookies(session, firstParty, url, rawCookies);
}
-void WebPlatformStrategies::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
- WebCore::deleteCookie(context, url, cookieName);
+ WebCore::deleteCookie(session, url, cookieName);
}
void WebPlatformStrategies::refreshPlugins()
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged();
-#if USE(CFNETWORK)
- virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage();
-#endif
- virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
- virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
- virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&);
+ virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
+ virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
+ virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::KURL&, const String&);
// WebCore::DatabaseStrategy
// - Using default implementation.
#if USE(CFNETWORK)
#include <CFNetwork/CFURLCachePriv.h>
#include <CFNetwork/CFURLProtocolPriv.h>
-#include <WebCore/CookieStorageCFNet.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
#endif
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ * WebCoreSupport/PlatformStrategiesWinCE.cpp:
+ (PlatformStrategiesWinCE::cookiesForDOM):
+ (PlatformStrategiesWinCE::setCookiesFromDOM):
+ (PlatformStrategiesWinCE::cookiesEnabled):
+ (PlatformStrategiesWinCE::cookieRequestHeaderFieldValue):
+ (PlatformStrategiesWinCE::getRawCookies):
+ (PlatformStrategiesWinCE::deleteCookie):
+ * WebCoreSupport/PlatformStrategiesWinCE.h:
+ Cookie functions now take a NetworkStorageSession, not a NetworkingContext.
+
2012-12-18 Alexey Proskuryakov <ap@apple.com>
Remove unnecessary functions from CookiesStrategy
{
}
-String PlatformStrategiesWinCE::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesWinCE::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesForDOM(context, firstParty, url);
+ return WebCore::cookiesForDOM(session, firstParty, url);
}
-void PlatformStrategiesWinCE::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString)
+void PlatformStrategiesWinCE::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
{
- WebCore::setCookiesFromDOM(context, firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
}
-bool PlatformStrategiesWinCE::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+bool PlatformStrategiesWinCE::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookiesEnabled(context, firstParty, url);
+ return WebCore::cookiesEnabled(session, firstParty, url);
}
-String PlatformStrategiesWinCE::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String PlatformStrategiesWinCE::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
- return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url);
+ return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
}
-bool PlatformStrategiesWinCE::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
+bool PlatformStrategiesWinCE::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
{
- return WebCore::getRawCookies(context, firstParty, url, rawCookies);
+ return WebCore::getRawCookies(session, firstParty, url, rawCookies);
}
-void PlatformStrategiesWinCE::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void PlatformStrategiesWinCE::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
- WebCore::deleteCookie(context, url, cookieName);
+ WebCore::deleteCookie(session, url, cookieName);
}
void PlatformStrategiesWinCE::refreshPlugins()
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged();
- virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
- virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&);
- virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
- virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&);
+ virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&);
+ virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&);
+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&);
+ virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::KURL&, const String&);
// WebCore::DatabaseStrategy
// - Using default implementation.
+2012-12-22 Alexey Proskuryakov <ap@apple.com>
+
+ Add a separate class for networking related storage
+ https://bugs.webkit.org/show_bug.cgi?id=105676
+
+ Reviewed by Sam Weinig.
+
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp: We no longer need to create
+ fake RemoteNetworkingContexts here! Use an actual default or private storage session.
+
+ * NetworkProcess/mac/NetworkProcessMainMac.mm: Updated form of WebSystemInterface.h include,
+ it's not a system one.
+
+ * NetworkProcess/mac/RemoteNetworkingContext.h: Expose privateBrowsingSession(),
+ so that NetworkConnectionToWebProcess could use it. We can generalize the interface
+ one we support more sessions.
+
+ * NetworkProcess/mac/RemoteNetworkingContext.mm: This class now only tracks private
+ browsing session, with most other code being in NetworkStorageSession.
+
+ * Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm:
+ * UIProcess/Launcher/efl/ProcessLauncherEfl.cpp:
+ * UIProcess/Launcher/gtk/ProcessLauncherGtk.cpp:
+ * WebProcess/WebProcess.cpp:
+ * WebProcess/efl/WebProcessMainEfl.cpp:
+ * WebProcess/gtk/WebProcessMainGtk.cpp:
+ * WebProcess/Downloads/cfnet/DownloadCFNet.cpp:
+ * WebProcess/Downloads/efl/DownloadSoupErrorsEfl.cpp:
+ * WebProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp:
+ * WebProcess/Downloads/mac/DownloadMac.mm:
+ * WebProcess/Network/WebResourceLoader.cpp:
+ Updated includes for ResourceHandle change. For some ports, the includes could be
+ made more tight, but I have no practical way to do that.
+
+ * WebKit2.xcodeproj/project.pbxproj: Removed WebPlatformStrategiesMac.mm.
+
+ * WebProcess/Cookies/WebCookieManager.cpp:
+ (WebKit::WebCookieManager::getHostnamesWithCookies):
+ (WebKit::WebCookieManager::deleteCookiesForHostname):
+ (WebKit::WebCookieManager::deleteAllCookies):
+ Pass a proper session instead of relying on a strategy to call back to WebKit
+ for default cookie storage (we don't even have strategies initialized in NetworkProcess).
+
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::switchNetworkLoaderToNewTestingSession): Initialize WCSI
+ before calling a function that now uses in in WebCore.
+
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: We no longer need a strategy
+ for default cookie storage! Updated other functions to use sessions.
+
+ * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
+ * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+ * WebProcess/WebCoreSupport/mac/WebPlatformStrategiesMac.mm: Removed.
+ * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h:
+ WebFrameNetworkingContext is now simpler, with more tracking being donre through WebCore.
+
2012-12-21 Elliott Sprehn <esprehn@chromium.org>
Replace documentFragmentIsShadowRoot with isTreeScope
m_serialLoadingEnabled = enabled;
}
-static RemoteNetworkingContext* networkingContext(bool privateBrowsingEnabled)
-{
- // This networking context is only needed to get storage session from.
- if (privateBrowsingEnabled) {
- static RemoteNetworkingContext* context = RemoteNetworkingContext::create(false, false, true).leakRef();
- return context;
- } else {
- static RemoteNetworkingContext* context = RemoteNetworkingContext::create(false, false, false).leakRef();
- return context;
- }
+static NetworkStorageSession& storageSession(bool privateBrowsingEnabled)
+{
+ return privateBrowsingEnabled ? RemoteNetworkingContext::privateBrowsingSession() : NetworkStorageSession::defaultStorageSession();
}
void NetworkConnectionToWebProcess::startDownload(bool privateBrowsingEnabled, uint64_t downloadID, const ResourceRequest& request)
void NetworkConnectionToWebProcess::cookiesForDOM(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, String& result)
{
- result = WebCore::cookiesForDOM(networkingContext(privateBrowsingEnabled), firstParty, url);
+ result = WebCore::cookiesForDOM(storageSession(privateBrowsingEnabled), firstParty, url);
}
void NetworkConnectionToWebProcess::setCookiesFromDOM(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, const String& cookieString)
{
- WebCore::setCookiesFromDOM(networkingContext(privateBrowsingEnabled), firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(storageSession(privateBrowsingEnabled), firstParty, url, cookieString);
}
void NetworkConnectionToWebProcess::cookiesEnabled(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, bool& result)
{
- result = WebCore::cookiesEnabled(networkingContext(privateBrowsingEnabled), firstParty, url);
+ result = WebCore::cookiesEnabled(storageSession(privateBrowsingEnabled), firstParty, url);
}
void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, String& result)
{
- result = WebCore::cookieRequestHeaderFieldValue(networkingContext(privateBrowsingEnabled), firstParty, url);
+ result = WebCore::cookieRequestHeaderFieldValue(storageSession(privateBrowsingEnabled), firstParty, url);
}
void NetworkConnectionToWebProcess::getRawCookies(bool privateBrowsingEnabled, const KURL& firstParty, const KURL& url, Vector<Cookie>& result)
{
- WebCore::getRawCookies(networkingContext(privateBrowsingEnabled), firstParty, url, result);
+ WebCore::getRawCookies(storageSession(privateBrowsingEnabled), firstParty, url, result);
}
void NetworkConnectionToWebProcess::deleteCookie(bool privateBrowsingEnabled, const KURL& url, const String& cookieName)
{
- WebCore::deleteCookie(networkingContext(privateBrowsingEnabled), url, cookieName);
+ WebCore::deleteCookie(storageSession(privateBrowsingEnabled), url, cookieName);
}
} // namespace WebKit
#import "CommandLine.h"
#import "EnvironmentUtilities.h"
#import "NetworkProcess.h"
+#import "WebSystemInterface.h"
#import <WebCore/RunLoop.h>
#import <WebKitSystemInterface.h>
-#import <WebSystemInterface.h>
#import <mach/mach_error.h>
#import <runtime/InitializeThreading.h>
#import <servers/bootstrap.h>
static void ensurePrivateBrowsingSession();
static void destroyPrivateBrowsingSession();
+ static WebCore::NetworkStorageSession& privateBrowsingSession(); // Can only be called when the session exists.
+
private:
RemoteNetworkingContext(bool needsSiteSpecificQuirks, bool localFileContentSniffingEnabled, bool privateBrowsingEnabled);
virtual bool needsSiteSpecificQuirks() const OVERRIDE;
virtual bool localFileContentSniffingEnabled() const OVERRIDE;
- virtual bool inPrivateBrowsingMode() const OVERRIDE;
- virtual CFURLStorageSessionRef storageSession() const OVERRIDE;
+ virtual WebCore::NetworkStorageSession& storageSession() const OVERRIDE;
virtual NSOperationQueue *scheduledOperationQueue() const OVERRIDE;
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const OVERRIDE;
namespace WebKit {
-static CFURLStorageSessionRef privateBrowsingStorageSession;
+static OwnPtr<NetworkStorageSession>& privateBrowsingStorageSession()
+{
+ ASSERT(isMainThread());
+ DEFINE_STATIC_LOCAL(OwnPtr<NetworkStorageSession>, session, ());
+ return session;
+}
RemoteNetworkingContext::RemoteNetworkingContext(bool needsSiteSpecificQuirks, bool localFileContentSniffingEnabled, bool privateBrowsingEnabled)
: m_needsSiteSpecificQuirks(needsSiteSpecificQuirks)
return m_localFileContentSniffingEnabled;
}
-bool RemoteNetworkingContext::inPrivateBrowsingMode() const
+NetworkStorageSession& RemoteNetworkingContext::storageSession() const
{
- return m_privateBrowsingEnabled;
+ if (m_privateBrowsingEnabled) {
+ ASSERT(privateBrowsingStorageSession());
+ return *privateBrowsingStorageSession();
+ }
+
+ return NetworkStorageSession::defaultStorageSession();
}
-CFURLStorageSessionRef RemoteNetworkingContext::storageSession() const
+NetworkStorageSession& RemoteNetworkingContext::privateBrowsingSession()
{
- if (inPrivateBrowsingMode()) {
- ASSERT(privateBrowsingStorageSession);
- return privateBrowsingStorageSession;
- }
- // FIXME (NetworkProcess): Return a default session that's used for testing.
- return 0;
+ ASSERT(privateBrowsingStorageSession());
+ return *privateBrowsingStorageSession();
}
NSOperationQueue *RemoteNetworkingContext::scheduledOperationQueue() const
void RemoteNetworkingContext::ensurePrivateBrowsingSession()
{
- ASSERT(isMainThread());
- if (privateBrowsingStorageSession)
+ if (privateBrowsingStorageSession())
return;
ASSERT(!privateBrowsingStorageSessionIdentifierBase().isNull());
RetainPtr<CFStringRef> cfIdentifier = String(privateBrowsingStorageSessionIdentifierBase() + ".PrivateBrowsing").createCFString();
- privateBrowsingStorageSession = WKCreatePrivateStorageSession(cfIdentifier.get());
+ privateBrowsingStorageSession() = NetworkStorageSession::createPrivateBrowsingSession(privateBrowsingStorageSessionIdentifierBase());
}
void RemoteNetworkingContext::destroyPrivateBrowsingSession()
{
- if (!privateBrowsingStorageSession)
- return;
-
- CFRelease(privateBrowsingStorageSession);
- privateBrowsingStorageSession = 0;
+ privateBrowsingStorageSession() = nullptr;
}
}
#import "WebCoreArgumentCoders.h"
#import "WebProcess.h"
#import <WebCore/KURL.h>
+#import <WebCore/ResourceError.h>
using namespace WebKit;
#include "Connection.h"
#include "ProcessExecutablePath.h"
+#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/FileSystem.h>
+#include <WebCore/NetworkingContext.h>
#include <WebCore/ResourceHandle.h>
#include <WebCore/RunLoop.h>
#include <wtf/text/CString.h>
#include "Connection.h"
#include "ProcessExecutablePath.h"
+#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/FileSystem.h>
+#include <WebCore/NetworkingContext.h>
#include <WebCore/ResourceHandle.h>
#include <WebCore/RunLoop.h>
#include <errno.h>
E1B78473163F253E0007B692 /* RemoteNetworkingContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B78472163F253E0007B692 /* RemoteNetworkingContext.mm */; };
E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CC1B8E12D7EADF00625838 /* PrintInfo.h */; };
E1CC1B9112D7EADF00625838 /* PrintInfoMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */; };
- E1D229711652DC5200BAA4BD /* WebPlatformStrategiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1D2296E1652DB9C00BAA4BD /* WebPlatformStrategiesMac.mm */; };
E1EDFDA61628868E0039ECDA /* MainMacProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FA31011E3921E00DB1371 /* MainMacProcess.cpp */; };
E1EDFDA7162886960039ECDA /* SharedWorkerProcessMainMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1EDFD9B16287D0B0039ECDA /* SharedWorkerProcessMainMac.mm */; };
E1EDFDA8162886990039ECDA /* SharedWorkerProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1EDFDA21628838C0039ECDA /* SharedWorkerProcessMac.mm */; };
E1B78472163F253E0007B692 /* RemoteNetworkingContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteNetworkingContext.mm; sourceTree = "<group>"; };
E1CC1B8E12D7EADF00625838 /* PrintInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintInfo.h; sourceTree = "<group>"; };
E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrintInfoMac.mm; sourceTree = "<group>"; };
- E1D2296E1652DB9C00BAA4BD /* WebPlatformStrategiesMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPlatformStrategiesMac.mm; sourceTree = "<group>"; };
E1EDFD9816287BD10039ECDA /* SharedWorkerProcessMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedWorkerProcessMain.h; sourceTree = "<group>"; };
E1EDFD9B16287D0B0039ECDA /* SharedWorkerProcessMainMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedWorkerProcessMainMac.mm; sourceTree = "<group>"; };
E1EDFD9D16287F190039ECDA /* SharedWorkerProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedWorkerProcess.h; sourceTree = "<group>"; };
BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */,
9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */,
9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */,
- E1D2296E1652DB9C00BAA4BD /* WebPlatformStrategiesMac.mm */,
BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */,
BCC57159115ADAEF001CCAF9 /* WebSystemInterface.h */,
BCC5715A115ADAEF001CCAF9 /* WebSystemInterface.mm */,
51217460164C20E30037A5C1 /* ShareableResource.cpp in Sources */,
51217464164C21370037A5C1 /* WebResourceBuffer.cpp in Sources */,
1AF1AC6B1651759E00C17D7F /* RemoteLayerTreeTransaction.mm in Sources */,
- E1D229711652DC5200BAA4BD /* WebPlatformStrategiesMac.mm in Sources */,
1AA3D75B1651B44F008713D0 /* RemoteLayerTreeHost.mm in Sources */,
1AA3D7611651B7D3008713D0 /* RemoteLayerTreeHostMessageReceiver.cpp in Sources */,
51FD18B51651FBAD00DBE1CE /* NetworkResourceLoader.cpp in Sources */,
#include "WebCookieManagerProxyMessages.h"
#include "WebProcess.h"
#include <WebCore/CookieStorage.h>
+#include <WebCore/NetworkStorageSession.h>
#include <WebCore/PlatformCookieJar.h>
using namespace WebCore;
{
HashSet<String> hostnames;
- WebCore::getHostnamesWithCookies(0, hostnames);
+ WebCore::getHostnamesWithCookies(NetworkStorageSession::defaultStorageSession(), hostnames);
Vector<String> hostnameList;
copyToVector(hostnames, hostnameList);
void WebCookieManager::deleteCookiesForHostname(const String& hostname)
{
- WebCore::deleteCookiesForHostname(0, hostname);
+ WebCore::deleteCookiesForHostname(NetworkStorageSession::defaultStorageSession(), hostname);
}
void WebCookieManager::deleteAllCookies()
{
- WebCore::deleteAllCookies(0);
+ WebCore::deleteAllCookies(NetworkStorageSession::defaultStorageSession());
}
void WebCookieManager::startObservingCookieChanges()
#pragma warning(push, 0)
#include <WebCore/AuthenticationCF.h>
+#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/DownloadBundle.h>
#include <WebCore/LoaderRunLoopCF.h>
#include <WebCore/NotImplemented.h>
#include "DownloadSoupErrors.h"
#include <WebCore/ErrorsEfl.h>
+#include <WebCore/ResourceError.h>
using namespace WebCore;
#include "DownloadSoupErrors.h"
#include <WebCore/ErrorsGtk.h>
+#include <WebCore/ResourceError.h>
using namespace WebCore;
#import "config.h"
#import "Download.h"
+#import <WebCore/AuthenticationChallenge.h>
#import <WebCore/AuthenticationMac.h>
#import <WebCore/NotImplemented.h>
#import <WebCore/ResourceHandle.h>
#include <WebCore/RuntimeEnabledFeatures.h>
#endif
+#if PLATFORM(MAC)
+#include "WebSystemInterface.h"
+#endif
+
using namespace WebCore;
using namespace JSC;
{
#if (PLATFORM(MAC) || USE(CFNETWORK)) && !PLATFORM(WIN)
// FIXME (NetworkProcess): Do this in network process, too.
- WebFrameNetworkingContext::switchToNewTestingSession();
+ InitWebCoreSystemInterface();
+ NetworkStorageSession::switchToNewTestingSession();
#endif
}
#include "WebCoreArgumentCoders.h"
#include "WebErrors.h"
#include "WebProcess.h"
+#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/ResourceLoader.h>
using namespace WebCore;
#include <WebCore/Color.h>
#include <WebCore/KURL.h>
#include <WebCore/LoaderStrategy.h>
+#include <WebCore/NetworkStorageSession.h>
#include <WebCore/Page.h>
#include <WebCore/PlatformCookieJar.h>
#include <WebCore/PlatformPasteboard.h>
WebCookieManager::shared().dispatchCookiesDidChange();
}
-#if PLATFORM(WIN) && USE(CFNETWORK)
-RetainPtr<CFHTTPCookieStorageRef> WebPlatformStrategies::defaultCookieStorage()
-{
- return 0;
-}
-#endif
-
-String WebPlatformStrategies::cookiesForDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
#if ENABLE(NETWORK_PROCESS)
if (WebProcess::shared().usesNetworkProcess()) {
String result;
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(context && context->inPrivateBrowsingMode(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
+ if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
return String();
return result;
}
#endif
- return WebCore::cookiesForDOM(context, firstParty, url);
+ return WebCore::cookiesForDOM(session, firstParty, url);
}
-void WebPlatformStrategies::setCookiesFromDOM(NetworkingContext* context, const KURL& firstParty, const KURL& url, const String& cookieString)
+void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, const String& cookieString)
{
#if ENABLE(NETWORK_PROCESS)
if (WebProcess::shared().usesNetworkProcess()) {
- WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(context && context->inPrivateBrowsingMode(), firstParty, url, cookieString), 0);
+ WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(session.isPrivateBrowsingSession(), firstParty, url, cookieString), 0);
return;
}
#endif
- WebCore::setCookiesFromDOM(context, firstParty, url, cookieString);
+ WebCore::setCookiesFromDOM(session, firstParty, url, cookieString);
}
-bool WebPlatformStrategies::cookiesEnabled(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
#if ENABLE(NETWORK_PROCESS)
if (WebProcess::shared().usesNetworkProcess()) {
bool result;
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(context && context->inPrivateBrowsingMode(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
+ if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
return false;
return result;
}
#endif
- return WebCore::cookiesEnabled(context, firstParty, url);
+ return WebCore::cookiesEnabled(session, firstParty, url);
}
-String WebPlatformStrategies::cookieRequestHeaderFieldValue(NetworkingContext* context, const KURL& firstParty, const KURL& url)
+String WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url)
{
#if ENABLE(NETWORK_PROCESS)
if (WebProcess::shared().usesNetworkProcess()) {
String result;
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(context && context->inPrivateBrowsingMode(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))
+ if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))
return String();
return result;
}
#endif
- return WebCore::cookieRequestHeaderFieldValue(context, firstParty, url);
+ return WebCore::cookieRequestHeaderFieldValue(session, firstParty, url);
}
-bool WebPlatformStrategies::getRawCookies(NetworkingContext* context, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
+bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const KURL& firstParty, const KURL& url, Vector<Cookie>& rawCookies)
{
#if ENABLE(NETWORK_PROCESS)
if (WebProcess::shared().usesNetworkProcess()) {
- if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(context && context->inPrivateBrowsingMode(), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
+ if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
return false;
return true;
}
#endif
- return WebCore::getRawCookies(context, firstParty, url, rawCookies);
+ return WebCore::getRawCookies(session, firstParty, url, rawCookies);
}
-void WebPlatformStrategies::deleteCookie(NetworkingContext* context, const KURL& url, const String& cookieName)
+void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const KURL& url, const String& cookieName)
{
#if ENABLE(NETWORK_PROCESS)
if (WebProcess::shared().usesNetworkProcess()) {
- WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie(context && context->inPrivateBrowsingMode(), url, cookieName), 0);
+ WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie(session.isPrivateBrowsingSession(), url, cookieName), 0);
return;
}
#endif
- WebCore::deleteCookie(context, url, cookieName);
+ WebCore::deleteCookie(session, url, cookieName);
}
// DatabaseStrategy
// WebCore::CookiesStrategy
virtual void notifyCookiesChanged() OVERRIDE;
-#if PLATFORM(MAC) || USE(CFNETWORK)
- virtual RetainPtr<CFHTTPCookieStorageRef> defaultCookieStorage() OVERRIDE;
-#endif
- virtual String cookiesForDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
- virtual void setCookiesFromDOM(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&) OVERRIDE;
- virtual bool cookiesEnabled(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
- virtual String cookieRequestHeaderFieldValue(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
- virtual bool getRawCookies(WebCore::NetworkingContext*, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&) OVERRIDE;
- virtual void deleteCookie(WebCore::NetworkingContext*, const WebCore::KURL&, const String&) OVERRIDE;
+ virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
+ virtual void setCookiesFromDOM(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, const String&) OVERRIDE;
+ virtual bool cookiesEnabled(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
+ virtual String cookieRequestHeaderFieldValue(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&) OVERRIDE;
+ virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::KURL& firstParty, const WebCore::KURL&, Vector<WebCore::Cookie>&) OVERRIDE;
+ virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::KURL&, const String&) OVERRIDE;
// WebCore::DatabaseStrategy
#if ENABLE(SQL_DATABASE)
}
static void setPrivateBrowsingStorageSessionIdentifierBase(const String&);
- static void switchToNewTestingSession();
static void ensurePrivateBrowsingSession();
static void destroyPrivateBrowsingSession();
- static CFURLStorageSessionRef defaultStorageSession();
static void setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy);
private:
virtual bool needsSiteSpecificQuirks() const OVERRIDE;
virtual bool localFileContentSniffingEnabled() const OVERRIDE;
- virtual bool inPrivateBrowsingMode() const OVERRIDE;
- virtual CFURLStorageSessionRef storageSession() const OVERRIDE;
+ virtual WebCore::NetworkStorageSession& storageSession() const OVERRIDE;
virtual WebCore::SchedulePairHashSet* scheduledRunLoopPairs() const OVERRIDE;
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const OVERRIDE;
};
#import "config.h"
#import "WebFrameNetworkingContext.h"
-#import <WebCore/CookieStorageCFNet.h>
#import <WebCore/FrameLoaderClient.h>
#import <WebCore/Page.h>
#import <WebCore/ResourceError.h>
namespace WebKit {
-static CFURLStorageSessionRef defaultCFStorageSession;
-static CFURLStorageSessionRef privateBrowsingStorageSession;
+static OwnPtr<NetworkStorageSession>& privateBrowsingStorageSession()
+{
+ DEFINE_STATIC_LOCAL(OwnPtr<NetworkStorageSession>, session, ());
+ return session;
+}
bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
{
privateBrowsingStorageSessionIdentifierBase() = identifier;
}
-void WebFrameNetworkingContext::switchToNewTestingSession()
-{
- // Set a private session for testing to avoid interfering with global cookies. This should be different from private browsing session.
- if (defaultCFStorageSession)
- CFRelease(defaultCFStorageSession);
- defaultCFStorageSession = WKCreatePrivateStorageSession(CFSTR("Private WebKit Session"));
-}
-
void WebFrameNetworkingContext::ensurePrivateBrowsingSession()
{
// FIXME (NetworkProcess): Don't create an unnecessary session when using network process.
ASSERT(isMainThread());
- if (privateBrowsingStorageSession)
+ if (privateBrowsingStorageSession())
return;
- String base = privateBrowsingStorageSessionIdentifierBase().isNull() ? String([[NSBundle mainBundle] bundleIdentifier]) : privateBrowsingStorageSessionIdentifierBase();
- RetainPtr<CFStringRef> cfIdentifier = String(base + ".PrivateBrowsing").createCFString();
+ String identifierBase = privateBrowsingStorageSessionIdentifierBase().isNull() ? String([[NSBundle mainBundle] bundleIdentifier]) : privateBrowsingStorageSessionIdentifierBase();
- privateBrowsingStorageSession = WKCreatePrivateStorageSession(cfIdentifier.get());
+ privateBrowsingStorageSession() = NetworkStorageSession::createPrivateBrowsingSession(identifierBase);
}
void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
if (!privateBrowsingStorageSession)
return;
- CFRelease(privateBrowsingStorageSession);
- privateBrowsingStorageSession = 0;
-}
-
-CFURLStorageSessionRef WebFrameNetworkingContext::defaultStorageSession()
-{
- return defaultCFStorageSession;
-}
-
-bool WebFrameNetworkingContext::inPrivateBrowsingMode() const
-{
- return frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled();
+ privateBrowsingStorageSession() = nullptr;
}
-CFURLStorageSessionRef WebFrameNetworkingContext::storageSession() const
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
{
- if (inPrivateBrowsingMode()) {
- ASSERT(privateBrowsingStorageSession);
- return privateBrowsingStorageSession;
+ bool inPrivateBrowsingMode = frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled();
+ if (inPrivateBrowsingMode) {
+ ASSERT(privateBrowsingStorageSession());
+ return *privateBrowsingStorageSession();
}
- return defaultCFStorageSession;
+ return NetworkStorageSession::defaultStorageSession();
}
void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy policy)
{
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast<NSHTTPCookieAcceptPolicy>(policy)];
- if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = defaultCFHTTPCookieStorage())
+ if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage())
WKSetHTTPCookieAcceptPolicy(cookieStorage.get(), policy);
- if (privateBrowsingStorageSession) {
- RetainPtr<CFHTTPCookieStorageRef> privateBrowsingCookieStorage = adoptCF(WKCopyHTTPCookieStorage(privateBrowsingStorageSession));
- WKSetHTTPCookieAcceptPolicy(privateBrowsingCookieStorage.get(), policy);
+ if (privateBrowsingStorageSession()) {
+ WKSetHTTPCookieAcceptPolicy(privateBrowsingStorageSession()->cookieStorage().get(), policy);
}
}
virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const;
#if USE(CFNETWORK)
- virtual bool inPrivateBrowsingMode() const;
- virtual CFURLStorageSessionRef storageSession() const;
+ virtual WebCore::NetworkStorageSession& storageSession() const;
#endif
String m_userAgent;
#include <WebCore/JSElement.h>
#include <WebCore/JSRange.h>
#include <WebCore/MainResourceLoader.h>
+#include <WebCore/NetworkingContext.h>
#include <WebCore/NodeTraversal.h>
#include <WebCore/Page.h>
#include <WebCore/PluginDocument.h>
#if ENABLE(NETWORK_PROCESS)
if (WebProcess::shared().usesNetworkProcess()) {
- bool privateBrowsingEnabled = m_coreFrame->loader()->networkingContext()->inPrivateBrowsingMode();
+ bool privateBrowsingEnabled = m_coreFrame->loader()->networkingContext()->storageSession().isPrivateBrowsingSession();
WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::StartDownload(privateBrowsingEnabled, policyDownloadID, request), 0);
return;
}
#import <WebCore/HitTestResult.h>
#import <WebCore/HTMLConverter.h>
#import <WebCore/KeyboardEvent.h>
+#import <WebCore/NetworkingContext.h>
#import <WebCore/Page.h>
#import <WebCore/PlatformKeyboardEvent.h>
#import <WebCore/ResourceHandle.h>
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
[request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
NSCachedURLResponse *cachedResponse;
- if (CFURLStorageSessionRef storageSession = corePage()->mainFrame()->loader()->networkingContext()->storageSession())
+ if (CFURLStorageSessionRef storageSession = corePage()->mainFrame()->loader()->networkingContext()->storageSession().platformSession())
cachedResponse = WKCachedResponseForRequest(storageSession, request);
else
cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
RetainPtr<NSMutableURLRequest> request(AdoptNS, [[NSMutableURLRequest alloc] initWithURL:url]);
[request.get() setValue:(NSString *)webPage->userAgent() forHTTPHeaderField:@"User-Agent"];
- if (CFURLStorageSessionRef storageSession = webPage->corePage()->mainFrame()->loader()->networkingContext()->storageSession())
+ if (CFURLStorageSessionRef storageSession = webPage->corePage()->mainFrame()->loader()->networkingContext()->storageSession().platformSession())
return WKCachedResponseForRequest(storageSession, request.get());
return [[NSURLCache sharedURLCache] cachedResponseForRequest:request.get()];
#include <JavaScriptCore/MemoryStatistics.h>
#include <WebCore/AXObjectCache.h>
#include <WebCore/ApplicationCacheStorage.h>
+#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/CrossOriginPreflightResultCache.h>
#include <WebCore/Font.h>
#include <WebCore/FontCache.h>
#include "WKBase.h"
#include <Ecore.h>
#include <Efreet.h>
+#include <WebCore/AuthenticationChallenge.h>
+#include <WebCore/NetworkingContext.h>
#include <WebCore/ResourceHandle.h>
#include <WebCore/RunLoop.h>
#include <WebKit2/WebProcess.h>
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
#include "WKBase.h"
+#include <WebCore/AuthenticationChallenge.h>
+#include <WebCore/NetworkingContext.h>
#include <WebCore/ResourceHandle.h>
#include <WebCore/RunLoop.h>
#include <WebKit2/WebProcess.h>