<!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>[190065] 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/190065">190065</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-09-21 12:10:48 -0700 (Mon, 21 Sep 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add the ability for tests to run script in the UI process in WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=149356
Reviewed by Tim Horton.
Source/WebKit2:
Expose a few private functions for testing.
* UIProcess/API/Cocoa/WKWebView.mm:
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
Tools:
This change adds testRunner.runUIScript(script, callback), which allows a test
to execute script in a JSContext which runs in the UI process. That context
has bindings exposed through the UIScriptController interface; currently one test
function, and some iOS-specific functions are included. UIScriptController can be
async with a callback, and runUIScript() itself is asynchronous. When the UI
script is complete, it calls uiController.uiScriptComplete(result), where 'result'
is a string passed back to the web process, and given to the runUIScript()
callback function.
Thanks to Gyuyoung Kim for help with the Gtk/Efl build.
* WebKitTestRunner/DerivedSources.make: Build UIScriptController.idl.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Add runUIScript().
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage): When the UI-side script is
complete, call back into TestRunner.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::nextUIScriptCallbackID):
(WTR::TestRunner::runUIScript): Post a message to the injected bundle to run the UI script.
(WTR::TestRunner::runUIScriptCallback): When the UI script is done, execute its callback function.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/PlatformWebView.h:
* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader):
(WTR::TestController::testOptionsForTest): Support "useFlexibleViewport" as a test argument.
(WTR::shouldUseFixedLayout): Deleted. Moved to a TestInvocation function.
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::shouldUseFixedLayout):
(WTR::TestInvocation::shouldUseThreadedScrolling):
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
(WTR::TestInvocation::runUISideScript): Run the UI-side script!
(WTR::TestInvocation::uiScriptDidComplete): Send a message back to the injected bundle.
* WebKitTestRunner/TestInvocation.h:
* WebKitTestRunner/TestOptions.h:
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.h: Copied from Tools/WebKitTestRunner/TestOptions.h.
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: Added.
(-[TestRunnerWKWebView dragImage:at:offset:event:pasteboard:source:slideBack:]):
(-[TestRunnerWKWebView zoomToScale:animated:completionHandler:]):
(-[TestRunnerWKWebView scrollViewDidEndZooming:withView:atScale:]):
(-[TestRunnerWKWebView onDidEndZooming:]): Allow a test to hook into the end of zooming.
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::PlatformWebView): Make a TestRunnerWKWebView on iOS.
* WebKitTestRunner/ios/UIScriptControllerIOS.mm: Added.
(WTR::UIScriptController::doAsyncTask):
(WTR::UIScriptController::zoomToScale):
(WTR::UIScriptController::zoomScale):
(WTR::UIScriptController::minimumZoomScale):
(WTR::UIScriptController::maximumZoomScale):
(WTR::UIScriptController::contentVisibleRect):
* WebKitTestRunner/mac/EventSenderProxy.mm:
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(-[TestRunnerWKWebView dragImage:at:offset:event:pasteboard:source:slideBack:]): Deleted.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::updatePlatformSpecificTestOptionsForTest):
(WTR::shouldUseThreadedScrolling): Deleted. Moved to TestInvocation.
* WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h:
* WebKitTestRunner/uiscriptcontext/UIScriptContext.cpp: Added. Owns the JS context in the UI process.
(UIScriptContext::UIScriptContext):
(UIScriptContext::~UIScriptContext):
(UIScriptContext::runUIScript): Entrypoint to running the UI script. If the script didn't do anything
asynchronous, call the callback.
(UIScriptContext::nextTaskCallbackID):
(UIScriptContext::prepareForAsyncTask): Do setup for one async task (i.e. a UIScriptController function
that has a callback). Has to store the callbackID of the script, so code called from the completion
callback knows which UI script invoked it.
(UIScriptContext::asyncTaskComplete): Called when one task is finished.
(UIScriptContext::uiScriptComplete):
(UIScriptContext::objectFromRect): Make a JS object from a rect.
* WebKitTestRunner/uiscriptcontext/UIScriptContext.h: Copied from Tools/WebKitTestRunner/TestOptions.h.
(WTR::UIScriptContext::hasOutstandingAsyncTasks):
* WebKitTestRunner/uiscriptcontext/UIScriptController.cpp: Copied from Tools/WebKitTestRunner/TestOptions.h.
(WTR::UIScriptController::UIScriptController):
(WTR::UIScriptController::makeWindowObject):
(WTR::UIScriptController::wrapperClass):
(WTR::UIScriptController::doAsyncTask):
(WTR::UIScriptController::zoomToScale):
(WTR::UIScriptController::zoomScale):
(WTR::UIScriptController::minimumZoomScale):
(WTR::UIScriptController::maximumZoomScale):
(WTR::UIScriptController::contentVisibleRect):
(WTR::UIScriptController::uiScriptComplete):
* WebKitTestRunner/uiscriptcontext/UIScriptController.h: Copied from Tools/WebKitTestRunner/TestOptions.h.
(WTR::UIScriptController::create):
* WebKitTestRunner/uiscriptcontext/bindings/UIScriptController.idl: Copied from Tools/WebKitTestRunner/TestOptions.h.
LayoutTests:
Some new tests that exercise testRunner.runUIScript().
* TestExpectations:
* fast/harness/concurrent-ui-side-scripts-expected.txt: Added.
* fast/harness/concurrent-ui-side-scripts.html: Added.
* fast/harness/ui-side-scripts-expected.txt: Added.
* fast/harness/ui-side-scripts.html: Added.
* fast/zooming/zoom-to-scale.html: Added.
* platform/ios-simulator/TestExpectations:
* platform/mac/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2TestExpectations">trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerCMakeListstxt">trunk/Tools/WebKitTestRunner/CMakeLists.txt</a></li>
<li><a href="#trunkToolsWebKitTestRunnerDerivedSourcesmake">trunk/Tools/WebKitTestRunner/DerivedSources.make</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerPlatformWebViewh">trunk/Tools/WebKitTestRunner/PlatformWebView.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationh">trunk/Tools/WebKitTestRunner/TestInvocation.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestOptionsh">trunk/Tools/WebKitTestRunner/TestOptions.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj">trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsWebKitTestRunnercocoaTestControllerCocoamm">trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosPlatformWebViewIOSmm">trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacEventSenderProxymm">trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacPlatformWebViewMacmm">trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacTestControllerMacmm">trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacWebKitTestRunnerDraggingInfoh">trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastharnessconcurrentuisidescriptsexpectedtxt">trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastharnessconcurrentuisidescriptshtml">trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html</a></li>
<li><a href="#trunkLayoutTestsfastharnessuisidescriptsexpectedtxt">trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastharnessuisidescriptshtml">trunk/LayoutTests/fast/harness/ui-side-scripts.html</a></li>
<li>trunk/LayoutTests/fast/zooming/</li>
<li>trunk/LayoutTests/fast/zooming/ios/</li>
<li><a href="#trunkLayoutTestsfastzoomingioszoomtoscaleexpectedtxt">trunk/LayoutTests/fast/zooming/ios/zoom-to-scale-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastzoomingioszoomtoscalehtml">trunk/LayoutTests/fast/zooming/ios/zoom-to-scale.html</a></li>
<li>trunk/Tools/WebKitTestRunner/UIScriptContext/</li>
<li>trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/</li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextBindingsUIScriptControlleridl">trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptContextcpp">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptContexth">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllercpp">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllerh">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewh">trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewmm">trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacUIScriptControllerMacmm">trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/LayoutTests/ChangeLog        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-09-21 Simon Fraser <simon.fraser@apple.com>
+
+ Add the ability for tests to run script in the UI process in WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=149356
+
+ Reviewed by Tim Horton.
+
+ Some new tests that exercise testRunner.runUIScript().
+
+ * TestExpectations:
+ * fast/harness/concurrent-ui-side-scripts-expected.txt: Added.
+ * fast/harness/concurrent-ui-side-scripts.html: Added.
+ * fast/harness/ui-side-scripts-expected.txt: Added.
+ * fast/harness/ui-side-scripts.html: Added.
+ * fast/zooming/zoom-to-scale.html: Added.
+ * platform/ios-simulator/TestExpectations:
+ * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2015-09-21 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Turn on threaded scrolling by default in the tests
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/LayoutTests/TestExpectations        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx"> editing/pasteboard/gtk [ Skip ]
</span><span class="cx"> tiled-drawing [ Skip ]
</span><span class="cx"> swipe [ Skip ]
</span><ins>+fast/zooming/ios [ Skip ]
</ins><span class="cx">
</span><span class="cx"> fast/forms/attributed-strings.html [ Skip ]
</span><span class="cx"> fast/scrolling/latching [ Skip ]
</span><span class="lines">@@ -39,6 +40,10 @@
</span><span class="cx"> # This test is WebKit2-only
</span><span class="cx"> http/tests/appcache/decide-navigation-policy-after-delay.html [ Skip ]
</span><span class="cx">
</span><ins>+# Only Mac and iOS have an implementation of UIScriptController::doAsyncTask().
+fast/harness/ui-side-scripts.html [ Skip ]
+fast/harness/concurrent-ui-side-scripts.html [ Skip ]
+
</ins><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> # End platform-specific tests.
</span><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span></span></pre></div>
<a id="trunkLayoutTestsfastharnessconcurrentuisidescriptsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+Script 2:
+Running UI-side script 2
+Completed async task 2.1. Script done.
+Script 1:
+Running UI-side script 1
+Completed async task 1.1.
+Completed async task 1.2.
+Completed async task 1.3. Script done.
+.
</ins></span></pre></div>
<a id="trunkLayoutTestsfastharnessconcurrentuisidescriptshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html         (rev 0)
+++ trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <script id="ui-script1" type="text/plain">
+ (function() {
+ var completions = 'Running UI-side script 1\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 1.1.\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 1.2.\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 1.3. Script done.\n';
+
+ uiController.uiScriptComplete(completions);
+ });
+ });
+ });
+ })();
+ </script>
+
+ <script id="ui-script2" type="text/plain">
+ (function() {
+ var completions2 = 'Running UI-side script 2\n';
+
+ uiController.doAsyncTask(function() {
+ completions2 += 'Completed async task 2.1. Script done.\n';
+
+ uiController.uiScriptComplete(completions2);
+ });
+ })();
+ </script>
+
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ var outstandingScripts = 2;
+ function runTest()
+ {
+ if (testRunner.runUIScript) {
+ var uiScript = document.getElementById('ui-script1').text;
+ testRunner.runUIScript(uiScript, function(result) {
+ document.getElementById('results').textContent += 'Script 1:\n' + result;
+ --outstandingScripts;
+ checkIfScriptsComplete();
+ });
+
+ var uiScript2 = document.getElementById('ui-script2').text;
+ testRunner.runUIScript(uiScript2, function(result) {
+ document.getElementById('results').textContent += 'Script 2:\n' + result;
+ --outstandingScripts;
+ checkIfScriptsComplete();
+ });
+ }
+ }
+
+ function checkIfScriptsComplete(remaining)
+ {
+ if (outstandingScripts)
+ return;
+
+ testRunner.notifyDone();
+ }
+
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body>
+
+<pre id="results"></pre>
+
+</body>
+</html>
+.
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastharnessuisidescriptsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Running the UI-side script
+Completed async task 1.1.
+Completed async task 2.1.
+Completed async task 1.2.
+Completed async task 2.1.
+Completed async task 2.2.1.
+Completed async task 1.3.
+Completed async task 2.3.
+Completed async task 2.2.2.
+.
</ins></span></pre></div>
<a id="trunkLayoutTestsfastharnessuisidescriptshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/harness/ui-side-scripts.html (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/ui-side-scripts.html         (rev 0)
+++ trunk/LayoutTests/fast/harness/ui-side-scripts.html        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <script id="ui-script" type="text/plain">
+ (function() {
+ var completions = 'Running the UI-side script\n';
+ var outstandingTaskCount = 3;
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 1.1.\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 1.2.\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 1.3.\n';
+
+ --outstandingTaskCount;
+ checkIfTasksFinished();
+ });
+ });
+ });
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 2.1.\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 2.1.\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 2.3.\n';
+
+ --outstandingTaskCount;
+ checkIfTasksFinished();
+ });
+ });
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 2.2.1.\n';
+
+ uiController.doAsyncTask(function() {
+ completions += 'Completed async task 2.2.2.\n';
+
+ --outstandingTaskCount;
+ checkIfTasksFinished();
+ });
+ });
+ });
+
+ function checkIfTasksFinished()
+ {
+ if (!outstandingTaskCount)
+ uiController.uiScriptComplete(completions);
+ }
+ })();
+ </script>
+
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function runTest()
+ {
+ if (testRunner.runUIScript) {
+ var uiScript = document.getElementById('ui-script').text;
+ testRunner.runUIScript(uiScript, function(result) {
+ document.getElementById('result').textContent = result;
+ testRunner.notifyDone();
+ });
+ }
+ }
+
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body>
+
+<pre id="result">This test has to run in iOS WebKitTestRunner.</pre>
+
+</body>
+</html>
+.
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastzoomingioszoomtoscaleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/zooming/ios/zoom-to-scale-expected.txt (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/zooming/ios/zoom-to-scale-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/zooming/ios/zoom-to-scale-expected.txt        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+PASS: final zoom scale was 1.2
+
+.
</ins></span></pre></div>
<a id="trunkLayoutTestsfastzoomingioszoomtoscalehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/zooming/ios/zoom-to-scale.html (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/zooming/ios/zoom-to-scale.html         (rev 0)
+++ trunk/LayoutTests/fast/zooming/ios/zoom-to-scale.html        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <script id="ui-script" type="text/plain">
+ (function() {
+ uiController.zoomToScale(1.2, function() {
+ uiController.uiScriptComplete(uiController.zoomScale);
+ });
+ })();
+ </script>
+
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function runTest()
+ {
+ if (testRunner.runUIScript) {
+ var uiScript = document.getElementById('ui-script').text;
+ testRunner.runUIScript(uiScript, function(result) {
+
+ var resultText;
+ if (result == "1.2")
+ resultText = "PASS: final zoom scale was " + result;
+ else
+ resultText = "FAIL: final zoom scale was " + result + ", should be 1.2";
+
+ document.getElementById('result').textContent = resultText;
+ testRunner.notifyDone();
+ });
+ }
+ }
+
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body>
+
+<p id="result">This test has to run in iOS WebKitTestRunner.</p>
+
+</body>
+</html>
+.
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -2,6 +2,18 @@
</span><span class="cx"> #
</span><span class="cx"> # See http://trac.webkit.org/wiki/TestExpectations for more information on this file.
</span><span class="cx">
</span><ins>+#//////////////////////////////////////////////////////////////////////////////////////////
+# Platform-specific directories. Skipped globally, then re-enabled here.
+#//////////////////////////////////////////////////////////////////////////////////////////
+
+fast/harness/ui-side-scripts.html [ Pass ]
+fast/harness/concurrent-ui-side-scripts.html [ Pass ]
+fast/zooming/ios [ Pass ]
+
+#//////////////////////////////////////////////////////////////////////////////////////////
+# End platform-specific directories.
+#//////////////////////////////////////////////////////////////////////////////////////////
+
</ins><span class="cx"> # Animation tests that fail:
</span><span class="cx"> webkit.org/b/129562 [ Debug ] animations/animation-direction-reverse-fill-mode.html [ Skip ]
</span><span class="cx"> [ Release ] animations/animation-direction-reverse-fill-mode.html [ Timeout Pass ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -13,6 +13,9 @@
</span><span class="cx"> fast/events/force-click-on-link-navigation.html [ Pass ]
</span><span class="cx"> fast/events/force-click-text-selection-behavior.html [ Failure ]
</span><span class="cx">
</span><ins>+fast/harness/ui-side-scripts.html [ Pass ]
+fast/harness/concurrent-ui-side-scripts.html [ Pass ]
+
</ins><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> # End platform-specific directories.
</span><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Source/WebKit2/ChangeLog        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-09-21 Simon Fraser <simon.fraser@apple.com>
+
+ Add the ability for tests to run script in the UI process in WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=149356
+
+ Reviewed by Tim Horton.
+
+ Expose a few private functions for testing.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
</ins><span class="cx"> 2015-09-21 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Layout milestones aren't synchronized with UI-side compositing transactions
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -1596,7 +1596,7 @@
</span><span class="cx"> [self _updateVisibleContentRects];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Unobscured content rect where the user can interact. When the keyboard is up, this should be the area above or bellow the keyboard, wherever there is enough space.
</del><ins>+// Unobscured content rect where the user can interact. When the keyboard is up, this should be the area above or below the keyboard, wherever there is enough space.
</ins><span class="cx"> - (CGRect)_contentRectForUserInteraction
</span><span class="cx"> {
</span><span class="cx"> // FIXME: handle split keyboard.
</span><span class="lines">@@ -3020,6 +3020,21 @@
</span><span class="cx"> return _viewportMetaTagWidth;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (CGRect)_contentVisibleRect
+{
+ return [self convertRect:[self bounds] toView:self._currentContentView];
+}
+
+- (CGPoint)_convertPointFromContentsToView:(CGPoint)point
+{
+ return [self convertPoint:point fromView:self._currentContentView];
+}
+
+- (CGPoint)_convertPointFromViewToContents:(CGPoint)point
+{
+ return [self convertPoint:point toView:self._currentContentView];
+}
+
</ins><span class="cx"> - (_WKWebViewPrintFormatter *)_webViewPrintFormatter
</span><span class="cx"> {
</span><span class="cx"> UIViewPrintFormatter *viewPrintFormatter = self.viewPrintFormatter;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -125,8 +125,13 @@
</span><span class="cx"> // The viewport meta tag width is negative if the value is not defined.
</span><span class="cx"> @property (nonatomic, readonly) CGFloat _viewportMetaTagWidth;
</span><span class="cx">
</span><ins>+@property (nonatomic, readonly) CGRect _contentVisibleRect;
+
</ins><span class="cx"> @property (nonatomic, readonly) _WKWebViewPrintFormatter *_webViewPrintFormatter;
</span><span class="cx">
</span><ins>+- (CGPoint)_convertPointFromContentsToView:(CGPoint)point;
+- (CGPoint)_convertPointFromViewToContents:(CGPoint)point;
+
</ins><span class="cx"> - (void)_beginInteractiveObscuredInsetsChange;
</span><span class="cx"> - (void)_endInteractiveObscuredInsetsChange;
</span><span class="cx"> - (void)_hideContentUntilNextUpdate;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/ChangeLog        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -1,3 +1,98 @@
</span><ins>+2015-09-21 Simon Fraser <simon.fraser@apple.com>
+
+ Add the ability for tests to run script in the UI process in WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=149356
+
+ Reviewed by Tim Horton.
+
+ This change adds testRunner.runUIScript(script, callback), which allows a test
+ to execute script in a JSContext which runs in the UI process. That context
+ has bindings exposed through the UIScriptController interface; currently one test
+ function, and some iOS-specific functions are included. UIScriptController can be
+ async with a callback, and runUIScript() itself is asynchronous. When the UI
+ script is complete, it calls uiController.uiScriptComplete(result), where 'result'
+ is a string passed back to the web process, and given to the runUIScript()
+ callback function.
+
+ Thanks to Gyuyoung Kim for help with the Gtk/Efl build.
+
+ * WebKitTestRunner/DerivedSources.make: Build UIScriptController.idl.
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Add runUIScript().
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage): When the UI-side script is
+ complete, call back into TestRunner.
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::nextUIScriptCallbackID):
+ (WTR::TestRunner::runUIScript): Post a message to the injected bundle to run the UI script.
+ (WTR::TestRunner::runUIScriptCallback): When the UI script is done, execute its callback function.
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/PlatformWebView.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::updateTestOptionsFromTestHeader):
+ (WTR::TestController::testOptionsForTest): Support "useFlexibleViewport" as a test argument.
+ (WTR::shouldUseFixedLayout): Deleted. Moved to a TestInvocation function.
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::shouldUseFixedLayout):
+ (WTR::TestInvocation::shouldUseThreadedScrolling):
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+ (WTR::TestInvocation::runUISideScript): Run the UI-side script!
+ (WTR::TestInvocation::uiScriptDidComplete): Send a message back to the injected bundle.
+ * WebKitTestRunner/TestInvocation.h:
+ * WebKitTestRunner/TestOptions.h:
+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.h: Copied from Tools/WebKitTestRunner/TestOptions.h.
+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: Added.
+ (-[TestRunnerWKWebView dragImage:at:offset:event:pasteboard:source:slideBack:]):
+ (-[TestRunnerWKWebView zoomToScale:animated:completionHandler:]):
+ (-[TestRunnerWKWebView scrollViewDidEndZooming:withView:atScale:]):
+ (-[TestRunnerWKWebView onDidEndZooming:]): Allow a test to hook into the end of zooming.
+ * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+ (WTR::PlatformWebView::PlatformWebView): Make a TestRunnerWKWebView on iOS.
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm: Added.
+ (WTR::UIScriptController::doAsyncTask):
+ (WTR::UIScriptController::zoomToScale):
+ (WTR::UIScriptController::zoomScale):
+ (WTR::UIScriptController::minimumZoomScale):
+ (WTR::UIScriptController::maximumZoomScale):
+ (WTR::UIScriptController::contentVisibleRect):
+ * WebKitTestRunner/mac/EventSenderProxy.mm:
+ * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+ (-[TestRunnerWKWebView dragImage:at:offset:event:pasteboard:source:slideBack:]): Deleted.
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::TestController::updatePlatformSpecificTestOptionsForTest):
+ (WTR::shouldUseThreadedScrolling): Deleted. Moved to TestInvocation.
+ * WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h:
+ * WebKitTestRunner/uiscriptcontext/UIScriptContext.cpp: Added. Owns the JS context in the UI process.
+ (UIScriptContext::UIScriptContext):
+ (UIScriptContext::~UIScriptContext):
+ (UIScriptContext::runUIScript): Entrypoint to running the UI script. If the script didn't do anything
+ asynchronous, call the callback.
+ (UIScriptContext::nextTaskCallbackID):
+ (UIScriptContext::prepareForAsyncTask): Do setup for one async task (i.e. a UIScriptController function
+ that has a callback). Has to store the callbackID of the script, so code called from the completion
+ callback knows which UI script invoked it.
+ (UIScriptContext::asyncTaskComplete): Called when one task is finished.
+ (UIScriptContext::uiScriptComplete):
+ (UIScriptContext::objectFromRect): Make a JS object from a rect.
+ * WebKitTestRunner/uiscriptcontext/UIScriptContext.h: Copied from Tools/WebKitTestRunner/TestOptions.h.
+ (WTR::UIScriptContext::hasOutstandingAsyncTasks):
+ * WebKitTestRunner/uiscriptcontext/UIScriptController.cpp: Copied from Tools/WebKitTestRunner/TestOptions.h.
+ (WTR::UIScriptController::UIScriptController):
+ (WTR::UIScriptController::makeWindowObject):
+ (WTR::UIScriptController::wrapperClass):
+ (WTR::UIScriptController::doAsyncTask):
+ (WTR::UIScriptController::zoomToScale):
+ (WTR::UIScriptController::zoomScale):
+ (WTR::UIScriptController::minimumZoomScale):
+ (WTR::UIScriptController::maximumZoomScale):
+ (WTR::UIScriptController::contentVisibleRect):
+ (WTR::UIScriptController::uiScriptComplete):
+ * WebKitTestRunner/uiscriptcontext/UIScriptController.h: Copied from Tools/WebKitTestRunner/TestOptions.h.
+ (WTR::UIScriptController::create):
+ * WebKitTestRunner/uiscriptcontext/bindings/UIScriptController.idl: Copied from Tools/WebKitTestRunner/TestOptions.h.
+
</ins><span class="cx"> 2015-09-21 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Turn on threaded scrolling by default in the tests
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/CMakeLists.txt        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -1,7 +1,9 @@
</span><span class="cx"> set(WEBKIT_TESTRUNNER_DIR "${TOOLS_DIR}/WebKitTestRunner")
</span><span class="cx"> set(WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR "${TOOLS_DIR}/WebKitTestRunner/InjectedBundle")
</span><ins>+set(WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR "${TOOLS_DIR}/WebKitTestRunner/UIScriptContext")
</ins><span class="cx">
</span><span class="cx"> file(MAKE_DIRECTORY ${DERIVED_SOURCES_DIR}/InjectedBundle)
</span><ins>+file(MAKE_DIRECTORY ${DERIVED_SOURCES_DIR}/UIScriptContext)
</ins><span class="cx">
</span><span class="cx"> set(WebKitTestRunner_SOURCES
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/CyclicRedundancyCheck.cpp
</span><span class="lines">@@ -12,6 +14,10 @@
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/TestInvocation.cpp
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/WebNotificationProvider.cpp
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/WorkQueueManager.cpp
</span><ins>+ ${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/UIScriptContext.cpp
+ ${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/UIScriptController.cpp
+
+ ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/JSWrapper.cpp
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> set(WebKitTestRunner_LIBRARIES
</span><span class="lines">@@ -26,6 +32,8 @@
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle/Bindings
</span><span class="cx"> ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle/atk
</span><ins>+ ${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}
+ ${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/Bindings
</ins><span class="cx"> ${JAVASCRIPTCORE_DIR}
</span><span class="cx"> ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
</span><span class="cx"> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
</span><span class="lines">@@ -47,6 +55,7 @@
</span><span class="cx"> ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c
</span><span class="cx"> ${WTF_DIR}
</span><span class="cx"> ${DERIVED_SOURCES_DIR}/InjectedBundle
</span><ins>+ ${DERIVED_SOURCES_DIR}/UIScriptContext
</ins><span class="cx"> ${CMAKE_BINARY_DIR}
</span><span class="cx"> ${CMAKE_SOURCE_DIR}/Source
</span><span class="cx"> )
</span><span class="lines">@@ -82,8 +91,8 @@
</span><span class="cx"> "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/TextInputController.idl"
</span><span class="cx"> )
</span><span class="cx">
</span><del>-set(WebKitTestRunnerInjectedBundle_LIBRARIES
- ${WebKitTestRunner_LIBRARIES}
</del><ins>+set(WebKitTestRunner_IDL_FILES
+ "${WEBKIT_TESTRUNNER_DIR}/UIScriptContext/Bindings/UIScriptController.idl"
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> GENERATE_BINDINGS(WebKitTestRunnerInjectedBundle_SOURCES
</span><span class="lines">@@ -94,13 +103,21 @@
</span><span class="cx"> ${DERIVED_SOURCES_DIR}/InjectedBundle JS TestRunner cpp
</span><span class="cx"> ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
</span><span class="cx">
</span><ins>+GENERATE_BINDINGS(WebKitTestRunner_SOURCES
+ "${WebKitTestRunner_IDL_FILES}"
+ "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings"
+ "--include=${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings"
+ "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}"
+ ${DERIVED_SOURCES_DIR}/UIScriptContext JS TestRunner cpp
+ ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
+
</ins><span class="cx"> WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
</span><span class="cx">
</span><span class="cx"> include_directories(${WebKitTestRunner_INCLUDE_DIRECTORIES})
</span><span class="cx"> include_directories(SYSTEM ${WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES})
</span><span class="cx">
</span><span class="cx"> add_library(TestRunnerInjectedBundle SHARED ${WebKitTestRunnerInjectedBundle_SOURCES})
</span><del>-target_link_libraries(TestRunnerInjectedBundle ${WebKitTestRunnerInjectedBundle_LIBRARIES})
</del><ins>+target_link_libraries(TestRunnerInjectedBundle ${WebKitTestRunner_LIBRARIES})
</ins><span class="cx">
</span><span class="cx"> add_executable(WebKitTestRunner ${WebKitTestRunner_SOURCES})
</span><span class="cx"> target_link_libraries(WebKitTestRunner ${WebKitTestRunner_LIBRARIES})
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/DerivedSources.make (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/DerivedSources.make        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/DerivedSources.make        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -23,9 +23,10 @@
</span><span class="cx">
</span><span class="cx"> VPATH = \
</span><span class="cx"> $(WebKitTestRunner)/InjectedBundle/Bindings \
</span><ins>+ $(WebKitTestRunner)/UIScriptContext/Bindings \
</ins><span class="cx"> #
</span><span class="cx">
</span><del>-INTERFACES = \
</del><ins>+INJECTED_BUNDLE_INTERFACES = \
</ins><span class="cx"> AccessibilityController \
</span><span class="cx"> AccessibilityTextMarker \
</span><span class="cx"> AccessibilityTextMarkerRange \
</span><span class="lines">@@ -36,6 +37,10 @@
</span><span class="cx"> TextInputController \
</span><span class="cx"> #
</span><span class="cx">
</span><ins>+UICONTEXT_INTERFACES = \
+ UIScriptController \
+#
+
</ins><span class="cx"> SCRIPTS = \
</span><span class="cx"> $(WebCoreScripts)/CodeGenerator.pm \
</span><span class="cx"> $(WebKitTestRunner)/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm \
</span><span class="lines">@@ -47,9 +52,11 @@
</span><span class="cx">
</span><span class="cx"> JS%.h JS%.cpp : %.idl $(SCRIPTS)
</span><span class="cx">         @echo Generating bindings for $*...
</span><del>-        @perl -I $(WebCoreScripts) -I $(WebKitTestRunner)/InjectedBundle/Bindings $(WebCoreScripts)/generate-bindings.pl --defines "" --include InjectedBundle/Bindings --outputDir . --generator TestRunner $<
</del><ins>+        @perl -I $(WebCoreScripts) -I $(WebKitTestRunner)/InjectedBundle/Bindings -I $(WebKitTestRunner)/UIScriptContext/Bindings $(WebCoreScripts)/generate-bindings.pl --defines "" --include InjectedBundle/Bindings --include UIScriptContext/Bindings --outputDir . --generator TestRunner $<
</ins><span class="cx">
</span><span class="cx"> all : \
</span><del>- $(INTERFACES:%=JS%.h) \
- $(INTERFACES:%=JS%.cpp) \
</del><ins>+ $(INJECTED_BUNDLE_INTERFACES:%=JS%.h) \
+ $(INJECTED_BUNDLE_INTERFACES:%=JS%.cpp) \
+ $(UICONTEXT_INTERFACES:%=JS%.h) \
+ $(UICONTEXT_INTERFACES:%=JS%.cpp) \
</ins><span class="cx"> #
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -213,5 +213,8 @@
</span><span class="cx"> void installWillEndSwipeCallback(object callback);
</span><span class="cx"> void installDidEndSwipeCallback(object callback);
</span><span class="cx"> void installDidRemoveSwipeSnapshotCallback(object callback);
</span><ins>+
+ // UI Process Testing
+ void runUIScript(DOMString script, object callback);
</ins><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -235,6 +235,21 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (WKStringIsEqualToUTF8CString(messageName, "CallUISideScriptCallback")) {
+ WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+
+ WKRetainPtr<WKStringRef> resultKey(AdoptWK, WKStringCreateWithUTF8CString("Result"));
+ WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID"));
+
+ unsigned callbackID = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, callbackIDKey.get())));
+
+ WKStringRef resultString = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, resultKey.get()));
+ auto resultJSString = toJS(resultString);
+
+ m_testRunner->runUIScriptCallback(callbackID, resultJSString.get());
+ return;
+ }
+
</ins><span class="cx"> if (WKStringIsEqualToUTF8CString(messageName, "WorkQueueProcessedCallback")) {
</span><span class="cx"> if (!topLoadingFrame() && !m_testRunner->waitToDump())
</span><span class="cx"> InjectedBundle::page()->dump();
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -513,7 +513,8 @@
</span><span class="cx"> DidBeginSwipeCallbackID,
</span><span class="cx"> WillEndSwipeCallbackID,
</span><span class="cx"> DidEndSwipeCallbackID,
</span><del>- DidRemoveSwipeSnapshotCallbackID
</del><ins>+ DidRemoveSwipeSnapshotCallbackID,
+ FirstUIScriptCallbackID = 100
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> static void cacheTestRunnerCallback(unsigned index, JSValueRef callback)
</span><span class="lines">@@ -532,14 +533,14 @@
</span><span class="cx"> callbackMap().add(index, callback);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void callTestRunnerCallback(unsigned index)
</del><ins>+static void callTestRunnerCallback(unsigned index, size_t argumentCount = 0, const JSValueRef arguments[] = nullptr)
</ins><span class="cx"> {
</span><span class="cx"> if (!callbackMap().contains(index))
</span><span class="cx"> return;
</span><span class="cx"> WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
</span><span class="cx"> JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
</span><span class="cx"> JSObjectRef callback = JSValueToObject(context, callbackMap().take(index), 0);
</span><del>- JSObjectCallAsFunction(context, callback, JSContextGetGlobalObject(context), 0, 0, 0);
</del><ins>+ JSObjectCallAsFunction(context, callback, JSContextGetGlobalObject(context), argumentCount, arguments, 0);
</ins><span class="cx"> JSValueUnprotect(context, callback);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -888,6 +889,42 @@
</span><span class="cx"> WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static unsigned nextUIScriptCallbackID()
+{
+ static unsigned callbackID = FirstUIScriptCallbackID;
+ return callbackID++;
+}
+
+void TestRunner::runUIScript(JSStringRef script, JSValueRef callback)
+{
+ unsigned callbackID = nextUIScriptCallbackID();
+ cacheTestRunnerCallback(callbackID, callback);
+
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("RunUIProcessScript"));
+
+ WKRetainPtr<WKMutableDictionaryRef> testDictionary(AdoptWK, WKMutableDictionaryCreate());
+
+ WKRetainPtr<WKStringRef> scriptKey(AdoptWK, WKStringCreateWithUTF8CString("Script"));
+ WKRetainPtr<WKStringRef> scriptValue(AdoptWK, WKStringCreateWithJSString(script));
+
+ WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID"));
+ WKRetainPtr<WKUInt64Ref> callbackIDValue = adoptWK(WKUInt64Create(callbackID));
+
+ WKDictionarySetItem(testDictionary.get(), scriptKey.get(), scriptValue.get());
+ WKDictionarySetItem(testDictionary.get(), callbackIDKey.get(), callbackIDValue.get());
+
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), testDictionary.get());
+}
+
+void TestRunner::runUIScriptCallback(unsigned callbackID, JSStringRef result)
+{
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
+
+ JSValueRef resultValue = JSValueMakeString(context, result);
+ callTestRunnerCallback(callbackID, 1, &resultValue);
+}
+
</ins><span class="cx"> void TestRunner::installDidBeginSwipeCallback(JSValueRef callback)
</span><span class="cx"> {
</span><span class="cx"> cacheTestRunnerCallback(DidBeginSwipeCallbackID, callback);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -287,6 +287,9 @@
</span><span class="cx"> void setShouldDecideNavigationPolicyAfterDelay(bool);
</span><span class="cx"> void setNavigationGesturesEnabled(bool);
</span><span class="cx">
</span><ins>+ void runUIScript(JSStringRef script, JSValueRef callback);
+ void runUIScriptCallback(unsigned callbackID, JSStringRef result);
+
</ins><span class="cx"> void installDidBeginSwipeCallback(JSValueRef);
</span><span class="cx"> void installWillEndSwipeCallback(JSValueRef);
</span><span class="cx"> void installDidEndSwipeCallback(JSValueRef);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerPlatformWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/PlatformWebView.h        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -33,12 +33,12 @@
</span><span class="cx"> #include <WebKit/WKFoundation.h>
</span><span class="cx"> OBJC_CLASS NSView;
</span><span class="cx"> OBJC_CLASS UIView;
</span><del>-OBJC_CLASS WKWebView;
</del><ins>+OBJC_CLASS TestRunnerWKWebView;
</ins><span class="cx"> OBJC_CLASS WKWebViewConfiguration;
</span><span class="cx"> OBJC_CLASS WebKitTestRunnerWindow;
</span><span class="cx">
</span><span class="cx"> #if WK_API_ENABLED
</span><del>-typedef WKWebView *PlatformWKView;
</del><ins>+typedef TestRunnerWKWebView *PlatformWKView;
</ins><span class="cx"> #else
</span><span class="cx"> typedef NSView *PlatformWKView;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -807,16 +807,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool shouldUseFixedLayout(const TestInvocation& test)
-{
-#if ENABLE(CSS_DEVICE_ADAPTATION)
- if (test.urlContains("device-adapt/") || test.urlContains("device-adapt\\"))
- return true;
-#endif
-
- return false;
-}
-
</del><span class="cx"> static std::string testPath(const WKURLRef url)
</span><span class="cx"> {
</span><span class="cx"> auto scheme = adoptWK(WKURLCopyScheme(url));
</span><span class="lines">@@ -878,6 +868,8 @@
</span><span class="cx"> String(value.c_str()).split(",", false, testOptions.overrideLanguages);
</span><span class="cx"> if (key == "useThreadedScrolling")
</span><span class="cx"> testOptions.useThreadedScrolling = parseBooleanTestHeaderValue(value);
</span><ins>+ if (key == "useFlexibleViewport")
+ testOptions.useFlexibleViewport = parseBooleanTestHeaderValue(value);
</ins><span class="cx"> pairStart = pairEnd + 1;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -888,7 +880,8 @@
</span><span class="cx">
</span><span class="cx"> options.useRemoteLayerTree = m_shouldUseRemoteLayerTree;
</span><span class="cx"> options.shouldShowWebView = m_shouldShowWebView;
</span><del>- options.useFixedLayout = shouldUseFixedLayout(test);
</del><ins>+ options.useFixedLayout = test.shouldUseFixedLayout();
+ options.useFlexibleViewport = test.shouldMakeViewportFlexible();
</ins><span class="cx">
</span><span class="cx"> updatePlatformSpecificTestOptionsForTest(options, test);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "PlatformWebView.h"
</span><span class="cx"> #include "StringFunctions.h"
</span><span class="cx"> #include "TestController.h"
</span><ins>+#include "UIScriptController.h"
</ins><span class="cx"> #include <WebKit/WKContextPrivate.h>
</span><span class="cx"> #include <WebKit/WKCookieManager.h>
</span><span class="cx"> #include <WebKit/WKData.h>
</span><span class="lines">@@ -52,6 +53,7 @@
</span><span class="cx">
</span><span class="cx"> #include <unistd.h> // For getcwd.
</span><span class="cx">
</span><ins>+using namespace JSC;
</ins><span class="cx"> using namespace WebKit;
</span><span class="cx"> using namespace std;
</span><span class="cx">
</span><span class="lines">@@ -147,6 +149,16 @@
</span><span class="cx"> return urlContains("viewport/");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool TestInvocation::shouldUseFixedLayout() const
+{
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+ if (urlContains("device-adapt/") || urlContains("device-adapt\\"))
+ return true;
+#endif
+
+ return false;
+}
+
</ins><span class="cx"> void TestInvocation::invoke()
</span><span class="cx"> {
</span><span class="cx"> TestController::singleton().configureViewForTest(*this);
</span><span class="lines">@@ -651,6 +663,18 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (WKStringIsEqualToUTF8CString(messageName, "RunUIProcessScript")) {
+ WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
+ WKRetainPtr<WKStringRef> scriptKey(AdoptWK, WKStringCreateWithUTF8CString("Script"));
+ WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID"));
+
+ unsigned callbackID = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, callbackIDKey.get())));
+ WKStringRef scriptString = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, scriptKey.get()));
+
+ runUISideScript(scriptString, callbackID);
+ return;
+ }
+
</ins><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -660,7 +684,7 @@
</span><span class="cx"> ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
</span><span class="cx"> WKBooleanRef isKeyValue = static_cast<WKBooleanRef>(messageBody);
</span><span class="cx"> TestController::singleton().mainWebView()->setWindowIsKey(WKBooleanGetValue(isKeyValue));
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (WKStringIsEqualToUTF8CString(messageName, "IsGeolocationClientActive")) {
</span><span class="lines">@@ -689,13 +713,36 @@
</span><span class="cx"> WKHTTPCookieAcceptPolicy policy = WKBooleanGetValue(accept) ? kWKHTTPCookieAcceptPolicyAlways : kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
</span><span class="cx"> // FIXME: This updates the policy in WebProcess and in NetworkProcess asynchronously, which might break some tests' expectations.
</span><span class="cx"> WKCookieManagerSetHTTPCookieAcceptPolicy(WKContextGetCookieManager(TestController::singleton().context()), policy);
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void TestInvocation::runUISideScript(WKStringRef script, unsigned scriptCallbackID)
+{
+ if (!m_UIScriptContext)
+ m_UIScriptContext = std::make_unique<UIScriptContext>(*this);
+
+ m_UIScriptContext->runUIScript(script, scriptCallbackID);
+}
+
+void TestInvocation::uiScriptDidComplete(WKStringRef result, unsigned scriptCallbackID)
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallUISideScriptCallback"));
+
+ WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate());
+ WKRetainPtr<WKStringRef> resultKey(AdoptWK, WKStringCreateWithUTF8CString("Result"));
+ WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID"));
+ WKRetainPtr<WKUInt64Ref> callbackIDValue = adoptWK(WKUInt64Create(scriptCallbackID));
+
+ WKDictionarySetItem(messageBody.get(), resultKey.get(), result);
+ WKDictionarySetItem(messageBody.get(), callbackIDKey.get(), callbackIDValue.get());
+
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), messageBody.get());
+}
+
</ins><span class="cx"> void TestInvocation::outputText(const WTF::String& text)
</span><span class="cx"> {
</span><span class="cx"> m_textOutput.append(text);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.h        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -26,6 +26,9 @@
</span><span class="cx"> #ifndef TestInvocation_h
</span><span class="cx"> #define TestInvocation_h
</span><span class="cx">
</span><ins>+#include "JSWrappable.h"
+#include "UIScriptContext.h"
+#include <JavaScriptCore/JSRetainPtr.h>
</ins><span class="cx"> #include <WebKit/WKRetainPtr.h>
</span><span class="cx"> #include <string>
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="lines">@@ -33,7 +36,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WTR {
</span><span class="cx">
</span><del>-class TestInvocation {
</del><ins>+class TestInvocation : public UIScriptContextDelegate {
</ins><span class="cx"> WTF_MAKE_NONCOPYABLE(TestInvocation);
</span><span class="cx"> public:
</span><span class="cx"> explicit TestInvocation(const std::string& pathOrURL);
</span><span class="lines">@@ -61,6 +64,7 @@
</span><span class="cx"> void didRemoveSwipeSnapshot();
</span><span class="cx">
</span><span class="cx"> bool shouldMakeViewportFlexible() const;
</span><ins>+ bool shouldUseFixedLayout() const;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> void dumpResults();
</span><span class="lines">@@ -74,6 +78,10 @@
</span><span class="cx"> bool shouldLogFrameLoadDelegates() const;
</span><span class="cx"> bool shouldLogHistoryClientCallbacks() const;
</span><span class="cx">
</span><ins>+ void runUISideScript(WKStringRef, unsigned callbackID);
+ // UIScriptContextDelegate
+ void uiScriptDidComplete(WKStringRef result, unsigned callbackID) override;
+
</ins><span class="cx"> WKRetainPtr<WKURLRef> m_url;
</span><span class="cx"> WTF::String m_urlString;
</span><span class="cx">
</span><span class="lines">@@ -94,6 +102,8 @@
</span><span class="cx"> WKRetainPtr<WKArrayRef> m_repaintRects;
</span><span class="cx"> std::string m_errorMessage;
</span><span class="cx"> bool m_webProcessIsUnresponsive;
</span><ins>+
+ std::unique_ptr<UIScriptContext> m_UIScriptContext;
</ins><span class="cx">
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestOptionsh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestOptions.h        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> bool useThreadedScrolling { false };
</span><span class="cx"> bool useRemoteLayerTree { false };
</span><span class="cx"> bool shouldShowWebView { false };
</span><del>-
</del><ins>+ bool useFlexibleViewport { false };
</ins><span class="cx"> bool useFixedLayout { false };
</span><span class="cx"> Vector<String> overrideLanguages;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextBindingsUIScriptControlleridlfromrev190064trunkToolsWebKitTestRunnerTestOptionsh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl (from rev 190064, trunk/Tools/WebKitTestRunner/TestOptions.h) (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl         (rev 0)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+interface UIScriptController {
+
+ void doAsyncTask(object callback); // Used to test the harness.
+
+ void zoomToScale(double scale, object callback);
+
+ readonly attribute double zoomScale;
+ readonly attribute double minimumZoomScale;
+ readonly attribute double maximumZoomScale;
+
+ readonly attribute object contentVisibleRect; // Returned object has 'left', 'top', 'width', 'height' properties.
+
+ void uiScriptComplete(DOMString result);
+};
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptContextcpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp         (rev 0)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.cpp        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,123 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 "UIScriptContext.h"
+
+#include "StringFunctions.h"
+#include "UIScriptController.h"
+#include <JavaScriptCore/JSContextRef.h>
+#include <JavaScriptCore/JSValueRef.h>
+#include <WebKit/WKRetainPtr.h>
+#include <WebKit/WKString.h>
+#include <WebKit/WKStringPrivate.h>
+
+using namespace WTR;
+
+UIScriptContext::UIScriptContext(UIScriptContextDelegate& delegate)
+ : m_context(Adopt, JSGlobalContextCreate(nullptr))
+ , m_delegate(delegate)
+{
+ m_controller = UIScriptController::create(*this);
+
+ JSObjectRef globalObject = JSContextGetGlobalObject(m_context.get());
+
+ JSValueRef exception = nullptr;
+ m_controller->makeWindowObject(m_context.get(), globalObject, &exception);
+}
+
+void UIScriptContext::runUIScript(WKStringRef script, unsigned scriptCallbackID)
+{
+ m_currentScriptCallbackID = scriptCallbackID;
+
+ auto scriptRef = toJS(script);
+
+ JSValueRef exception = nullptr;
+ JSValueRef result = JSEvaluateScript(m_context.get(), scriptRef.get(), 0, 0, 1, &exception);
+
+ if (!hasOutstandingAsyncTasks()) {
+ JSValueRef stringifyException = nullptr;
+ JSRetainPtr<JSStringRef> resultString(Adopt, JSValueToStringCopy(m_context.get(), result, &stringifyException));
+ uiScriptComplete(resultString.get());
+ m_currentScriptCallbackID = 0;
+ }
+}
+
+unsigned UIScriptContext::nextTaskCallbackID()
+{
+ return ++m_nextTaskCallbackID;
+}
+
+unsigned UIScriptContext::prepareForAsyncTask(JSValueRef callback)
+{
+ unsigned callbackID = nextTaskCallbackID();
+
+ JSValueProtect(m_context.get(), callback);
+ Task task;
+ task.parentScriptCallbackID = m_currentScriptCallbackID;
+ task.callback = callback;
+
+ ASSERT(!m_callbacks.contains(callbackID));
+ m_callbacks.add(callbackID, task);
+
+ return callbackID;
+}
+
+void UIScriptContext::asyncTaskComplete(unsigned callbackID)
+{
+ Task task = m_callbacks.take(callbackID);
+ ASSERT(task.callback);
+
+ JSValueRef exception = nullptr;
+ JSObjectRef callbackObject = JSValueToObject(m_context.get(), task.callback, &exception);
+
+ m_currentScriptCallbackID = task.parentScriptCallbackID;
+
+ exception = nullptr;
+ JSObjectCallAsFunction(m_context.get(), callbackObject, JSContextGetGlobalObject(m_context.get()), 0, nullptr, &exception);
+ JSValueUnprotect(m_context.get(), task.callback);
+
+ m_currentScriptCallbackID = 0;
+}
+
+void UIScriptContext::uiScriptComplete(JSStringRef result)
+{
+ WKRetainPtr<WKStringRef> uiScriptResult = WKStringCreateWithJSString(result);
+ m_delegate.uiScriptDidComplete(uiScriptResult.get(), m_currentScriptCallbackID);
+ m_currentScriptCallbackID = 0;
+}
+
+JSObjectRef UIScriptContext::objectFromRect(const WKRect& rect) const
+{
+ JSObjectRef object = JSObjectMake(m_context.get(), nullptr, nullptr);
+
+ JSObjectSetProperty(m_context.get(), object, adopt(JSStringCreateWithUTF8CString("left")).get(), JSValueMakeNumber(m_context.get(), rect.origin.x), kJSPropertyAttributeNone, nullptr);
+ JSObjectSetProperty(m_context.get(), object, adopt(JSStringCreateWithUTF8CString("top")).get(), JSValueMakeNumber(m_context.get(), rect.origin.y), kJSPropertyAttributeNone, nullptr);
+ JSObjectSetProperty(m_context.get(), object, adopt(JSStringCreateWithUTF8CString("width")).get(), JSValueMakeNumber(m_context.get(), rect.size.width), kJSPropertyAttributeNone, nullptr);
+ JSObjectSetProperty(m_context.get(), object, adopt(JSStringCreateWithUTF8CString("height")).get(), JSValueMakeNumber(m_context.get(), rect.size.height), kJSPropertyAttributeNone, nullptr);
+
+ return object;
+}
+
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptContexthfromrev190064trunkToolsWebKitTestRunnerTestOptionsh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h (from rev 190064, trunk/Tools/WebKitTestRunner/TestOptions.h) (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h         (rev 0)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 UIScriptContext_h
+#define UIScriptContext_h
+
+#include <JavaScriptCore/JSRetainPtr.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+
+namespace WTR {
+
+class UIScriptController;
+
+class UIScriptContextDelegate {
+public:
+ virtual void uiScriptDidComplete(WKStringRef result, unsigned callbackID) = 0;
+};
+
+class UIScriptContext {
+public:
+
+ UIScriptContext(UIScriptContextDelegate&);
+
+ void runUIScript(WKStringRef script, unsigned scriptCallbackID);
+ void uiScriptComplete(JSStringRef);
+
+ unsigned prepareForAsyncTask(JSValueRef taskCallback);
+ void asyncTaskComplete(unsigned taskCallbackID);
+
+ unsigned nextTaskCallbackID();
+
+ JSObjectRef objectFromRect(const WKRect&) const;
+
+private:
+ JSRetainPtr<JSGlobalContextRef> m_context;
+
+ bool hasOutstandingAsyncTasks() const { return !m_callbacks.isEmpty(); }
+
+ struct Task {
+ unsigned parentScriptCallbackID { 0 };
+ JSValueRef callback { nullptr };
+ };
+ HashMap<unsigned, Task> m_callbacks;
+
+ UIScriptContextDelegate& m_delegate;
+ RefPtr<UIScriptController> m_controller;
+
+ unsigned m_currentScriptCallbackID { 0 };
+ unsigned m_nextTaskCallbackID { 0 };
+};
+
+}
+
+#endif // UIScriptContext_h
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllercppfromrev190064trunkToolsWebKitTestRunnerTestOptionsh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp (from rev 190064, trunk/Tools/WebKitTestRunner/TestOptions.h) (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp         (rev 0)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 "UIScriptController.h"
+
+#include "JSUIScriptController.h"
+#include "UIScriptContext.h"
+// #include <JavaScriptCore/JavaScriptCore.h>
+
+namespace WTR {
+
+UIScriptController::UIScriptController(UIScriptContext& context)
+ : m_context(context)
+{
+}
+
+void UIScriptController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
+{
+ setProperty(context, windowObject, "uiController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
+}
+
+JSClassRef UIScriptController::wrapperClass()
+{
+ return JSUIScriptController::uIScriptControllerClass();
+}
+
+#if !PLATFORM(COCOA)
+void UIScriptController::doAsyncTask(JSValueRef)
+{
+}
+#endif
+
+#if !PLATFORM(IOS)
+void UIScriptController::zoomToScale(double, JSValueRef)
+{
+}
+
+double UIScriptController::zoomScale() const
+{
+ return 1;
+}
+
+double UIScriptController::minimumZoomScale() const
+{
+ return 1;
+}
+
+double UIScriptController::maximumZoomScale() const
+{
+ return 1;
+}
+
+JSObjectRef UIScriptController::contentVisibleRect() const
+{
+ return nullptr;
+}
+#endif
+
+void UIScriptController::uiScriptComplete(JSStringRef result)
+{
+ m_context.uiScriptComplete(result);
+}
+
+}
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllerhfromrev190064trunkToolsWebKitTestRunnerTestOptionsh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h (from rev 190064, trunk/Tools/WebKitTestRunner/TestOptions.h) (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h         (rev 0)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * Copyright (C) 2015 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 UIScriptController_h
+#define UIScriptController_h
+
+#include "JSWrappable.h"
+#include <wtf/Ref.h>
+
+namespace WTR {
+
+class UIScriptContext;
+
+class UIScriptController : public JSWrappable {
+public:
+ static Ref<UIScriptController> create(UIScriptContext& context)
+ {
+ return adoptRef(*new UIScriptController(context));
+ }
+
+ void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
+
+ void doAsyncTask(JSValueRef callback);
+ void zoomToScale(double scale, JSValueRef callback);
+
+ double zoomScale() const;
+ double minimumZoomScale() const;
+ double maximumZoomScale() const;
+
+ JSObjectRef contentVisibleRect() const;
+
+ void uiScriptComplete(JSStringRef result);
+
+private:
+ UIScriptController(UIScriptContext&);
+
+ virtual JSClassRef wrapperClass() override;
+
+ JSObjectRef objectFromRect(const WKRect&) const;
+
+ UIScriptContext& m_context;
+};
+
+}
+
+#endif // UIScriptController_h
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -34,7 +34,15 @@
</span><span class="cx">
</span><span class="cx"> /* Begin PBXBuildFile section */
</span><span class="cx">                 0F5169CC1445222D00E0A9D7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F5169CA1445222D00E0A9D7 /* WebKit.framework */; };
</span><del>-                0F831AEA1BAB84F400F96CD8 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F831AE91BAB84F400F96CD8 /* Launch.storyboard */; settings = {ASSET_TAGS = (); }; };
</del><ins>+                0F73B5511BA78968004B3EF4 /* JSUIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F73B54F1BA78968004B3EF4 /* JSUIScriptController.cpp */; };
+                0F73B5521BA78968004B3EF4 /* JSUIScriptController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F73B5501BA78968004B3EF4 /* JSUIScriptController.h */; };
+                0F73B55A1BA792FF004B3EF4 /* JSWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC952C0C11F3B965003398B4 /* JSWrapper.cpp */; };
+                0F73B55C1BA89042004B3EF4 /* UIScriptControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F73B55B1BA89042004B3EF4 /* UIScriptControllerIOS.mm */; };
+                0F87B6131BACAD82004EC572 /* UIScriptControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F87B6111BACAD6F004EC572 /* UIScriptControllerMac.mm */; settings = {ASSET_TAGS = (); }; };
+                0F87B6171BACC4C0004EC572 /* TestRunnerWKWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F87B6151BACC4B9004EC572 /* TestRunnerWKWebView.mm */; settings = {ASSET_TAGS = (); }; };
+                0F87B6191BACC558004EC572 /* Launch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F87B6181BACC558004EC572 /* Launch.storyboard */; settings = {ASSET_TAGS = (); }; };
+                0F87B61E1BACDA93004EC572 /* UIScriptContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F87B61A1BACDA93004EC572 /* UIScriptContext.cpp */; settings = {ASSET_TAGS = (); }; };
+                0F87B6201BACDA93004EC572 /* UIScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F87B61C1BACDA93004EC572 /* UIScriptController.cpp */; settings = {ASSET_TAGS = (); }; };
</ins><span class="cx">                 0FEB90A01905A834000FDBF3 /* InjectedBundlePageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB909E1905A776000FDBF3 /* InjectedBundlePageCocoa.mm */; };
</span><span class="cx">                 0FEB90A51905C016000FDBF3 /* CrashReporterInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */; };
</span><span class="cx">                 29210EAE144CACB700835BB5 /* AccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA9144CACB200835BB5 /* AccessibilityUIElement.cpp */; };
</span><span class="lines">@@ -162,7 +170,20 @@
</span><span class="cx"> /* Begin PBXFileReference section */
</span><span class="cx">                 0F2109C7189C650D00F879A3 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
</span><span class="cx">                 0F5169CA1445222D00E0A9D7 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
</span><del>-                0F831AE91BAB84F400F96CD8 /* Launch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Launch.storyboard; sourceTree = "<group>"; };
</del><ins>+                0F73B54F1BA78968004B3EF4 /* JSUIScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSUIScriptController.cpp; path = DerivedSources/WebKitTestRunner/JSUIScriptController.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
+                0F73B5501BA78968004B3EF4 /* JSUIScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSUIScriptController.h; path = DerivedSources/WebKitTestRunner/JSUIScriptController.h; sourceTree = BUILT_PRODUCTS_DIR; };
+                0F73B5571BA7929E004B3EF4 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
+                0F73B55B1BA89042004B3EF4 /* UIScriptControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIScriptControllerIOS.mm; sourceTree = "<group>"; };
+                0F831AE71BAB72D000F96CD8 /* Launch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Launch.storyboard; sourceTree = "<group>"; };
+                0F87B6111BACAD6F004EC572 /* UIScriptControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIScriptControllerMac.mm; sourceTree = "<group>"; };
+                0F87B6141BACC4B9004EC572 /* TestRunnerWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestRunnerWKWebView.h; path = cocoa/TestRunnerWKWebView.h; sourceTree = "<group>"; };
+                0F87B6151BACC4B9004EC572 /* TestRunnerWKWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestRunnerWKWebView.mm; path = cocoa/TestRunnerWKWebView.mm; sourceTree = "<group>"; };
+                0F87B6181BACC558004EC572 /* Launch.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Launch.storyboard; sourceTree = "<group>"; };
+                0F87B61A1BACDA93004EC572 /* UIScriptContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptContext.cpp; path = UIScriptContext/UIScriptContext.cpp; sourceTree = "<group>"; };
+                0F87B61B1BACDA93004EC572 /* UIScriptContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIScriptContext.h; path = UIScriptContext/UIScriptContext.h; sourceTree = "<group>"; };
+                0F87B61C1BACDA93004EC572 /* UIScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIScriptController.cpp; path = UIScriptContext/UIScriptController.cpp; sourceTree = "<group>"; };
+                0F87B61D1BACDA93004EC572 /* UIScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIScriptController.h; path = UIScriptContext/UIScriptController.h; sourceTree = "<group>"; };
+                0F87B6221BACDAA2004EC572 /* UIScriptController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = UIScriptController.idl; path = UIScriptContext/Bindings/UIScriptController.idl; sourceTree = "<group>"; };
</ins><span class="cx">                 0FEB909E1905A776000FDBF3 /* InjectedBundlePageCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundlePageCocoa.mm; sourceTree = "<group>"; };
</span><span class="cx">                 0FEB90A21905BC6A000FDBF3 /* CrashReporterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CrashReporterInfo.h; path = cocoa/CrashReporterInfo.h; sourceTree = "<group>"; };
</span><span class="cx">                 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CrashReporterInfo.mm; path = cocoa/CrashReporterInfo.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -391,6 +412,7 @@
</span><span class="cx">                                 3110BE0F15BA011400D216AC /* WebNotificationProvider.h */,
</span><span class="cx">                                 4429FC5E1627089600F66D8B /* WorkQueueManager.cpp */,
</span><span class="cx">                                 4429FC611627089600F66D8B /* WorkQueueManager.h */,
</span><ins>+                                0F73B5471BA782FE004B3EF4 /* UIScriptContext */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = TestRunner;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -408,6 +430,36 @@
</span><span class="cx">                         name = "External Frameworks and Libraries";
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><ins>+                0F73B5471BA782FE004B3EF4 /* UIScriptContext */ = {
+                        isa = PBXGroup;
+                        children = (
+                                0F73B54E1BA78954004B3EF4 /* Derived Sources */,
+                                0F73B54B1BA78350004B3EF4 /* Bindings */,
+                                0F87B61A1BACDA93004EC572 /* UIScriptContext.cpp */,
+                                0F87B61B1BACDA93004EC572 /* UIScriptContext.h */,
+                                0F87B61C1BACDA93004EC572 /* UIScriptController.cpp */,
+                                0F87B61D1BACDA93004EC572 /* UIScriptController.h */,
+                        );
+                        name = UIScriptContext;
+                        sourceTree = "<group>";
+                };
+                0F73B54B1BA78350004B3EF4 /* Bindings */ = {
+                        isa = PBXGroup;
+                        children = (
+                                0F87B6221BACDAA2004EC572 /* UIScriptController.idl */,
+                        );
+                        name = Bindings;
+                        sourceTree = "<group>";
+                };
+                0F73B54E1BA78954004B3EF4 /* Derived Sources */ = {
+                        isa = PBXGroup;
+                        children = (
+                                0F73B54F1BA78968004B3EF4 /* JSUIScriptController.cpp */,
+                                0F73B5501BA78968004B3EF4 /* JSUIScriptController.h */,
+                        );
+                        name = "Derived Sources";
+                        sourceTree = "<group>";
+                };
</ins><span class="cx">                 0FEB909D1905A75D000FDBF3 /* cocoa */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -423,6 +475,8 @@
</span><span class="cx">                                 0FEB90A21905BC6A000FDBF3 /* CrashReporterInfo.h */,
</span><span class="cx">                                 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */,
</span><span class="cx">                                 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */,
</span><ins>+                                0F87B6141BACC4B9004EC572 /* TestRunnerWKWebView.h */,
+                                0F87B6151BACC4B9004EC572 /* TestRunnerWKWebView.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = cocoa;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -472,6 +526,7 @@
</span><span class="cx">                 2EE52CE11890A9A80010ED21 /* Frameworks */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                0F73B5571BA7929E004B3EF4 /* JavaScriptCore.framework */,
</ins><span class="cx">                                 2EE52CE21890A9A80010ED21 /* Foundation.framework */,
</span><span class="cx">                                 2EE52CE41890A9A80010ED21 /* CoreGraphics.framework */,
</span><span class="cx">                                 2EE52CE61890A9A80010ED21 /* UIKit.framework */,
</span><span class="lines">@@ -491,12 +546,14 @@
</span><span class="cx">                 2EE52D121890A9FB0010ED21 /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                0F831AE91BAB84F400F96CD8 /* Launch.storyboard */,
</del><ins>+                                0F87B6181BACC558004EC572 /* Launch.storyboard */,
</ins><span class="cx">                                 2EE52CEB1890A9A80010ED21 /* InfoPlist.strings */,
</span><span class="cx">                                 2EE52D131890A9FB0010ED21 /* PlatformWebViewIOS.mm */,
</span><span class="cx">                                 2EE52D141890A9FB0010ED21 /* TestControllerIOS.mm */,
</span><ins>+                                0F73B55B1BA89042004B3EF4 /* UIScriptControllerIOS.mm */,
</ins><span class="cx">                                 2EE52D151890A9FB0010ED21 /* WebArchiveDumpSupportIOS.mm */,
</span><span class="cx">                                 2EE52D161890A9FB0010ED21 /* mainIOS.mm */,
</span><ins>+                                0F831AE71BAB72D000F96CD8 /* Launch.storyboard */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = ios;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -587,6 +644,7 @@
</span><span class="cx">                                 E1C642C217CBCC7300D66A3C /* PoseAsClass.h */,
</span><span class="cx">                                 E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */,
</span><span class="cx">                                 BC8C795B11D2785D004535A1 /* TestControllerMac.mm */,
</span><ins>+                                0F87B6111BACAD6F004EC572 /* UIScriptControllerMac.mm */,
</ins><span class="cx">                                 E132AA3917CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.h */,
</span><span class="cx">                                 E132AA3817CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm */,
</span><span class="cx">                                 E132AA3C17CE776F00611DF0 /* WebKitTestRunnerEvent.h */,
</span><span class="lines">@@ -677,6 +735,7 @@
</span><span class="cx">                         isa = PBXHeadersBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                0F73B5521BA78968004B3EF4 /* JSUIScriptController.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -803,7 +862,7 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 2E34C90018B68808000067BB /* WebKitTestRunnerInjectedBundle.bundle in Resources */,
</span><span class="cx">                                 2EE52CED1890A9A80010ED21 /* InfoPlist.strings in Resources */,
</span><del>-                                0F831AEA1BAB84F400F96CD8 /* Launch.storyboard in Resources */,
</del><ins>+                                0F87B6191BACC558004EC572 /* Launch.storyboard in Resources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span><span class="lines">@@ -865,6 +924,7 @@
</span><span class="cx">                                 5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */,
</span><span class="cx">                                 BC793400118F7C84005EA8E2 /* main.mm in Sources */,
</span><span class="cx">                                 E1C642C617CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm in Sources */,
</span><ins>+                                0F87B6131BACAD82004EC572 /* UIScriptControllerMac.mm in Sources */,
</ins><span class="cx">                                 BC7934E811906846005EA8E2 /* PlatformWebViewMac.mm in Sources */,
</span><span class="cx">                                 BC8C795C11D2785D004535A1 /* TestControllerMac.mm in Sources */,
</span><span class="cx">                                 E132AA3A17CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm in Sources */,
</span><span class="lines">@@ -875,16 +935,22 @@
</span><span class="cx">                         isa = PBXSourcesBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                0F73B55A1BA792FF004B3EF4 /* JSWrapper.cpp in Sources */,
</ins><span class="cx">                                 A18510441B9AE14A00744AEB /* WorkQueueManager.cpp in Sources */,
</span><span class="cx">                                 A185103F1B9AE12900744AEB /* GeolocationProviderMock.cpp in Sources */,
</span><ins>+                                0F73B55C1BA89042004B3EF4 /* UIScriptControllerIOS.mm in Sources */,
</ins><span class="cx">                                 A185103C1B9AE0FE00744AEB /* Options.cpp in Sources */,
</span><span class="cx">                                 A18510431B9AE14500744AEB /* WebNotificationProvider.cpp in Sources */,
</span><span class="cx">                                 A18510411B9AE13800744AEB /* TestController.cpp in Sources */,
</span><ins>+                                0F87B6201BACDA93004EC572 /* UIScriptController.cpp in Sources */,
</ins><span class="cx">                                 A18510421B9AE13E00744AEB /* TestInvocation.cpp in Sources */,
</span><span class="cx">                                 A18510401B9AE13100744AEB /* PixelDumpSupport.cpp in Sources */,
</span><span class="cx">                                 A185103D1B9AE10600744AEB /* TestInvocationCG.cpp in Sources */,
</span><span class="cx">                                 A185103A1B9AE0DA00744AEB /* CrashReporterInfo.mm in Sources */,
</span><ins>+                                0F73B5511BA78968004B3EF4 /* JSUIScriptController.cpp in Sources */,
+                                0F87B61E1BACDA93004EC572 /* UIScriptContext.cpp in Sources */,
</ins><span class="cx">                                 A185103E1B9AE12200744AEB /* CyclicRedundancyCheck.cpp in Sources */,
</span><ins>+                                0F87B6171BACC4C0004EC572 /* TestRunnerWKWebView.mm in Sources */,
</ins><span class="cx">                                 A185103B1B9AE0E200744AEB /* TestControllerCocoa.mm in Sources */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="lines">@@ -1193,6 +1259,7 @@
</span><span class="cx">                                 A115CCB81B9D769D00E89159 /* Production */,
</span><span class="cx">                         );
</span><span class="cx">                         defaultConfigurationIsVisible = 0;
</span><ins>+                        defaultConfigurationName = Production;
</ins><span class="cx">                 };
</span><span class="cx">                 A185102D1B9ADE4800744AEB /* Build configuration list for PBXNativeTarget "WebKitTestRunner (Library)" */ = {
</span><span class="cx">                         isa = XCConfigurationList;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnercocoaTestControllerCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #import "CrashReporterInfo.h"
</span><span class="cx"> #import "PlatformWebView.h"
</span><span class="cx"> #import "TestInvocation.h"
</span><ins>+#import "TestRunnerWKWebView.h"
</ins><span class="cx"> #import <Foundation/Foundation.h>
</span><span class="cx"> #import <WebKit/WKContextConfigurationRef.h>
</span><span class="cx"> #import <WebKit/WKPreferencesRefPrivate.h>
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewhfromrev190064trunkToolsWebKitTestRunnerTestOptionsh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h (from rev 190064, trunk/Tools/WebKitTestRunner/TestOptions.h) (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h         (rev 0)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import <WebKit/WebKit.h>
+
+#if WK_API_ENABLED
+
+@interface TestRunnerWKWebView : WKWebView
+
+#if PLATFORM(IOS)
+- (void)zoomToScale:(double)scale animated:(BOOL)animated completionHandler:(void (^)(void))completionHandler;
+- (void)onDidEndZooming:(void (^)(void))completionHandler;
+#endif
+
+@end
+
+#endif // #if WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnercocoaTestRunnerWKWebViewmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm         (rev 0)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "config.h"
+#import "TestRunnerWKWebView.h"
+
+#import "WebKitTestRunnerDraggingInfo.h"
+#import <wtf/Assertions.h>
+#import <wtf/RetainPtr.h>
+
+@interface WKWebView ()
+
+#if PLATFORM(IOS)
+- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(CGFloat)scale;
+#endif
+
+@end
+
+#if WK_API_ENABLED
+
+@interface TestRunnerWKWebView ()
+@property (nonatomic, copy) void (^zoomCompletionHandler)(void);
+@end
+
+@implementation TestRunnerWKWebView
+
+#if PLATFORM(MAC)
+- (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
+{
+ RetainPtr<WebKitTestRunnerDraggingInfo> draggingInfo = adoptNS([[WebKitTestRunnerDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj]);
+ [self draggingUpdated:draggingInfo.get()];
+}
+#endif
+
+#if PLATFORM(IOS)
+- (void)zoomToScale:(double)scale animated:(BOOL)animated completionHandler:(void (^)(void))completionHandler
+{
+ ASSERT(!self.zoomCompletionHandler);
+ self.zoomCompletionHandler = completionHandler;
+
+ [self.scrollView setZoomScale:scale animated:animated];
+}
+
+- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(CGFloat)scale
+{
+ [super scrollViewDidEndZooming:scrollView withView:view atScale:scale];
+
+ if (self.zoomCompletionHandler) {
+ self.zoomCompletionHandler();
+ self.zoomCompletionHandler = nullptr;
+ }
+}
+
+- (void)onDidEndZooming:(void (^)(void))completionHandler
+{
+ ASSERT(!self.zoomCompletionHandler);
+ self.zoomCompletionHandler = completionHandler;
+}
+#endif
+
+@end
+
+#endif // WK_API_ENABLED
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosPlatformWebViewIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -23,10 +23,11 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#include "config.h"
-#include "PlatformWebView.h"
-#include "TestController.h"
</del><ins>+#import "config.h"
+#import "PlatformWebView.h"
</ins><span class="cx">
</span><ins>+#import "TestController.h"
+#import "TestRunnerWKWebView.h"
</ins><span class="cx"> #import <WebKit/WKImageCG.h>
</span><span class="cx"> #import <WebKit/WKPreferencesPrivate.h>
</span><span class="cx"> #import <WebKit/WKWebViewConfiguration.h>
</span><span class="lines">@@ -106,7 +107,7 @@
</span><span class="cx"> , m_options(options)
</span><span class="cx"> {
</span><span class="cx"> CGRect rect = CGRectMake(0, 0, TestController::viewWidth, TestController::viewHeight);
</span><del>- m_view = [[WKWebView alloc] initWithFrame:rect configuration:configuration];
</del><ins>+ m_view = [[TestRunnerWKWebView alloc] initWithFrame:rect configuration:configuration];
</ins><span class="cx">
</span><span class="cx"> m_window = [[WebKitTestRunnerWindow alloc] initWithFrame:rect];
</span><span class="cx"> m_window.platformWebView = this;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm         (rev 0)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "config.h"
+#import "UIScriptController.h"
+
+#if PLATFORM(IOS)
+
+#import "PlatformWebView.h"
+#import "TestController.h"
+#import "TestRunnerWKWebView.h"
+#import "UIScriptContext.h"
+#import <UIKit/UIKit.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/WebKit.h>
+
+namespace WTR {
+
+void UIScriptController::doAsyncTask(JSValueRef callback)
+{
+ unsigned callbackID = m_context.prepareForAsyncTask(callback);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ m_context.asyncTaskComplete(callbackID);
+ });
+}
+
+void UIScriptController::zoomToScale(double scale, JSValueRef callback)
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+
+ unsigned callbackID = m_context.prepareForAsyncTask(callback);
+
+ [webView zoomToScale:scale animated:YES completionHandler:^{
+ m_context.asyncTaskComplete(callbackID);
+ }];
+}
+
+double UIScriptController::zoomScale() const
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ return webView.scrollView.zoomScale;
+}
+
+double UIScriptController::minimumZoomScale() const
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ return webView.scrollView.minimumZoomScale;
+}
+
+double UIScriptController::maximumZoomScale() const
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ return webView.scrollView.maximumZoomScale;
+}
+
+JSObjectRef UIScriptController::contentVisibleRect() const
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+
+ CGRect contentVisibleRect = webView._contentVisibleRect;
+
+ WKRect wkRect = WKRectMake(contentVisibleRect.origin.x, contentVisibleRect.origin.y, contentVisibleRect.size.width, contentVisibleRect.size.height);
+ return m_context.objectFromRect(wkRect);
+}
+
+}
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacEventSenderProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import "PlatformWebView.h"
</span><span class="cx"> #import "StringFunctions.h"
</span><span class="cx"> #import "TestController.h"
</span><ins>+#import "TestRunnerWKWebView.h"
</ins><span class="cx"> #import <Carbon/Carbon.h>
</span><span class="cx"> #import <WebKit/WKString.h>
</span><span class="cx"> #import <WebKit/WKPagePrivate.h>
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacPlatformWebViewMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #import "PlatformWebView.h"
</span><span class="cx">
</span><span class="cx"> #import "TestController.h"
</span><ins>+#import "TestRunnerWKWebView.h"
</ins><span class="cx"> #import "WebKitTestRunnerDraggingInfo.h"
</span><span class="cx"> #import <WebKit/WKImageCG.h>
</span><span class="cx"> #import <WebKit/WKPreferencesPrivate.h>
</span><span class="lines">@@ -53,21 +54,6 @@
</span><span class="cx"> @property (nonatomic, assign) PlatformWebView* platformWebView;
</span><span class="cx"> @end
</span><span class="cx">
</span><del>-#if WK_API_ENABLED
-@interface TestRunnerWKWebView : WKWebView
-@end
-
-@implementation TestRunnerWKWebView
-
-- (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
-{
- RetainPtr<WebKitTestRunnerDraggingInfo> draggingInfo = adoptNS([[WebKitTestRunnerDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj]);
- [self draggingUpdated:draggingInfo.get()];
-}
-
-@end
-#endif
-
</del><span class="cx"> @implementation WebKitTestRunnerWindow
</span><span class="cx"> @synthesize platformWebView = _platformWebView;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacTestControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #import "PlatformWebView.h"
</span><span class="cx"> #import "PoseAsClass.h"
</span><span class="cx"> #import "TestInvocation.h"
</span><ins>+#import "TestRunnerWKWebView.h"
</ins><span class="cx"> #import "WebKitTestRunnerPasteboard.h"
</span><span class="cx"> #import <WebKit/WKContextPrivate.h>
</span><span class="cx"> #import <WebKit/WKPageGroup.h>
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacUIScriptControllerMacmmfromrev190064trunkToolsWebKitTestRunnerTestOptionsh"></a>
<div class="copfile"><h4>Copied: trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm (from rev 190064, trunk/Tools/WebKitTestRunner/TestOptions.h) (0 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm         (rev 0)
+++ trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "config.h"
+#import "UIScriptController.h"
+
+#import "UIScriptContext.h"
+
+namespace WTR {
+
+void UIScriptController::doAsyncTask(JSValueRef callback)
+{
+ unsigned callbackID = m_context.prepareForAsyncTask(callback);
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ m_context.asyncTaskComplete(callbackID);
+ });
+}
+
+}
</ins></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacWebKitTestRunnerDraggingInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h (190064 => 190065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h        2015-09-21 19:03:31 UTC (rev 190064)
+++ trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h        2015-09-21 19:10:48 UTC (rev 190065)
</span><span class="lines">@@ -23,6 +23,8 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC)
+
</ins><span class="cx"> @interface WebKitTestRunnerDraggingInfo : NSObject <NSDraggingInfo> {
</span><span class="cx"> @private
</span><span class="cx"> NSSize _offset;
</span><span class="lines">@@ -50,3 +52,5 @@
</span><span class="cx"> - (void)resetSpringLoading;
</span><span class="cx"> #endif
</span><span class="cx"> @end
</span><ins>+
+#endif // PLATFORM(MAC)
</ins></span></pre>
</div>
</div>
</body>
</html>