commit 17ef043b7c23698489f418b882bf9d9718f2ff4a
parent e8e17d4083171071da0f32e686942cb525ca42e1
Author: Edgar Chen <echen@mozilla.com>
Date: Wed, 3 Dec 2025 08:51:47 +0000
Bug 2003612 - Update exec-command-with-text-editor.tentative.html for clipboard comments; r=masayuki
clipboard commands are only available when there is valid user activation, but
this test doesn't generate a valid user activation while testing clipboad
commands. As the result, both queryCommandEnabled() and execCommand() always
return false. This doesn't seem to be what the test is intended to check.
Differential Revision: https://phabricator.services.mozilla.com/D274819
Diffstat:
2 files changed, 31 insertions(+), 62 deletions(-)
diff --git a/testing/web-platform/meta/editing/other/exec-command-with-text-editor.tentative.html.ini b/testing/web-platform/meta/editing/other/exec-command-with-text-editor.tentative.html.ini
@@ -1,25 +1,16 @@
[exec-command-with-text-editor.tentative.html?type=text]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
- [In <input type="text">, execCommand("cut", false, null), a[b\]c): The command should be enabled]
+ [In <input type="text">, execCommand("cut", false, null), ab[\]c): The command should not be enabled]
expected: FAIL
- [In <input type="text">, execCommand("cut", false, null), a[b\]c): execCommand() should return true]
+ [In <input type="text">, execCommand("cut", false, null), ab[\]c): execCommand() should return false]
expected: FAIL
- [In <input type="text">, execCommand("cut", false, null), a[b\]c): <input>.value should be "a[\]c"]
+ [In <input type="text">, execCommand("copy", false, null), abc[\]d): The command should not be enabled]
expected: FAIL
- [In <input type="text">, execCommand("cut", false, null), a[b\]c): input.inputType should be deleteByCut]
- expected: FAIL
-
- [In <input type="text">, execCommand("cut", false, null), a[b\]c): input.target should be [object HTMLInputElement\]]
- expected: FAIL
-
- [In <input type="text">, execCommand("copy", false, null), a[bc\]d): The command should be enabled]
- expected: FAIL
-
- [In <input type="text">, execCommand("copy", false, null), a[bc\]d): execCommand() should return true]
+ [In <input type="text">, execCommand("copy", false, null), abc[\]d): execCommand() should return false]
expected: FAIL
[In <input type="text">, execCommand("paste", false, null), a[\]c): The command should be supported]
@@ -61,25 +52,16 @@
[In <input type="text">, execCommand("defaultParagraphSeparator", false, div), a[b\]c): defaultParagraphSeparator value should be "div" when <input> does not have focus]
expected: FAIL
- [In <input type="text"> in contenteditable, execCommand("cut", false, null), a[b\]c): The command should be enabled]
- expected: FAIL
-
- [In <input type="text"> in contenteditable, execCommand("cut", false, null), a[b\]c): execCommand() should return true]
- expected: FAIL
-
- [In <input type="text"> in contenteditable, execCommand("cut", false, null), a[b\]c): <input>.value should be "a[\]c"]
- expected: FAIL
-
- [In <input type="text"> in contenteditable, execCommand("cut", false, null), a[b\]c): input.inputType should be deleteByCut]
+ [In <input type="text"> in contenteditable, execCommand("cut", false, null), ab[\]c): The command should not be enabled]
expected: FAIL
- [In <input type="text"> in contenteditable, execCommand("cut", false, null), a[b\]c): input.target should be [object HTMLInputElement\]]
+ [In <input type="text"> in contenteditable, execCommand("cut", false, null), ab[\]c): execCommand() should return false]
expected: FAIL
- [In <input type="text"> in contenteditable, execCommand("copy", false, null), a[bc\]d): The command should be enabled]
+ [In <input type="text"> in contenteditable, execCommand("copy", false, null), abc[\]d): The command should not be enabled]
expected: FAIL
- [In <input type="text"> in contenteditable, execCommand("copy", false, null), a[bc\]d): execCommand() should return true]
+ [In <input type="text"> in contenteditable, execCommand("copy", false, null), abc[\]d): execCommand() should return false]
expected: FAIL
[In <input type="text"> in contenteditable, execCommand("paste", false, null), a[\]c): The command should be supported]
@@ -112,7 +94,7 @@
[exec-command-with-text-editor.tentative.html?type=password]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
- [In <input type="password">, execCommand("cut", false, null), a[b\]c): The command should be enabled]
+ [In <input type="password">, execCommand("cut", false, null), ab[\]c): The command should not be enabled]
expected: FAIL
[In <input type="password">, execCommand("cut", false, null), a[b\]c): execCommand() should return true]
@@ -127,7 +109,7 @@
[In <input type="password">, execCommand("cut", false, null), a[b\]c): input.target should be [object HTMLInputElement\]]
expected: FAIL
- [In <input type="password">, execCommand("copy", false, null), a[bc\]d): The command should be enabled]
+ [In <input type="password">, execCommand("copy", false, null), abc[\]d): The command should not be enabled]
expected: FAIL
[In <input type="password">, execCommand("copy", false, null), a[bc\]d): execCommand() should return true]
@@ -172,7 +154,7 @@
[In <input type="password">, execCommand("defaultParagraphSeparator", false, div), a[b\]c): defaultParagraphSeparator value should be "div" when <input> does not have focus]
expected: FAIL
- [In <input type="password"> in contenteditable, execCommand("cut", false, null), a[b\]c): The command should be enabled]
+ [In <input type="password"> in contenteditable, execCommand("cut", false, null), ab[\]c): The command should not be enabled]
expected: FAIL
[In <input type="password"> in contenteditable, execCommand("cut", false, null), a[b\]c): execCommand() should return true]
@@ -187,7 +169,7 @@
[In <input type="password"> in contenteditable, execCommand("cut", false, null), a[b\]c): input.target should be [object HTMLInputElement\]]
expected: FAIL
- [In <input type="password"> in contenteditable, execCommand("copy", false, null), a[bc\]d): The command should be enabled]
+ [In <input type="password"> in contenteditable, execCommand("copy", false, null), abc[\]d): The command should not be enabled]
expected: FAIL
[In <input type="password"> in contenteditable, execCommand("copy", false, null), a[bc\]d): execCommand() should return true]
@@ -221,25 +203,16 @@
expected: FAIL
[exec-command-with-text-editor.tentative.html?type=textarea]
- [In <textarea>, execCommand("cut", false, null), a[b\]c): The command should be enabled]
+ [In <textarea>, execCommand("cut", false, null), ab[\]c): The command should not be enabled]
expected: FAIL
- [In <textarea>, execCommand("cut", false, null), a[b\]c): execCommand() should return true]
+ [In <textarea>, execCommand("cut", false, null), ab[\]c): execCommand() should return false]
expected: FAIL
- [In <textarea>, execCommand("cut", false, null), a[b\]c): <textarea>.value should be "a[\]c"]
+ [In <textarea>, execCommand("copy", false, null), abc[\]d): The command should not be enabled]
expected: FAIL
- [In <textarea>, execCommand("cut", false, null), a[b\]c): input.inputType should be deleteByCut]
- expected: FAIL
-
- [In <textarea>, execCommand("cut", false, null), a[b\]c): input.target should be [object HTMLTextAreaElement\]]
- expected: FAIL
-
- [In <textarea>, execCommand("copy", false, null), a[bc\]d): The command should be enabled]
- expected: FAIL
-
- [In <textarea>, execCommand("copy", false, null), a[bc\]d): execCommand() should return true]
+ [In <textarea>, execCommand("copy", false, null), abc[\]d): execCommand() should return false]
expected: FAIL
[In <textarea>, execCommand("paste", false, null), a[\]c): The command should be supported]
@@ -284,25 +257,16 @@
[In <textarea>, execCommand("defaultParagraphSeparator", false, div), a[b\]c): defaultParagraphSeparator value should be "div" when <textarea> does not have focus]
expected: FAIL
- [In <textarea> in contenteditable, execCommand("cut", false, null), a[b\]c): The command should be enabled]
- expected: FAIL
-
- [In <textarea> in contenteditable, execCommand("cut", false, null), a[b\]c): execCommand() should return true]
- expected: FAIL
-
- [In <textarea> in contenteditable, execCommand("cut", false, null), a[b\]c): <textarea>.value should be "a[\]c"]
- expected: FAIL
-
- [In <textarea> in contenteditable, execCommand("cut", false, null), a[b\]c): input.inputType should be deleteByCut]
+ [In <textarea> in contenteditable, execCommand("cut", false, null), ab[\]c): The command should not be enabled]
expected: FAIL
- [In <textarea> in contenteditable, execCommand("cut", false, null), a[b\]c): input.target should be [object HTMLTextAreaElement\]]
+ [In <textarea> in contenteditable, execCommand("cut", false, null), ab[\]c): execCommand() should return false]
expected: FAIL
- [In <textarea> in contenteditable, execCommand("copy", false, null), a[bc\]d): The command should be enabled]
+ [In <textarea> in contenteditable, execCommand("copy", false, null), abc[\]d): The command should not be enabled]
expected: FAIL
- [In <textarea> in contenteditable, execCommand("copy", false, null), a[bc\]d): execCommand() should return true]
+ [In <textarea> in contenteditable, execCommand("copy", false, null), abc[\]d): execCommand() should return false]
expected: FAIL
[In <textarea> in contenteditable, execCommand("paste", false, null), a[\]c): The command should be supported]
diff --git a/testing/web-platform/tests/editing/other/exec-command-with-text-editor.tentative.html b/testing/web-platform/tests/editing/other/exec-command-with-text-editor.tentative.html
@@ -6,6 +6,8 @@
<meta name="variant" content="?type=password">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
+<script src="/resources/testdriver.js"></script>
+<script src='/resources/testdriver-vendor.js'></script>
<div id="container"></div>
<script>
"use strict";
@@ -19,29 +21,29 @@ const testingType = new URLSearchParams(document.location.search).get("type");
* this is not standardized even by any drafts. So, this test uses expected
* values which may be expected by web developers.
*/
-function runTests() {
+async function runTests() {
let container = document.getElementById("container");
switch (testingType) {
case "text":
case "password":
container.innerHTML = `Here <b>is</b> Text: <input id="target" type="${testingType}">`;
- runTest(document.getElementById("target"), `In <input type="${testingType}">`);
+ await runTest(document.getElementById("target"), `In <input type="${testingType}">`);
container.setAttribute("contenteditable", "true");
container.innerHTML = `Here <b>is</b> Text: <input id="target" type="${testingType}">`;
- runTest(document.getElementById("target"), `In <input type="${testingType}"> in contenteditable`);
+ await runTest(document.getElementById("target"), `In <input type="${testingType}"> in contenteditable`);
break;
case "textarea":
container.innerHTML = "Here <b>is</b> Text: <textarea id=\"target\"></textarea>";
- runTest(document.getElementById("target"), "In <textarea>");
+ await runTest(document.getElementById("target"), "In <textarea>");
container.setAttribute("contenteditable", "true");
container.innerHTML = "Here <b>is</b> Text: <textarea id=\"target\"></textarea>";
- runTest(document.getElementById("target"), "In <textarea> in contenteditable");
+ await runTest(document.getElementById("target"), "In <textarea> in contenteditable");
break;
}
done();
}
-function runTest(aTarget, aDescription) {
+async function runTest(aTarget, aDescription) {
const kIsTextArea = testingType == "textarea";
const kTests = [
/**
@@ -580,6 +582,9 @@ function runTest(aTarget, aDescription) {
for (const kTest of kTests) {
const kDescription =
`${aDescription}, execCommand("${kTest.command}", false, ${kTest.param}), ${kTest.value})`;
+ if (kTest.command === "paste" || kTest.command === "copy" || kTest.command === "cut") {
+ await test_driver.click(document.body);
+ }
aTarget.value = "dummy value to ensure the following value setting clear the undo history";
let value = kTest.value.replace(/[\[\]]/g, "");
aTarget.value = value;