Diff
Modified: trunk/LayoutTests/ChangeLog (208815 => 208816)
--- trunk/LayoutTests/ChangeLog 2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/ChangeLog 2016-11-16 23:05:00 UTC (rev 208816)
@@ -1,3 +1,24 @@
+2016-11-16 Simon Fraser <[email protected]>
+
+ 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:
+
2016-11-16 Alex Christensen <[email protected]>
REGRESSION (r207162): [debug] loader/stateobjects LayoutTests timing out
Modified: trunk/LayoutTests/TestExpectations (208815 => 208816)
--- trunk/LayoutTests/TestExpectations 2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/LayoutTests/TestExpectations 2016-11-16 23:05:00 UTC (rev 208816)
@@ -56,8 +56,7 @@
http/tests/misc/will-send-request-with-client-provided-http-body.html [ Skip ]
# 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 ]
+fast/harness/uiscriptcontroller [ Skip ]
# This test only makes sense on Mac
fast/attachment/attachment-subtitle-resize.html
Deleted: trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts-expected.txt (208815 => 208816)
--- 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)
@@ -1,9 +0,0 @@
-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.
-.
Deleted: trunk/LayoutTests/fast/harness/concurrent-ui-side-scripts.html (208815 => 208816)
--- 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)
@@ -1,80 +0,0 @@
-<!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>
-.
\ No newline at end of file
Deleted: trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback-expected.txt (208815 => 208816)
--- 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)
@@ -1,11 +0,0 @@
-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
-
Deleted: trunk/LayoutTests/fast/harness/ui-side-script-unregister-callback.html (208815 => 208816)
--- 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)
@@ -1,63 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-<head>
- <script src=""
- <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=""
-</body>
-</html>
Deleted: trunk/LayoutTests/fast/harness/ui-side-scripts-expected.txt (208815 => 208816)
--- 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)
@@ -1,10 +0,0 @@
-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.
-.
Deleted: trunk/LayoutTests/fast/harness/ui-side-scripts.html (208815 => 208816)
--- 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)
@@ -1,85 +0,0 @@
-<!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>
-.
\ No newline at end of file
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)
--- 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)
@@ -0,0 +1,9 @@
+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.
+.
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)
--- 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)
@@ -0,0 +1,80 @@
+<!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>
+.
\ No newline at end of file
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)
--- 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)
@@ -0,0 +1,11 @@
+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
+
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)
--- 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)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src=""
+ <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=""
+</body>
+</html>
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)
--- 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)
@@ -0,0 +1,11 @@
+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
+
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)
--- 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)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <script src=""
+ <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=""
+</body>
+</html>
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)
--- 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)
@@ -0,0 +1,10 @@
+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.
+.
Copied: trunk/LayoutTests/fast/harness/uiscriptcontroller/ui-side-scripts.html (from rev 208815, trunk/LayoutTests/fast/harness/ui-side-scripts.html) (0 => 208816)
--- 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)
@@ -0,0 +1,85 @@
+<!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>
+.
\ No newline at end of file
Modified: trunk/LayoutTests/platform/mac/TestExpectations (208815 => 208816)
--- 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)
@@ -25,8 +25,7 @@
fast/attachment/attachment-subtitle-resize.html [ Pass ]
-fast/harness/ui-side-scripts.html [ Pass ]
-fast/harness/concurrent-ui-side-scripts.html [ Pass ]
+fast/harness/uiscriptcontroller [ Pass ]
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
Modified: trunk/Tools/ChangeLog (208815 => 208816)
--- trunk/Tools/ChangeLog 2016-11-16 22:53:48 UTC (rev 208815)
+++ trunk/Tools/ChangeLog 2016-11-16 23:05:00 UTC (rev 208816)
@@ -1,3 +1,19 @@
+2016-11-16 Simon Fraser <[email protected]>
+
+ 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):
+
2016-11-16 Ryan Haddad <[email protected]>
Unreviewed, rolling out r208770.
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (208815 => 208816)
--- 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)
@@ -51,6 +51,7 @@
#include <wtf/LoggingAccumulator.h>
#include <wtf/MathExtras.h>
#include <wtf/RefPtr.h>
+#include <wtf/RunLoop.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/WTFString.h>
@@ -2392,9 +2393,13 @@
void TestRunner::callUIScriptCallback(unsigned callbackID, JSStringRef result)
{
- JSContextRef context = mainFrameJSContext();
- JSValueRef resultValue = JSValueMakeString(context, result);
- callTestRunnerCallback(callbackID, 1, &resultValue);
+ 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);
+ });
}
void TestRunner::uiScriptDidComplete(const String& result, unsigned callbackID)
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp (208815 => 208816)
--- 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)
@@ -172,6 +172,12 @@
String scriptResult(JSStringGetCharactersPtr(result), JSStringGetLength(result));
m_delegate.uiScriptDidComplete(scriptResult, m_currentScriptCallbackID);
+
+ // Unregister tasks associated with this callback
+ m_callbacks.removeIf([&](auto& keyAndValue) {
+ return keyAndValue.value.parentScriptCallbackID == m_currentScriptCallbackID;
+ });
+
m_currentScriptCallbackID = 0;
if (result)
JSStringRelease(result);