<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166396] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166396">166396</a></dd>
<dt>Author</dt> <dd>mrowe@apple.com</dd>
<dt>Date</dt> <dd>2014-03-27 21:06:58 -0700 (Thu, 27 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre><https://webkit.org/b/42704> WebKitTestRunner needs to print history delegate information
Tools:
Provide an implementation of WKContextHistoryClient that logs when called for tests in
the globalhistory directory.
Patch by Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> on 2014-03-27
Reviewed by Sam Weinig.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::TestController):
(WTR::TestController::initialize): Set the history client.
(WTR::TestController::resetStateToConsistentValues): Disable logging of history client callbacks.
(WTR::TestController::didNavigateWithNavigationData): Log information about the navigation. Some portions
of the output are hard-coded to match WebKit1's results for now since they're fixed in our existing tests
and we don't yet have API to access the data in question.
(WTR::TestController::didPerformClientRedirect):
(WTR::TestController::didPerformServerRedirect):
(WTR::TestController::didUpdateHistoryTitle):
* WebKitTestRunner/TestController.h:
(WTR::TestController::setShouldLogHistoryClientCallbacks):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::shouldLogHistoryClientCallbacks): Log history client callbacks for tests in a globalhistory directory.
(WTR::TestInvocation::invoke):
LayoutTests:
Reviewed by Sam Weinig.
* platform/wk2/TestExpectations: Enable the two layout tests that pass. One test remains disabled
due to lack of testRunner API, and another due to an apparent bug in WebKit2's handling of
client redirects.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformwk2TestExpectations">trunk/LayoutTests/platform/wk2/TestExpectations</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllerh">trunk/Tools/WebKitTestRunner/TestController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (166395 => 166396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/LayoutTests/ChangeLog        2014-03-28 04:06:58 UTC (rev 166396)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-03-27 Mark Rowe <mrowe@apple.com>
+
+ <https://webkit.org/b/42704> WebKitTestRunner needs to print history delegate information
+
+ Reviewed by Sam Weinig.
+
+ * platform/wk2/TestExpectations: Enable the two layout tests that pass. One test remains disabled
+ due to lack of testRunner API, and another due to an apparent bug in WebKit2's handling of
+ client redirects.
+
</ins><span class="cx"> 2014-03-27 Oliver Hunt <oliver@apple.com>
</span><span class="cx">
</span><span class="cx"> Support spread operand in |new| expressions
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wk2/TestExpectations (166395 => 166396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wk2/TestExpectations        2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/LayoutTests/platform/wk2/TestExpectations        2014-03-28 04:06:58 UTC (rev 166396)
</span><span class="lines">@@ -175,13 +175,12 @@
</span><span class="cx"> # <https://bugs.webkit.org/show_bug.cgi?id=42777>
</span><span class="cx"> fast/loader/non-deferred-substitute-load.html
</span><span class="cx">
</span><del>-# WebKitTestRunner needs to print history delegate information
-# <https://bugs.webkit.org/show_bug.cgi?id=42704>
-http/tests/globalhistory/history-delegate-basic-302-redirect.html
-http/tests/globalhistory/history-delegate-basic-refresh-redirect.html
-http/tests/globalhistory/history-delegate-basic-title.html
</del><ins>+# WebKitTestRunner needs testRunner.removeAllVisitedLinks
</ins><span class="cx"> http/tests/globalhistory/history-delegate-basic-visited-links.html
</span><span class="cx">
</span><ins>+# WebKit2 passes the wrong source URL for client redirects
+http/tests/globalhistory/history-delegate-basic-refresh-redirect.html
+
</ins><span class="cx"> # transitions/default-timing-function.html failing on WebKit2 since it was added
</span><span class="cx"> # <https://bugs.webkit.org/show_bug.cgi?id=56531>
</span><span class="cx"> transitions/default-timing-function.html
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (166395 => 166396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/ChangeLog        2014-03-28 04:06:58 UTC (rev 166396)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-03-27 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
+
+ <https://webkit.org/b/42704> WebKitTestRunner needs to print history delegate information
+
+ Provide an implementation of WKContextHistoryClient that logs when called for tests in
+ the globalhistory directory.
+
+ Reviewed by Sam Weinig.
+
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::TestController):
+ (WTR::TestController::initialize): Set the history client.
+ (WTR::TestController::resetStateToConsistentValues): Disable logging of history client callbacks.
+ (WTR::TestController::didNavigateWithNavigationData): Log information about the navigation. Some portions
+ of the output are hard-coded to match WebKit1's results for now since they're fixed in our existing tests
+ and we don't yet have API to access the data in question.
+ (WTR::TestController::didPerformClientRedirect):
+ (WTR::TestController::didPerformServerRedirect):
+ (WTR::TestController::didUpdateHistoryTitle):
+ * WebKitTestRunner/TestController.h:
+ (WTR::TestController::setShouldLogHistoryClientCallbacks):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::shouldLogHistoryClientCallbacks): Log history client callbacks for tests in a globalhistory directory.
+ (WTR::TestInvocation::invoke):
+
</ins><span class="cx"> 2014-03-27 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Revert http://trac.webkit.org/changeset/166386 because it broke builds.
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (166395 => 166396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2014-03-28 04:06:58 UTC (rev 166396)
</span><span class="lines">@@ -121,6 +121,7 @@
</span><span class="cx"> , m_forceComplexText(false)
</span><span class="cx"> , m_shouldUseAcceleratedDrawing(false)
</span><span class="cx"> , m_shouldUseRemoteLayerTree(false)
</span><ins>+ , m_shouldLogHistoryClientCallbacks(false)
</ins><span class="cx"> {
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -369,6 +370,16 @@
</span><span class="cx"> };
</span><span class="cx"> WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient.base);
</span><span class="cx">
</span><ins>+ WKContextHistoryClientV0 historyClient = {
+ { 0, this },
+ didNavigateWithNavigationData,
+ didPerformClientRedirect,
+ didPerformServerRedirect,
+ didUpdateHistoryTitle,
+ 0, // populateVisitedLinks
+ };
+ WKContextSetHistoryClient(m_context.get(), &historyClient.base);
+
</ins><span class="cx"> WKNotificationManagerRef notificationManager = WKContextGetNotificationManager(m_context.get());
</span><span class="cx"> WKNotificationProviderV0 notificationKit = m_webNotificationProvider.provider();
</span><span class="cx"> WKNotificationManagerSetProvider(notificationManager, &notificationKit.base);
</span><span class="lines">@@ -635,6 +646,8 @@
</span><span class="cx">
</span><span class="cx"> m_shouldBlockAllPlugins = false;
</span><span class="cx">
</span><ins>+ m_shouldLogHistoryClientCallbacks = false;
+
</ins><span class="cx"> // Reset main page back to about:blank
</span><span class="cx"> m_doneResetting = false;
</span><span class="cx">
</span><span class="lines">@@ -1293,4 +1306,86 @@
</span><span class="cx"> WKFramePolicyListenerIgnore(listener);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TestController::didNavigateWithNavigationData(WKContextRef, WKPageRef, WKNavigationDataRef navigationData, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didNavigateWithNavigationData(navigationData, frame);
+}
+
+void TestController::didNavigateWithNavigationData(WKNavigationDataRef navigationData, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ // URL
+ WKRetainPtr<WKURLRef> urlWK = adoptWK(WKNavigationDataCopyURL(navigationData));
+ WKRetainPtr<WKStringRef> urlStringWK = adoptWK(WKURLCopyString(urlWK.get()));
+ // Title
+ WKRetainPtr<WKStringRef> titleWK = adoptWK(WKNavigationDataCopyTitle(navigationData));
+ // HTTP method
+ WKRetainPtr<WKURLRequestRef> requestWK = adoptWK(WKNavigationDataCopyOriginalRequest(navigationData));
+ WKRetainPtr<WKStringRef> methodWK = adoptWK(WKURLRequestCopyHTTPMethod(requestWK.get()));
+
+ // FIXME: Determine whether the navigation was successful / a client redirect rather than hard-coding the message here.
+ m_currentInvocation->outputText(String::format("WebView navigated to url \"%s\" with title \"%s\" with HTTP equivalent method \"%s\". The navigation was successful and was not a client redirect.\n",
+ toSTD(urlStringWK).c_str(), toSTD(titleWK).c_str(), toSTD(methodWK).c_str()));
+}
+
+void TestController::didPerformClientRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didPerformClientRedirect(sourceURL, destinationURL, frame);
+}
+
+void TestController::didPerformClientRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ WKRetainPtr<WKStringRef> sourceStringWK = adoptWK(WKURLCopyString(sourceURL));
+ WKRetainPtr<WKStringRef> destinationStringWK = adoptWK(WKURLCopyString(destinationURL));
+
+ m_currentInvocation->outputText(String::format("WebView performed a client redirect from \"%s\" to \"%s\".\n", toSTD(sourceStringWK).c_str(), toSTD(destinationStringWK).c_str()));
+}
+
+void TestController::didPerformServerRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didPerformServerRedirect(sourceURL, destinationURL, frame);
+}
+
+void TestController::didPerformServerRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ WKRetainPtr<WKStringRef> sourceStringWK = adoptWK(WKURLCopyString(sourceURL));
+ WKRetainPtr<WKStringRef> destinationStringWK = adoptWK(WKURLCopyString(destinationURL));
+
+ m_currentInvocation->outputText(String::format("WebView performed a server redirect from \"%s\" to \"%s\".\n", toSTD(sourceStringWK).c_str(), toSTD(destinationStringWK).c_str()));
+}
+
+void TestController::didUpdateHistoryTitle(WKContextRef, WKPageRef, WKStringRef title, WKURLRef URL, WKFrameRef frame, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didUpdateHistoryTitle(title, URL, frame);
+}
+
+void TestController::didUpdateHistoryTitle(WKStringRef title, WKURLRef URL, WKFrameRef)
+{
+ if (m_state != RunningTest)
+ return;
+
+ if (!m_shouldLogHistoryClientCallbacks)
+ return;
+
+ WKRetainPtr<WKStringRef> urlStringWK(AdoptWK, WKURLCopyString(URL));
+ m_currentInvocation->outputText(String::format("WebView updated the title for history URL \"%s\" to \"%s\".\n", toSTD(urlStringWK).c_str(), toSTD(title).c_str()));
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.h (166395 => 166396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.h        2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/WebKitTestRunner/TestController.h        2014-03-28 04:06:58 UTC (rev 166396)
</span><span class="lines">@@ -104,6 +104,8 @@
</span><span class="cx">
</span><span class="cx"> void setBlockAllPlugins(bool shouldBlock) { m_shouldBlockAllPlugins = shouldBlock; }
</span><span class="cx">
</span><ins>+ void setShouldLogHistoryClientCallbacks(bool shouldLog) { m_shouldLogHistoryClientCallbacks = shouldLog; }
+
</ins><span class="cx"> private:
</span><span class="cx"> void initialize(int argc, const char* argv[]);
</span><span class="cx"> void createWebViewWithOptions(WKDictionaryRef);
</span><span class="lines">@@ -159,6 +161,19 @@
</span><span class="cx"> static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, bool canShowMIMEType, WKFramePolicyListenerRef, WKTypeRef, const void*);
</span><span class="cx"> void decidePolicyForResponse(WKFrameRef, WKURLResponseRef, WKFramePolicyListenerRef);
</span><span class="cx">
</span><ins>+ // WKContextHistoryClient
+ static void didNavigateWithNavigationData(WKContextRef, WKPageRef, WKNavigationDataRef, WKFrameRef, const void*);
+ void didNavigateWithNavigationData(WKNavigationDataRef, WKFrameRef);
+
+ static void didPerformClientRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void*);
+ void didPerformClientRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef);
+
+ static void didPerformServerRedirect(WKContextRef, WKPageRef, WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef, const void*);
+ void didPerformServerRedirect(WKURLRef sourceURL, WKURLRef destinationURL, WKFrameRef);
+
+ static void didUpdateHistoryTitle(WKContextRef, WKPageRef, WKStringRef title, WKURLRef, WKFrameRef, const void*);
+ void didUpdateHistoryTitle(WKStringRef title, WKURLRef, WKFrameRef);
+
</ins><span class="cx"> static WKPageRef createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*);
</span><span class="cx">
</span><span class="cx"> static void runModal(WKPageRef, const void* clientInfo);
</span><span class="lines">@@ -223,6 +238,8 @@
</span><span class="cx"> bool m_shouldUseAcceleratedDrawing;
</span><span class="cx"> bool m_shouldUseRemoteLayerTree;
</span><span class="cx">
</span><ins>+ bool m_shouldLogHistoryClientCallbacks;
+
</ins><span class="cx"> OwnPtr<EventSenderProxy> m_eventSenderProxy;
</span><span class="cx">
</span><span class="cx"> WorkQueueManager m_workQueueManager;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (166395 => 166396)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2014-03-28 03:52:01 UTC (rev 166395)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2014-03-28 04:06:58 UTC (rev 166396)
</span><span class="lines">@@ -146,6 +146,11 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+static bool shouldLogHistoryClientCallbacks(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "globalhistory/");
+}
+
</ins><span class="cx"> static void updateThreadedScrollingForCurrentTest(const char* pathOrURL)
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -200,6 +205,8 @@
</span><span class="cx">
</span><span class="cx"> m_textOutput.clear();
</span><span class="cx">
</span><ins>+ TestController::shared().setShouldLogHistoryClientCallbacks(shouldLogHistoryClientCallbacks(m_pathOrURL.c_str()));
+
</ins><span class="cx"> WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("BeginTest"));
</span><span class="cx"> WKRetainPtr<WKMutableDictionaryRef> beginTestMessageBody = adoptWK(WKMutableDictionaryCreate());
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>