<!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>[208816] 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/208816">208816</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-11-16 15:05:00 -0800 (Wed, 16 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>UIScriptController: script with no async tasks fails if an earlier script registered a callback
https://bugs.webkit.org/show_bug.cgi?id=164762
Reviewed by Wenson Hsieh.
Tools:
Make TestRunner::callUIScriptCallback() async in DumpRenderTree to match WebKitTestRunner behavior.
This fixes ui-side-script-with-callback.html in WK1, which failed because the second runUIScript()
would occur inside the completion callback from the first. This no longer happens.
* DumpRenderTree/TestRunner.cpp:
(TestRunner::callUIScriptCallback):
* TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::tryToCompleteUIScriptForCurrentParentCallback):
LayoutTests:
Move the tests that use runUIScript into their own directory for easier TestExpectations management,
and fix TestExpectations to match.
* TestExpectations:
* fast/harness/uiscriptcontroller/concurrent-ui-side-scripts-expected.txt: Renamed from LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt.
* fast/harness/uiscriptcontroller/concurrent-ui-side-scripts.html: Renamed from LayoutTests/fast/harness/concurrent-ui-side-scripts.html.
* fast/harness/uiscriptcontroller/ui-side-script-unregister-callback-expected.txt: Copied from LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt.
* fast/harness/uiscriptcontroller/ui-side-script-unregister-callback.html: Copied from LayoutTests/fast/harness/ui-side-script-unregister-callback.html.
* fast/harness/uiscriptcontroller/ui-side-script-with-callback-expected.txt: Renamed from LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt.
* fast/harness/uiscriptcontroller/ui-side-script-with-callback.html: Renamed from LayoutTests/fast/harness/ui-side-script-unregister-callback.html.
* fast/harness/uiscriptcontroller/ui-side-scripts-expected.txt: Renamed from LayoutTests/fast/harness/ui-side-scripts-expected.txt.
* fast/harness/uiscriptcontroller/ui-side-scripts.html: Renamed from LayoutTests/fast/harness/ui-side-scripts.html.
* 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="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnercpp">trunk/Tools/DumpRenderTree/TestRunner.cpp</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextUIScriptContextcpp">trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/fast/harness/uiscriptcontroller/</li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrollerconcurrentuisidescriptsexpectedtxt">trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrollerconcurrentuisidescriptshtml">trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts.html</a></li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptunregistercallbackexpectedtxt">trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptunregistercallbackhtml">trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback.html</a></li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptwithcallbackexpectedtxt">trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptwithcallbackhtml">trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback.html</a></li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptsexpectedtxt">trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptshtml">trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts.html</a></li>
</ul>
<h3>Removed 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="#trunkLayoutTestsfastharnessuisidescriptunregistercallbackexpectedtxt">trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastharnessuisidescriptunregistercallbackhtml">trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback.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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/ChangeLog        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-11-16 Simon Fraser <simon.fraser@apple.com>
+
+ UIScriptController: script with no async tasks fails if an earlier script registered a callback
+ https://bugs.webkit.org/show_bug.cgi?id=164762
+
+ Reviewed by Wenson Hsieh.
+
+ Move the tests that use runUIScript into their own directory for easier TestExpectations management,
+ and fix TestExpectations to match.
+
+ * TestExpectations:
+ * fast/harness/uiscriptcontroller/concurrent-ui-side-scripts-expected.txt: Renamed from LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt.
+ * fast/harness/uiscriptcontroller/concurrent-ui-side-scripts.html: Renamed from LayoutTests/fast/harness/concurrent-ui-side-scripts.html.
+ * fast/harness/uiscriptcontroller/ui-side-script-unregister-callback-expected.txt: Copied from LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt.
+ * fast/harness/uiscriptcontroller/ui-side-script-unregister-callback.html: Copied from LayoutTests/fast/harness/ui-side-script-unregister-callback.html.
+ * fast/harness/uiscriptcontroller/ui-side-script-with-callback-expected.txt: Renamed from LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt.
+ * fast/harness/uiscriptcontroller/ui-side-script-with-callback.html: Renamed from LayoutTests/fast/harness/ui-side-script-unregister-callback.html.
+ * fast/harness/uiscriptcontroller/ui-side-scripts-expected.txt: Renamed from LayoutTests/fast/harness/ui-side-scripts-expected.txt.
+ * fast/harness/uiscriptcontroller/ui-side-scripts.html: Renamed from LayoutTests/fast/harness/ui-side-scripts.html.
+ * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2016-11-16 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> REGRESSION (r207162): [debug] loader/stateobjects LayoutTests timing out
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/TestExpectations        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -56,8 +56,7 @@
</span><span class="cx"> http/tests/misc/will-send-request-with-client-provided-http-body.html [ Skip ]
</span><span class="cx">
</span><span class="cx"> # Only Mac and iOS have an implementation of UIScriptController::doAsyncTask().
</span><del>-fast/harness/ui-side-scripts.html [ Skip ]
-fast/harness/concurrent-ui-side-scripts.html [ Skip ]
</del><ins>+fast/harness/uiscriptcontroller [ Skip ]
</ins><span class="cx">
</span><span class="cx"> # This test only makes sense on Mac
</span><span class="cx"> fast/attachment/attachment-subtitle-resize.html
</span></span></pre></div>
<a id="trunkLayoutTestsfastharnessconcurrentuisidescriptsexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,9 +0,0 @@
</span><del>-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.
-.
</del></span></pre></div>
<a id="trunkLayoutTestsfastharnessconcurrentuisidescriptshtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,80 +0,0 @@
</span><del>-<!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>
-.
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastharnessuisidescriptunregistercallbackexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,11 +0,0 @@
</span><del>-Test that a second immediate UI script returns if an earlier script registered then unregistered a callback
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS scriptResult is "async task complete"
-PASS scriptResult is "immediate script complete"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastharnessuisidescriptunregistercallbackhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback.html (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback.html        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback.html        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,63 +0,0 @@
</span><del>-<!DOCTYPE html>
-
-<html>
-<head>
- <script src="../../resources/js-test-pre.js"></script>
- <script>
-
- var jsTestIsAsync = true;
-
- function getAsyncTaskScript()
- {
- return `(function() {
- uiController.didEndScrollingCallback = function() { };
- uiController.didEndScrollingCallback = undefined;
-
- uiController.doAsyncTask(function() {
- uiController.uiScriptComplete('async task complete');
- });
- })();`;
- }
-
- function getImmediateScript()
- {
- return `(function() {
- return 'immediate script complete';
- })();`;
- }
-
- var scriptResult;
- function runTest()
- {
- description('Test that a second immediate UI script returns if an earlier script registered then unregistered a callback');
-
- if (!window.testRunner) {
- debug('This test requires testRunner');
- return;
- }
-
- if (!testRunner.runUIScript) {
- debug('This test requires runUIScript');
- return;
- }
-
- testRunner.runUIScript(getAsyncTaskScript(), function(result) {
- scriptResult = result;
- shouldBeEqualToString('scriptResult', 'async task complete');
-
- testRunner.runUIScript(getImmediateScript(), function(result) {
- scriptResult = result;
- shouldBeEqualToString('scriptResult', 'immediate script complete');
- finishJSTest();
- });
- });
- }
- window.addEventListener('load', runTest, false);
- </script>
-</head>
-<body>
-
-<pre id="results"></pre>
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastharnessuisidescriptsexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,10 +0,0 @@
</span><del>-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.
-.
</del></span></pre></div>
<a id="trunkLayoutTestsfastharnessuisidescriptshtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/harness/ui-side-scripts.html (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/ui-side-scripts.html        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/fast/harness/ui-side-scripts.html        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,85 +0,0 @@
</span><del>-<!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>
-.
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastharnessuiscriptcontrollerconcurrentuisidescriptsexpectedtxtfromrev208815trunkLayoutTestsfastharnessconcurrentuisidescriptsexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts-expected.txt (from rev 208815, trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts-expected.txt        2016-11-16 23:05:00 UTC (rev 208816)
</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="trunkLayoutTestsfastharnessuiscriptcontrollerconcurrentuisidescriptshtmlfromrev208815trunkLayoutTestsfastharnessconcurrentuisidescriptshtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts.html (from rev 208815, trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts.html         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/concurrent-ui-side-scripts.html        2016-11-16 23:05:00 UTC (rev 208816)
</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="trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptunregistercallbackexpectedtxtfromrev208815trunkLayoutTestsfastharnessuisidescriptunregistercallbackexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback-expected.txt (from rev 208815, trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback-expected.txt        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test that a second immediate UI script returns if an earlier script registered then unregistered a callback
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS scriptResult is "async task complete"
+PASS scriptResult is "immediate script complete"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptunregistercallbackhtmlfromrev208815trunkLayoutTestsfastharnessuisidescriptunregistercallbackhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback.html (from rev 208815, trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback.html) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback.html         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-unregister-callback.html        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+ <script>
+
+ var jsTestIsAsync = true;
+
+ function getAsyncTaskScript()
+ {
+ return `(function() {
+ uiController.didEndScrollingCallback = function() { };
+ uiController.didEndScrollingCallback = undefined;
+
+ uiController.doAsyncTask(function() {
+ uiController.uiScriptComplete('async task complete');
+ });
+ })();`;
+ }
+
+ function getImmediateScript()
+ {
+ return `(function() {
+ return 'immediate script complete';
+ })();`;
+ }
+
+ var scriptResult;
+ function runTest()
+ {
+ description('Test that a second immediate UI script returns if an earlier script registered then unregistered a callback');
+
+ if (!window.testRunner) {
+ debug('This test requires testRunner');
+ return;
+ }
+
+ if (!testRunner.runUIScript) {
+ debug('This test requires runUIScript');
+ return;
+ }
+
+ testRunner.runUIScript(getAsyncTaskScript(), function(result) {
+ scriptResult = result;
+ shouldBeEqualToString('scriptResult', 'async task complete');
+
+ testRunner.runUIScript(getImmediateScript(), function(result) {
+ scriptResult = result;
+ shouldBeEqualToString('scriptResult', 'immediate script complete');
+ finishJSTest();
+ });
+ });
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body>
+
+<pre id="results"></pre>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptwithcallbackexpectedtxtfromrev208815trunkLayoutTestsfastharnessuisidescriptunregistercallbackexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback-expected.txt (from rev 208815, trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback-expected.txt        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test that a second immediate UI script returns if an earlier script registered a callback
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS scriptResult is "async task complete"
+PASS scriptResult is "immediate script complete"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptwithcallbackhtmlfromrev208815trunkLayoutTestsfastharnessuisidescriptunregistercallbackhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback.html (from rev 208815, trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback.html) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback.html         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-script-with-callback.html        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+ <script>
+
+ var jsTestIsAsync = true;
+
+ function getAsyncTaskScript()
+ {
+ return `(function() {
+ uiController.willBeginZoomingCallback = function() {};
+
+ uiController.doAsyncTask(function() {
+ uiController.uiScriptComplete('async task complete');
+ });
+ })();`;
+ }
+
+ function getImmediateScript()
+ {
+ return `(function() {
+ return 'immediate script complete';
+ })();`;
+ }
+
+ var scriptResult;
+ function runTest()
+ {
+ description('Test that a second immediate UI script returns if an earlier script registered a callback');
+
+ if (!window.testRunner) {
+ debug('This test requires testRunner');
+ return;
+ }
+
+ if (!testRunner.runUIScript) {
+ debug('This test requires runUIScript');
+ return;
+ }
+
+ testRunner.runUIScript(getAsyncTaskScript(), function(result) {
+ scriptResult = result;
+ shouldBeEqualToString('scriptResult', 'async task complete');
+
+ testRunner.runUIScript(getImmediateScript(), function(result) {
+ scriptResult = result;
+ shouldBeEqualToString('scriptResult', 'immediate script complete');
+ finishJSTest();
+ });
+ });
+ }
+ window.addEventListener('load', runTest, false);
+ </script>
+</head>
+<body>
+
+<pre id="results"></pre>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptsexpectedtxtfromrev208815trunkLayoutTestsfastharnessuisidescriptsexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts-expected.txt (from rev 208815, trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts-expected.txt        2016-11-16 23:05:00 UTC (rev 208816)
</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="trunkLayoutTestsfastharnessuiscriptcontrolleruisidescriptshtmlfromrev208815trunkLayoutTestsfastharnessuisidescriptshtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts.html (from rev 208815, trunk/LayoutTests/fast/harness/ui-side-scripts.html) (0 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts.html         (rev 0)
+++ trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts.html        2016-11-16 23:05:00 UTC (rev 208816)
</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="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -25,8 +25,7 @@
</span><span class="cx">
</span><span class="cx"> fast/attachment/attachment-subtitle-resize.html [ Pass ]
</span><span class="cx">
</span><del>-fast/harness/ui-side-scripts.html [ Pass ]
-fast/harness/concurrent-ui-side-scripts.html [ Pass ]
</del><ins>+fast/harness/uiscriptcontroller [ Pass ]
</ins><span class="cx">
</span><span class="cx"> #//////////////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> # End platform-specific directories.
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/Tools/ChangeLog        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-11-16 Simon Fraser <simon.fraser@apple.com>
+
+ UIScriptController: script with no async tasks fails if an earlier script registered a callback
+ https://bugs.webkit.org/show_bug.cgi?id=164762
+
+ Reviewed by Wenson Hsieh.
+
+ Make TestRunner::callUIScriptCallback() async in DumpRenderTree to match WebKitTestRunner behavior.
+ This fixes ui-side-script-with-callback.html in WK1, which failed because the second runUIScript()
+ would occur inside the completion callback from the first. This no longer happens.
+
+ * DumpRenderTree/TestRunner.cpp:
+ (TestRunner::callUIScriptCallback):
+ * TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
+ (UIScriptContext::tryToCompleteUIScriptForCurrentParentCallback):
+
</ins><span class="cx"> 2016-11-16 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r208770.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.cpp        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include <wtf/LoggingAccumulator.h>
</span><span class="cx"> #include <wtf/MathExtras.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><ins>+#include <wtf/RunLoop.h>
</ins><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="lines">@@ -2392,9 +2393,13 @@
</span><span class="cx">
</span><span class="cx"> void TestRunner::callUIScriptCallback(unsigned callbackID, JSStringRef result)
</span><span class="cx"> {
</span><del>- JSContextRef context = mainFrameJSContext();
- JSValueRef resultValue = JSValueMakeString(context, result);
- callTestRunnerCallback(callbackID, 1, &resultValue);
</del><ins>+ JSRetainPtr<JSStringRef> protectedResult(result);
+
+ RunLoop::main().dispatch([protectedThis = makeRef(*this), callbackID, protectedResult]() mutable {
+ JSContextRef context = protectedThis->mainFrameJSContext();
+ JSValueRef resultValue = JSValueMakeString(context, protectedResult.get());
+ protectedThis->callTestRunnerCallback(callbackID, 1, &resultValue);
+ });
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void TestRunner::uiScriptDidComplete(const String& result, unsigned callbackID)
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextUIScriptContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp (208815 => 208816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp        2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp        2016-11-16 23:05:00 UTC (rev 208816)
</span><span class="lines">@@ -172,6 +172,12 @@
</span><span class="cx"> String scriptResult(JSStringGetCharactersPtr(result), JSStringGetLength(result));
</span><span class="cx">
</span><span class="cx"> m_delegate.uiScriptDidComplete(scriptResult, m_currentScriptCallbackID);
</span><ins>+
+ // Unregister tasks associated with this callback
+ m_callbacks.removeIf([&](auto& keyAndValue) {
+ return keyAndValue.value.parentScriptCallbackID == m_currentScriptCallbackID;
+ });
+
</ins><span class="cx"> m_currentScriptCallbackID = 0;
</span><span class="cx"> if (result)
</span><span class="cx"> JSStringRelease(result);
</span></span></pre>
</div>
</div>
</body>
</html>