Title: [123316] trunk
Revision
123316
Author
[email protected]
Date
2012-07-23 01:33:26 -0700 (Mon, 23 Jul 2012)

Log Message

WebKit2 needs layoutTestController.setAlwaysAcceptCookies
https://bugs.webkit.org/show_bug.cgi?id=42778

Patch by Christophe Dumez <[email protected]> on 2012-07-23
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Add setAlwaysAcceptCookies() method to InjectedBundle
so that we can use it in LayoutTestController.
The method uses WebCookieManager::setHTTPCookieAcceptPolicy()
internally.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetAlwaysAcceptCookies):
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setAlwaysAcceptCookies):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundle.h:
(InjectedBundle):

Tools:

Add support for layoutTestController.setAlwaysAcceptCookies()
since it is required by some tests.

* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::setAlwaysAcceptCookies):
(WTR):
* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
(LayoutTestController):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (123315 => 123316)


--- trunk/Source/WebKit2/ChangeLog	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-23 08:33:26 UTC (rev 123316)
@@ -1,3 +1,24 @@
+2012-07-23  Christophe Dumez  <[email protected]>
+
+        WebKit2 needs layoutTestController.setAlwaysAcceptCookies
+        https://bugs.webkit.org/show_bug.cgi?id=42778
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add setAlwaysAcceptCookies() method to InjectedBundle
+        so that we can use it in LayoutTestController.
+        The method uses WebCookieManager::setHTTPCookieAcceptPolicy()
+        internally.
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleSetAlwaysAcceptCookies):
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setAlwaysAcceptCookies):
+        (WebKit):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        (InjectedBundle):
+
 2012-07-23  Thiago Marcos P. Santos  <[email protected]>
 
         [WK2] SQL Database cannot be disabled at build time

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (123315 => 123316)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-07-23 08:33:26 UTC (rev 123316)
@@ -91,6 +91,11 @@
     return toImpl(bundleRef)->_javascript_ObjectsCount();
 }
 
+void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundleRef, bool accept)
+{
+    toImpl(bundleRef)->setAlwaysAcceptCookies(accept);
+}
+
 void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef)
 {
     toImpl(bundleRef)->addUserScript(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserScriptInjectionTime(injectionTimeRef), toUserContentInjectedFrames(injectedFramesRef));

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (123315 => 123316)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-07-23 08:33:26 UTC (rev 123316)
@@ -86,6 +86,7 @@
 WK_EXPORT void WKBundleAddOriginAccessWhitelistEntry(WKBundleRef bundle, WKStringRef, WKStringRef, WKStringRef, bool);
 WK_EXPORT void WKBundleRemoveOriginAccessWhitelistEntry(WKBundleRef bundle, WKStringRef, WKStringRef, WKStringRef, bool);
 WK_EXPORT void WKBundleResetOriginAccessWhitelists(WKBundleRef bundle);
+WK_EXPORT void WKBundleSetAlwaysAcceptCookies(WKBundleRef bundle, bool);
 
 WK_EXPORT bool WKBundleIsProcessingUserGesture(WKBundleRef bundle);
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (123315 => 123316)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-07-23 08:33:26 UTC (rev 123316)
@@ -36,6 +36,7 @@
 #include "WKBundleAPICast.h"
 #include "WebApplicationCacheManager.h"
 #include "WebContextMessageKinds.h"
+#include "WebCookieManager.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebDatabaseManager.h"
 #include "WebFrame.h"
@@ -114,6 +115,11 @@
     WebProcess::shared().setShouldTrackVisitedLinks(shouldTrackVisitedLinks);
 }
 
+void InjectedBundle::setAlwaysAcceptCookies(bool accept)
+{
+    WebCookieManager::shared().setHTTPCookieAcceptPolicy(accept ? HTTPCookieAcceptPolicyAlways : HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain);
+}
+
 void InjectedBundle::removeAllVisitedLinks()
 {
     PageGroup::removeAllVisitedLinks();

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (123315 => 123316)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-07-23 08:33:26 UTC (rev 123316)
@@ -101,6 +101,7 @@
 
     // TestRunner only SPI
     void setShouldTrackVisitedLinks(bool);
+    void setAlwaysAcceptCookies(bool);
     void removeAllVisitedLinks();
     void activateMacFontAscentHack();
     void overrideBoolPreferenceForTestRunner(WebPageGroupProxy*, const String& preference, bool enabled);

Modified: trunk/Tools/ChangeLog (123315 => 123316)


--- trunk/Tools/ChangeLog	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Tools/ChangeLog	2012-07-23 08:33:26 UTC (rev 123316)
@@ -1,3 +1,20 @@
+2012-07-23  Christophe Dumez  <[email protected]>
+
+        WebKit2 needs layoutTestController.setAlwaysAcceptCookies
+        https://bugs.webkit.org/show_bug.cgi?id=42778
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add support for layoutTestController.setAlwaysAcceptCookies()
+        since it is required by some tests.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::setAlwaysAcceptCookies):
+        (WTR):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+        (LayoutTestController):
+
 2012-07-23  Kent Tamura  <[email protected]>
 
         Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl (123315 => 123316)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl	2012-07-23 08:33:26 UTC (rev 123316)
@@ -139,6 +139,9 @@
 
         void setWindowIsKey(in boolean isKey);
 
+        // Cookies testing
+        void setAlwaysAcceptCookies(in boolean accept);
+
         // FIXME: handle non-boolean preferences.
         void overridePreference(in DOMString preference, in boolean value);
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (123315 => 123316)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-07-23 08:33:26 UTC (rev 123316)
@@ -613,6 +613,11 @@
     WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), value);
 }
 
+void LayoutTestController::setAlwaysAcceptCookies(bool accept)
+{
+    WKBundleSetAlwaysAcceptCookies(InjectedBundle::shared().bundle(), accept);
+}
+
 double LayoutTestController::preciseTime()
 {
     return currentTime();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h (123315 => 123316)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2012-07-23 08:30:11 UTC (rev 123315)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h	2012-07-23 08:33:26 UTC (rev 123316)
@@ -206,6 +206,9 @@
 
     void overridePreference(JSStringRef preference, bool value);
 
+    // Cookies testing
+    void setAlwaysAcceptCookies(bool);
+
     // Custom full screen behavior.
     void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; }
     bool hasCustomFullScreenBehavior() const { return m_customFullScreenBehavior; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to