window.testRunner.keepWebHistory() should update the UI process state
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 May 2014 21:53:47 +0000 (21:53 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 May 2014 21:53:47 +0000 (21:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132440

Reviewed by Dan Bernstein.

Source/WebKit2:
* UIProcess/API/C/WKPage.cpp:
(WKPageGetAddsVisitedLinks):
(WKPageSetAddsVisitedLinks):
* UIProcess/API/C/WKPagePrivate.h:

Tools:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::postSetAddsVisitedLinks):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::keepWebHistory):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::invoke):
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/TestInvocation.cpp

index b3f25ce..b82ccfa 100644 (file)
@@ -1,3 +1,15 @@
+2014-05-01  Anders Carlsson  <andersca@apple.com>
+
+        window.testRunner.keepWebHistory() should update the UI process state
+        https://bugs.webkit.org/show_bug.cgi?id=132440
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageGetAddsVisitedLinks):
+        (WKPageSetAddsVisitedLinks):
+        * UIProcess/API/C/WKPagePrivate.h:
+
 2014-05-01  Filip Pizlo  <fpizlo@apple.com>
 
         Roll out r60161.
index c840e82..cad40b4 100644 (file)
@@ -1787,6 +1787,16 @@ void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinn
     toImpl(page)->setScrollPinningBehavior(corePinning);
 }
 
+bool WKPageGetAddsVisitedLinks(WKPageRef page)
+{
+    return toImpl(page)->addsVisitedLinks();
+}
+
+void WKPageSetAddsVisitedLinks(WKPageRef page, bool addsVisitedLinks)
+{
+    toImpl(page)->setAddsVisitedLinks(addsVisitedLinks);
+}
+
 void WKPageSetInvalidMessageFunction(WKPageInvalidMessageFunction)
 {
     // FIXME: Remove this function when doing so won't break WebKit nightlies.
index 1c8ed65..5175149 100644 (file)
@@ -111,6 +111,9 @@ typedef uint32_t WKScrollPinningBehavior;
 WK_EXPORT WKScrollPinningBehavior WKPageGetScrollPinningBehavior(WKPageRef page);
 WK_EXPORT void WKPageSetScrollPinningBehavior(WKPageRef page, WKScrollPinningBehavior pinning);
 
+WK_EXPORT bool WKPageGetAddsVisitedLinks(WKPageRef page);
+WK_EXPORT void WKPageSetAddsVisitedLinks(WKPageRef page, bool visitedLinks);
+
 #ifdef __cplusplus
 }
 #endif
index d47b74f..4506a13 100644 (file)
@@ -1,3 +1,19 @@
+2014-05-01  Anders Carlsson  <andersca@apple.com>
+
+        window.testRunner.keepWebHistory() should update the UI process state
+        https://bugs.webkit.org/show_bug.cgi?id=132440
+
+        Reviewed by Dan Bernstein.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::postSetAddsVisitedLinks):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::keepWebHistory):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::invoke):
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
 2014-05-01  David Kilzer  <ddkilzer@apple.com>
 
         Really remove ENABLE_PLUGIN_PROXY_FOR_VIDEO
index 83ee226..f79a003 100644 (file)
@@ -238,7 +238,6 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
     m_textInputController = TextInputController::create();
     m_accessibilityController = AccessibilityController::create();
 
-    WKBundleSetShouldTrackVisitedLinks(m_bundle, false);
     WKBundleRemoveAllVisitedLinks(m_bundle);
     WKBundleSetAllowUniversalAccessFromFileURLs(m_bundle, m_pageGroup, true);
     WKBundleSetJavaScriptCanAccessClipboard(m_bundle, m_pageGroup, true);
@@ -381,6 +380,13 @@ void InjectedBundle::postSimulateWebNotificationClick(uint64_t notificationID)
     WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
 }
 
+void InjectedBundle::postSetAddsVisitedLinks(bool addsVisitedLinks)
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAddsVisitedLinks"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(addsVisitedLinks));
+    WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+}
+
 void InjectedBundle::setGeolocationPermission(bool enabled)
 {
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetGeolocationPermission"));
index a3c30d6..e5f1f15 100644 (file)
@@ -86,6 +86,7 @@ public:
     void postSetBackingScaleFactor(double);
     void postSetWindowIsKey(bool);
     void postSimulateWebNotificationClick(uint64_t notificationID);
+    void postSetAddsVisitedLinks(bool);
 
     // Geolocation.
     void setGeolocationPermission(bool);
index 1585fd1..34467b2 100644 (file)
@@ -190,7 +190,7 @@ void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames)
 
 void TestRunner::keepWebHistory()
 {
-    WKBundleSetShouldTrackVisitedLinks(InjectedBundle::shared().bundle(), true);
+    InjectedBundle::shared().postSetAddsVisitedLinks(true);
 }
 
 void TestRunner::execCommand(JSStringRef name, JSStringRef argument)
index 5e76f39..bd20887 100644 (file)
@@ -36,6 +36,7 @@
 #include <WebKit2/WKData.h>
 #include <WebKit2/WKDictionary.h>
 #include <WebKit2/WKInspector.h>
+#include <WebKit2/WKPagePrivate.h>
 #include <WebKit2/WKRetainPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/StdLibExtras.h>
@@ -208,6 +209,8 @@ void TestInvocation::invoke()
     updateLayoutType(m_pathOrURL.c_str());
     updateThreadedScrollingForCurrentTest(m_pathOrURL.c_str());
 
+    WKPageSetAddsVisitedLinks(TestController::shared().mainWebView()->page(), false);
+
     m_textOutput.clear();
 
     TestController::shared().setShouldLogHistoryClientCallbacks(shouldLogHistoryClientCallbacks(m_pathOrURL.c_str()));
@@ -470,6 +473,13 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SetAddsVisitedLinks")) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef enabledWK = static_cast<WKBooleanRef>(messageBody);
+        WKPageSetAddsVisitedLinks(TestController::shared().mainWebView()->page(), WKBooleanGetValue(enabledWK));
+        return;
+    }
+
     if (WKStringIsEqualToUTF8CString(messageName, "SetGeolocationPermission")) {
         ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
         WKBooleanRef enabledWK = static_cast<WKBooleanRef>(messageBody);