Make HTTPCookieAcceptPolicy an enum class
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2019 21:08:23 +0000 (21:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2019 21:08:23 +0000 (21:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199081

Patch by Alex Christensen <achristensen@webkit.org> on 2019-06-25
Source/WebCore/PAL:

Reviewed by Michael Catanzaro

* pal/spi/cf/CFNetworkSPI.h:

Source/WebKit:

Reviewed by Michael Catanzaro.

Doing so reveals some interesting bugs in the C API that are also fixed:
WKPreferencesGetIncrementalRenderingSuppressionTimeout was using its toAPI function to convert a double to a double because HTTPCookieAcceptPolicy used to be an unsigned integer.
toAPI(WebCore::MouseButton) was also using the toAPI(HTTPCookieAcceptPolicy) because HTTPCookieAcceptPolicy used to be an unsigned integer.
Yikes!  Type safety is our friend.

* NetworkProcess/Cookies/WebCookieManager.messages.in:
* NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
(WebKit::toCFHTTPCookieStorageAcceptPolicy):
(WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
(WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
* Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
* Shared/HTTPCookieAcceptPolicy.h:
(): Deleted.
* UIProcess/API/C/WKAPICast.h:
(WebKit::toHTTPCookieAcceptPolicy):
(WebKit::toAPI):
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesGetIncrementalRenderingSuppressionTimeout):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(toHTTPCookieAcceptPolicy):
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebCookieManagerProxy.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246807 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Cookies/WebCookieManager.messages.in
Source/WebKit/NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp
Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm
Source/WebKit/NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/Shared/API/c/WKSharedAPICast.h
Source/WebKit/Shared/HTTPCookieAcceptPolicy.h
Source/WebKit/UIProcess/API/C/WKAPICast.h
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit/UIProcess/API/glib/WebKitCookieManager.cpp
Source/WebKit/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit/UIProcess/WebCookieManagerProxy.h
Source/WebKit/UIProcess/WebCookieManagerProxy.messages.in
Source/WebKit/UIProcess/WebProcessPool.h

index a289d0d..4bb87f5 100644 (file)
@@ -1,3 +1,12 @@
+2019-06-25  Alex Christensen  <achristensen@webkit.org>
+
+        Make HTTPCookieAcceptPolicy an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=199081
+
+        Reviewed by Michael Catanzaro
+
+        * pal/spi/cf/CFNetworkSPI.h:
+
 2019-06-19  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Network: replace CFNetwork SPI with new API where able
index 0857d45..38db2c5 100644 (file)
@@ -101,6 +101,14 @@ typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef;
 typedef CFIndex CFURLRequestPriority;
 typedef int CFHTTPCookieStorageAcceptPolicy;
 
+CF_ENUM(CFHTTPCookieStorageAcceptPolicy)
+{
+    CFHTTPCookieStorageAcceptPolicyAlways = 0,
+    CFHTTPCookieStorageAcceptPolicyNever = 1,
+    CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain = 2,
+    CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain = 3,
+};
+
 #ifdef __BLOCKS__
 typedef void (^CFCachedURLResponseCallBackBlock)(CFCachedURLResponseRef);
 #endif
index 3cba3d0..3606540 100644 (file)
@@ -1,3 +1,36 @@
+2019-06-25  Alex Christensen  <achristensen@webkit.org>
+
+        Make HTTPCookieAcceptPolicy an enum class
+        https://bugs.webkit.org/show_bug.cgi?id=199081
+
+        Reviewed by Michael Catanzaro.
+
+        Doing so reveals some interesting bugs in the C API that are also fixed:
+        WKPreferencesGetIncrementalRenderingSuppressionTimeout was using its toAPI function to convert a double to a double because HTTPCookieAcceptPolicy used to be an unsigned integer.
+        toAPI(WebCore::MouseButton) was also using the toAPI(HTTPCookieAcceptPolicy) because HTTPCookieAcceptPolicy used to be an unsigned integer.
+        Yikes!  Type safety is our friend.
+
+        * NetworkProcess/Cookies/WebCookieManager.messages.in:
+        * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
+        (WebKit::toCFHTTPCookieStorageAcceptPolicy):
+        (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toAPI):
+        * Shared/HTTPCookieAcceptPolicy.h:
+        (): Deleted.
+        * UIProcess/API/C/WKAPICast.h:
+        (WebKit::toHTTPCookieAcceptPolicy):
+        (WebKit::toAPI):
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesGetIncrementalRenderingSuppressionTimeout):
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (toHTTPCookieAcceptPolicy):
+        * UIProcess/WebCookieManagerProxy.cpp:
+        (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
+        * UIProcess/WebCookieManagerProxy.h:
+        * UIProcess/WebCookieManagerProxy.messages.in:
+
 2019-06-25  Tim Horton  <timothy_horton@apple.com>
 
         Wrong title for Data Detectors tap action menu
index 05bf243..518d11c 100644 (file)
@@ -35,7 +35,7 @@
     void DeleteCookie(PAL::SessionID sessionID, struct WebCore::Cookie cookie, WebKit::CallbackID callbackID)
     void DeleteAllCookiesModifiedSince(PAL::SessionID sessionID, WallTime time, WebKit::CallbackID callbackID)
 
-    void SetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::OptionalCallbackID callbackID)
+    void SetHTTPCookieAcceptPolicy(enum:uint8_t WebKit::HTTPCookieAcceptPolicy policy, WebKit::OptionalCallbackID callbackID)
     void GetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID)
     
     void StartObservingCookieChanges(PAL::SessionID sessionID)
index 4a829c2..80f3b49 100644 (file)
@@ -37,16 +37,16 @@ void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy
 {
     CookieAcceptPolicy curlPolicy = CookieAcceptPolicy::OnlyFromMainDocumentDomain;
     switch (policy) {
-    case HTTPCookieAcceptPolicyAlways:
+    case HTTPCookieAcceptPolicy::AlwaysAccept:
         curlPolicy = CookieAcceptPolicy::Always;
         break;
-    case HTTPCookieAcceptPolicyNever:
+    case HTTPCookieAcceptPolicy::Never:
         curlPolicy = CookieAcceptPolicy::Never;
         break;
-    case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+    case HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain:
         curlPolicy = CookieAcceptPolicy::OnlyFromMainDocumentDomain;
         break;
-    case HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
+    case HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain:
         curlPolicy = CookieAcceptPolicy::ExclusivelyFromMainDocumentDomain;
         break;
     }
@@ -61,17 +61,17 @@ HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
     const auto& networkStorageSession = m_process.defaultStorageSession();
     switch (networkStorageSession.cookieStorage().cookieAcceptPolicy(networkStorageSession)) {
     case CookieAcceptPolicy::Always:
-        return HTTPCookieAcceptPolicyAlways;
+        return HTTPCookieAcceptPolicy::AlwaysAccept;
     case CookieAcceptPolicy::Never:
-        return HTTPCookieAcceptPolicyNever;
+        return HTTPCookieAcceptPolicy::Never;
     case CookieAcceptPolicy::OnlyFromMainDocumentDomain:
-        return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+        return HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
     case CookieAcceptPolicy::ExclusivelyFromMainDocumentDomain:
-        return HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
+        return HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain;
     }
 
     ASSERT_NOT_REACHED();
-    return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+    return HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
 }
 
 } // namespace WebKit
index 7148e71..ee46ae5 100644 (file)
 namespace WebKit {
 using namespace WebCore;
 
+static CFHTTPCookieStorageAcceptPolicy toCFHTTPCookieStorageAcceptPolicy(HTTPCookieAcceptPolicy policy)
+{
+    switch (policy) {
+    case HTTPCookieAcceptPolicy::AlwaysAccept:
+        return CFHTTPCookieStorageAcceptPolicyAlways;
+    case HTTPCookieAcceptPolicy::Never:
+        return CFHTTPCookieStorageAcceptPolicyNever;
+    case HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain:
+        return CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain;
+    case HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain:
+        return CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain;
+    }
+    ASSERT_NOT_REACHED();
+
+    return CFHTTPCookieStorageAcceptPolicyAlways;
+}
+
 void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
 {
     ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
@@ -43,7 +60,7 @@ void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy
 
     m_process.forEachNetworkStorageSession([&] (const auto& networkStorageSession) {
         if (auto cookieStorage = networkStorageSession.cookieStorage())
-            CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
+            CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), toCFHTTPCookieStorageAcceptPolicy(policy));
     });
 }
 
@@ -51,7 +68,19 @@ HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
 {
     ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
 
-    return [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
+    switch ([[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy]) {
+    case NSHTTPCookieAcceptPolicyAlways:
+        return HTTPCookieAcceptPolicy::AlwaysAccept;
+    case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+        return HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
+    case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
+        return HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain;
+    case NSHTTPCookieAcceptPolicyNever:
+        return HTTPCookieAcceptPolicy::Never;
+    }
+
+    ASSERT_NOT_REACHED();
+    return HTTPCookieAcceptPolicy::AlwaysAccept;
 }
 
 } // namespace WebKit
index b85c9ae..ab571b6 100644 (file)
@@ -41,13 +41,13 @@ void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy
 {
     SoupCookieJarAcceptPolicy soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
     switch (policy) {
-    case HTTPCookieAcceptPolicyAlways:
+    case HTTPCookieAcceptPolicy::AlwaysAccept:
         soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
         break;
-    case HTTPCookieAcceptPolicyNever:
+    case HTTPCookieAcceptPolicy::Never:
         soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
         break;
-    case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+    case HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain:
         soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
         break;
     }
@@ -61,15 +61,15 @@ HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
 {
     switch (soup_cookie_jar_get_accept_policy(m_process.defaultStorageSession().cookieStorage())) {
     case SOUP_COOKIE_JAR_ACCEPT_ALWAYS:
-        return HTTPCookieAcceptPolicyAlways;
+        return HTTPCookieAcceptPolicy::AlwaysAccept;
     case SOUP_COOKIE_JAR_ACCEPT_NEVER:
-        return HTTPCookieAcceptPolicyNever;
+        return HTTPCookieAcceptPolicy::Never;
     case SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY:
-        return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+        return HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
     }
 
     ASSERT_NOT_REACHED();
-    return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+    return HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
 }
 
 void WebCookieManager::setCookiePersistentStorage(PAL::SessionID sessionID, const String& storagePath, SoupCookiePersistentStorageType storageType)
index 1777fae..81b154e 100644 (file)
@@ -86,7 +86,7 @@ struct NetworkProcessCreationParameters {
     WebsiteDataStoreParameters defaultDataStoreParameters;
     
 #if USE(SOUP)
-    HTTPCookieAcceptPolicy cookieAcceptPolicy { HTTPCookieAcceptPolicyAlways };
+    HTTPCookieAcceptPolicy cookieAcceptPolicy { HTTPCookieAcceptPolicy::AlwaysAccept };
     bool ignoreTLSErrors { false };
     Vector<String> languages;
     WebCore::SoupNetworkProxySettings proxySettings;
index 0d87e96..18cceb2 100644 (file)
@@ -55,6 +55,7 @@
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/LayoutMilestone.h>
+#include <WebCore/PlatformMouseEvent.h>
 #include <WebCore/SecurityOrigin.h>
 #include <WebCore/UserContentTypes.h>
 #include <WebCore/UserScriptTypes.h>
@@ -319,6 +320,28 @@ inline WKEventMouseButton toAPI(WebMouseEvent::Button mouseButton)
     return wkMouseButton;
 }
 
+inline WKEventMouseButton toAPI(WebCore::MouseButton mouseButton)
+{
+    WKEventMouseButton wkMouseButton = kWKEventMouseButtonNoButton;
+
+    switch (mouseButton) {
+    case WebCore::MouseButton::NoButton:
+        wkMouseButton = kWKEventMouseButtonNoButton;
+        break;
+    case WebCore::MouseButton::LeftButton:
+        wkMouseButton = kWKEventMouseButtonLeftButton;
+        break;
+    case WebCore::MouseButton::MiddleButton:
+        wkMouseButton = kWKEventMouseButtonMiddleButton;
+        break;
+    case WebCore::MouseButton::RightButton:
+        wkMouseButton = kWKEventMouseButtonRightButton;
+        break;
+    }
+
+    return wkMouseButton;
+}
+
 inline WKContextMenuItemTag toAPI(WebCore::ContextMenuAction action)
 {
     switch (action) {
index 4fe81b3..457c234 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef HTTPCookieAcceptPolicy_h
-#define HTTPCookieAcceptPolicy_h
+#pragma once
 
 namespace WebKit {
 
-enum {
-    HTTPCookieAcceptPolicyAlways = 0,
-    HTTPCookieAcceptPolicyNever = 1,
-    HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2,
-    HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3,
+enum class HTTPCookieAcceptPolicy : uint8_t {
+    AlwaysAccept = 0,
+    Never = 1,
+    OnlyFromMainDocumentDomain = 2,
+    ExclusivelyFromMainDocumentDomain = 3,
 };
-typedef unsigned HTTPCookieAcceptPolicy;
 
 } // namespace WebKit
 
-#endif // HTTPCookieAcceptPolicy_h
+namespace WTF {
+
+template<> struct EnumTraits<WebKit::HTTPCookieAcceptPolicy> {
+    using values = EnumValues<
+        WebKit::HTTPCookieAcceptPolicy,
+        WebKit::HTTPCookieAcceptPolicy::AlwaysAccept,
+        WebKit::HTTPCookieAcceptPolicy::Never,
+        WebKit::HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain,
+        WebKit::HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain
+    >;
+};
+
+}
index a30d597..c86603d 100644 (file)
@@ -367,29 +367,29 @@ inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WKHTTPCookieAcceptPolicy
 {
     switch (policy) {
     case kWKHTTPCookieAcceptPolicyAlways:
-        return HTTPCookieAcceptPolicyAlways;
+        return HTTPCookieAcceptPolicy::AlwaysAccept;
     case kWKHTTPCookieAcceptPolicyNever:
-        return HTTPCookieAcceptPolicyNever;
+        return HTTPCookieAcceptPolicy::Never;
     case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
-        return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+        return HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
     case kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
-        return HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
+        return HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain;
     }
 
     ASSERT_NOT_REACHED();
-    return HTTPCookieAcceptPolicyAlways;
+    return HTTPCookieAcceptPolicy::AlwaysAccept;
 }
 
 inline WKHTTPCookieAcceptPolicy toAPI(HTTPCookieAcceptPolicy policy)
 {
     switch (policy) {
-    case HTTPCookieAcceptPolicyAlways:
+    case HTTPCookieAcceptPolicy::AlwaysAccept:
         return kWKHTTPCookieAcceptPolicyAlways;
-    case HTTPCookieAcceptPolicyNever:
+    case HTTPCookieAcceptPolicy::Never:
         return kWKHTTPCookieAcceptPolicyNever;
-    case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+    case HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain:
         return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
-    case HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
+    case HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain:
         return kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
     }
 
index 460187a..a031798 100644 (file)
@@ -1307,7 +1307,7 @@ void WKPreferencesSetIncrementalRenderingSuppressionTimeout(WKPreferencesRef pre
 
 double WKPreferencesGetIncrementalRenderingSuppressionTimeout(WKPreferencesRef preferencesRef)
 {
-    return toAPI(toImpl(preferencesRef)->incrementalRenderingSuppressionTimeout());
+    return toImpl(preferencesRef)->incrementalRenderingSuppressionTimeout();
 }
 
 void WKPreferencesSetThreadedScrollingEnabled(WKPreferencesRef preferencesRef, bool enabled)
index b0ac76b..c06e1af 100644 (file)
@@ -207,17 +207,17 @@ static WebKit::HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(NSHTTPCookieAccep
 {
     switch (static_cast<NSUInteger>(policy)) {
     case NSHTTPCookieAcceptPolicyAlways:
-        return WebKit::HTTPCookieAcceptPolicyAlways;
+        return WebKit::HTTPCookieAcceptPolicy::AlwaysAccept;
     case NSHTTPCookieAcceptPolicyNever:
-        return WebKit::HTTPCookieAcceptPolicyNever;
+        return WebKit::HTTPCookieAcceptPolicy::Never;
     case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
-        return WebKit::HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+        return WebKit::HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
     case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
-        return WebKit::HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain;
+        return WebKit::HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain;
     }
 
     ASSERT_NOT_REACHED();
-    return WebKit::HTTPCookieAcceptPolicyAlways;
+    return WebKit::HTTPCookieAcceptPolicy::AlwaysAccept;
 }
 
 - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
index a1de2c2..8327ae9 100644 (file)
@@ -90,11 +90,11 @@ static inline SoupCookiePersistentStorageType toSoupCookiePersistentStorageType(
 static inline WebKitCookieAcceptPolicy toWebKitCookieAcceptPolicy(HTTPCookieAcceptPolicy httpPolicy)
 {
     switch (httpPolicy) {
-    case HTTPCookieAcceptPolicyAlways:
+    case HTTPCookieAcceptPolicy::AlwaysAccept:
         return WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS;
-    case HTTPCookieAcceptPolicyNever:
+    case HTTPCookieAcceptPolicy::Never:
         return WEBKIT_COOKIE_POLICY_ACCEPT_NEVER;
-    case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+    case HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain:
         return WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY;
     default:
         ASSERT_NOT_REACHED();
@@ -106,14 +106,14 @@ static inline HTTPCookieAcceptPolicy toHTTPCookieAcceptPolicy(WebKitCookieAccept
 {
     switch (kitPolicy) {
     case WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS:
-        return HTTPCookieAcceptPolicyAlways;
+        return HTTPCookieAcceptPolicy::AlwaysAccept;
     case WEBKIT_COOKIE_POLICY_ACCEPT_NEVER:
-        return HTTPCookieAcceptPolicyNever;
+        return HTTPCookieAcceptPolicy::Never;
     case WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY:
-        return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+        return HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain;
     default:
         ASSERT_NOT_REACHED();
-        return HTTPCookieAcceptPolicyAlways;
+        return HTTPCookieAcceptPolicy::AlwaysAccept;
     }
 }
 
index b144b9e..7432880 100644 (file)
@@ -258,7 +258,7 @@ void WebCookieManagerProxy::getHTTPCookieAcceptPolicy(PAL::SessionID, Function<v
     processPool()->sendToNetworkingProcess(Messages::WebCookieManager::GetHTTPCookieAcceptPolicy(callbackID));
 }
 
-void WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::CallbackID callbackID)
+void WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy, WebKit::CallbackID callbackID)
 {
     m_callbacks.take<HTTPCookieAcceptPolicyCallback>(callbackID)->performCallbackWithReturnValue(policy);
 }
index f73f9d0..673ad64 100644 (file)
@@ -109,7 +109,7 @@ private:
     WebCookieManagerProxy(WebProcessPool*);
 
     void didGetHostnamesWithCookies(const Vector<String>&, WebKit::CallbackID);
-    void didGetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::CallbackID);
+    void didGetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy, WebKit::CallbackID);
 
     void didSetHTTPCookieAcceptPolicy(WebKit::CallbackID);
     void didSetCookies(WebKit::CallbackID);
index 33df495..bb6723c 100644 (file)
@@ -22,7 +22,7 @@
 
 messages -> WebCookieManagerProxy {
     DidGetHostnamesWithCookies(Vector<String> hostnames, WebKit::CallbackID callbackID);
-    DidGetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::CallbackID callbackID);
+    DidGetHTTPCookieAcceptPolicy(enum:uint8_t WebKit::HTTPCookieAcceptPolicy policy, WebKit::CallbackID callbackID);
 
     DidSetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID);
     DidDeleteCookies(WebKit::CallbackID callbackID);
index 71f2051..5706852 100644 (file)
@@ -680,7 +680,7 @@ private:
     WebContextSupplementMap m_supplements;
 
 #if USE(SOUP)
-    HTTPCookieAcceptPolicy m_initialHTTPCookieAcceptPolicy { HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain };
+    HTTPCookieAcceptPolicy m_initialHTTPCookieAcceptPolicy { HTTPCookieAcceptPolicy::OnlyFromMainDocumentDomain };
     WebCore::SoupNetworkProxySettings m_networkProxySettings;
 #endif
     HashSet<String, ASCIICaseInsensitiveHash> m_urlSchemesRegisteredForCustomProtocols;