Diff
Modified: trunk/LayoutTests/ChangeLog (283658 => 283659)
--- trunk/LayoutTests/ChangeLog 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/ChangeLog 2021-10-06 20:57:53 UTC (rev 283659)
@@ -1,5 +1,30 @@
2021-10-06 Tim Nguyen <[email protected]>
+ Replace setTimeout(x, 0) with requestAnimationFrame(x) in some autofocus tests
+ https://bugs.webkit.org/show_bug.cgi?id=231323
+
+ Reviewed by Chris Dumez.
+
+ Reason being the new autofocus behavior will happen asynchronously during "update rendering"
+ steps which is caught by the first, but not the second method.
+
+ Other minor changes:
+ - Remove "in XHTML", because the file extensions aren't actually XHTML...
+ - Remove not needed attributes from <script> tag
+ - Remove unneeded whitespace
+
+ * fast/forms/autofocus-opera-001.html:
+ * fast/forms/autofocus-opera-002.html:
+ * fast/forms/autofocus-opera-003.html:
+ * fast/forms/autofocus-opera-004.html:
+ * fast/forms/autofocus-opera-005.html:
+ * fast/forms/autofocus-opera-006.html:
+ * fast/forms/autofocus-opera-007.html:
+ * fast/forms/autofocus-opera-008.html:
+ * fast/forms/textarea/textarea-autofocus-removal-while-focusing.html:
+
+2021-10-06 Tim Nguyen <[email protected]>
+
Rewrite plugins/object-onfocus-mutation-crash.html to stop relying on autofocus
https://bugs.webkit.org/show_bug.cgi?id=231327
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-001.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-001.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-001.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -5,7 +5,7 @@
input { background:red }
input:focus { background:lime }
</style>
-<script language="_javascript_" type="text/_javascript_">
+<script>
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
@@ -13,7 +13,7 @@
function test() {
if (window.testRunner)
testRunner.dumpAsText();
-
+
if (document.activeElement == document.getElementsByTagName("input")[0])
log("SUCCESS");
else
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-002.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-002.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-002.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -5,7 +5,7 @@
input { background:red }
input:focus { background:lime }
</style>
-<script language="_javascript_" type="text/_javascript_">
+<script>
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
@@ -13,7 +13,7 @@
function test() {
if (window.testRunner)
testRunner.dumpAsText();
-
+
if (document.activeElement == document.getElementsByTagName("input")[0])
log("SUCCESS");
else
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-003.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-003.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-003.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -6,7 +6,7 @@
input { background:red }
input:focus { background:lime }
</style>
-<script language="_javascript_" type="text/_javascript_">
+<script>
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-004.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-004.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-004.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -1,11 +1,11 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
<head>
-<title>testing "autofocus" in XHTML combined with dynamic changes</title>
+<title>testing "autofocus" combined with dynamic changes</title>
<style>
input { background:red }
input:focus { background:lime }
</style>
-<script language="_javascript_" type="text/_javascript_">
+<script>
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
@@ -18,12 +18,12 @@
var input = document.getElementsByTagName('input')[0];
var p = document.getElementsByTagName('p')[0];
var input = p.removeChild(input);
- input.setAttribute('autofocus','false');
+ input.setAttribute('autofocus', 'false');
p.appendChild(input);
- setTimeout(check, 0);
+ requestAnimationFrame(check);
}
-
+
function check() {
if (document.activeElement == document.getElementsByTagName("input")[0])
log("SUCCESS");
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-005.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-005.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-005.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -1,11 +1,11 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
<head>
-<title>testing "autofocus" in XHTML with dynamic changes (part two)</title>
+<title>testing "autofocus" with dynamic changes (part two)</title>
<style>
input { background:red }
input:focus { background:lime }
</style>
-<script language="_javascript_" type="text/_javascript_">
+<script>
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
@@ -21,10 +21,10 @@
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
-
- setTimeout(check, 0);
+
+ requestAnimationFrame(check);
}
-
+
function check() {
if (document.activeElement == document.getElementsByTagName("input")[0])
log("SUCCESS");
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-006.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-006.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-006.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -5,7 +5,7 @@
input, input#test:focus { background:lime }
input:focus, input#test { background:red }
</style>
-<script language="_javascript_" type="text/_javascript_">
+<script>
function log(message) {
document.getElementById("console").innerHTML += "<li>"+message+"</li>";
}
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-007.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-007.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-007.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -5,7 +5,7 @@
input { background:lime }
input:focus { background:red }
</style>
-<script language="_javascript_" type="text/_javascript_">
+<script>
var gotBlur = false;
function log(message) {
@@ -15,7 +15,7 @@
function switchBlur() {
gotBlur = true;
}
-
+
function test() {
if (window.testRunner)
testRunner.dumpAsText();
Modified: trunk/LayoutTests/fast/forms/autofocus-opera-008.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/autofocus-opera-008.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/autofocus-opera-008.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -1,6 +1,6 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html>
<head>
-<title>"autofocus" in XHTML and the focus() method</title>
+<title>"autofocus" and the focus() method</title>
<style>
input, input#test:focus { background:lime }
input#test, input:focus { background:red }
@@ -12,7 +12,7 @@
function test() {
document.getElementsByTagName('input')[0].focus();
-
+
if (window.testRunner)
testRunner.dumpAsText();
Modified: trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing.html (283658 => 283659)
--- trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing.html 2021-10-06 20:53:05 UTC (rev 283658)
+++ trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing.html 2021-10-06 20:57:53 UTC (rev 283659)
@@ -2,16 +2,19 @@
<html>
<body>
<script>
-testRunner.dumpAsText();
-testRunner.waitUntilDone();
-var textarea = document.createElement("textarea");
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+const textarea = document.createElement("textarea");
textarea.setAttribute("autofocus", "");
textarea.addEventListener("DOMFocusIn", function () { document.documentElement.innerHTML = ""; }, false);
document.documentElement.appendChild(textarea);
-window.setTimeout(function() {
+requestAnimationFrame(() => {
document.body.innerHTML = "PASS unless crash.";
- testRunner.notifyDone();
-}, 0);
+ if (window.testRunner)
+ testRunner.notifyDone();
+});
</script>
</body>
</html>