part 2: Disable some Gecko specific edit commands in release and beta channel, and all of them in nightly channel

The telemetry result is written in bug 1706266 comment 1:
https://bugzilla.mozilla.org/show_bug.cgi?id=1706266#c1

`increasefontsize`, `decreasefontsize`, `gethtml`, `heading` and `readonly` are
obviously not used by web apps in the wild.  Therefore, they can be disabled
in all channels.

`contentReadOnly` and `insertBrOnReturn` are odd.  The usage is really low (less
than 1% of beta users).  However, the number of documents which used the command
is about 1k samples.  The result of the commands are not tiny (making the editor
not editable or changing the behavior at typing `Enter` key in `<div>`, `<p>`,
etc).  Therefore, it's hard to use them in web apps which supports not only
Gecko.  So I guess that they are collected the number of used by automated
tests of somebody because of the constant number in other beta versions.
Perhaps, we should disable it only in Nightly channel for now, and after a
couple of releases, we should try to disable those commands too later.

Depends on D130328

Differential Revision: https://phabricator.services.mozilla.com/D130329

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1706266
gecko-commit: 5d6a85b1788ecb66fef5ea788eba0817e07db9e2
gecko-reviewers: smaug
diff --git a/editing/other/exec-command-with-text-editor.tentative.html b/editing/other/exec-command-with-text-editor.tentative.html
index f9e6094..f2c1fce 100644
--- a/editing/other/exec-command-with-text-editor.tentative.html
+++ b/editing/other/exec-command-with-text-editor.tentative.html
@@ -53,31 +53,9 @@
     {command: "getHTML", param: null,
      value: "a[b]c", expectedValue: "a[b]c",
      expectedExecCommandResult: false,
-     expectedCommandSupported: true,
-     expectedCommandEnabled: true,
+     expectedCommandSupported: false,
+     expectedCommandEnabled: false,
      beforeinputExpected: null, inputExpected: null,
-     additionalCheckFunc: aDescription => {
-       test(
-         () => assert_equals(document.queryCommandValue("getHTML"), "b"),
-         `${aDescription}: getHTML value should be "b" when ${
-           kIsTextArea ? "<textarea>" : "<input>"
-         } has focus`
-       );
-       aTarget.blur();
-       container.focus();
-       getSelection().setBaseAndExtent(
-         container.firstChild,
-         1,
-         container.querySelector("b").nextSibling,
-         2
-       );
-       test(
-         () => assert_equals(document.queryCommandValue("getHTML"), "ere <b>is</b> T"),
-         `${aDescription}: getHTML value should be "ere <b>is</b> T" when ${
-           kIsTextArea ? "<textarea>" : "<input>"
-         } does not have focus`
-        );
-      },
     },
     {command: "bold", param: "bold",
      value: "a[b]c", expectedValue: "a[b]c",
@@ -283,14 +261,14 @@
     {command: "increasefontsize", param: null,
      value: "a[b]c", expectedValue: "a[b]c",
      expectedExecCommandResult: false,
-     expectedCommandSupported: true,
+     expectedCommandSupported: false,
      expectedCommandEnabled: false,
      beforeinputExpected: null, inputExpected: null,
     },
     {command: "decreasefontsize", param: null,
      value: "a[b]c", expectedValue: "a[b]c",
      expectedExecCommandResult: false,
-     expectedCommandSupported: true,
+     expectedCommandSupported: false,
      expectedCommandEnabled: false,
      beforeinputExpected: null, inputExpected: null,
     },
@@ -413,7 +391,7 @@
     {command: "heading", param: "h1",
      value: "a[b]c", expectedValue: "a[b]c",
      expectedExecCommandResult: false,
-     expectedCommandSupported: true,
+     expectedCommandSupported: false,
      expectedCommandEnabled: false,
      beforeinputExpected: null, inputExpected: null,
     },
@@ -467,19 +445,19 @@
     },
     {command: "contentReadOnly", param: "true",
      value: "a[b]c", expectedValue: "a[b]c",
-     expectedExecCommandResult: true,
-     expectedCommandSupported: true,
-     expectedCommandEnabled: true,
+     expectedExecCommandResult: false,
+     expectedCommandSupported: false,
+     expectedCommandEnabled: false,
      beforeinputExpected: null, inputExpected: null,
      additionalCheckFunc: aDescription => {
        test(
-         () => assert_equals(document.queryCommandState("contentReadOnly"), true),
+         () => assert_equals(document.queryCommandState("contentReadOnly"), false),
          `${aDescription}: contentReadOnly state should be true when ${
            kIsTextArea ? "<textarea>" : "<input>"
          } has focus`
        );
        test(
-         () => assert_equals(aTarget.readOnly, true),
+         () => assert_equals(aTarget.readOnly, false),
          `${aDescription}: readonly property should be true`
        );
        aTarget.blur();
@@ -495,9 +473,9 @@
     },
     {command: "contentReadOnly", param: "false",
      value: "a[b]c", expectedValue: "a[b]c",
-     expectedExecCommandResult: true,
-     expectedCommandSupported: true,
-     expectedCommandEnabled: true,
+     expectedExecCommandResult: false,
+     expectedCommandSupported: false,
+     expectedCommandEnabled: false,
      beforeinputExpected: null, inputExpected: null,
      additionalCheckFunc: aDescription => {
        test(
@@ -603,7 +581,7 @@
       } enabled`
     );
 
-    if (!document.queryCommandSupported(kTest.command)) {
+    if (!document.queryCommandSupported(kTest.command) || !kTest.expectedCommandSupported) {
       continue;
     }
 
diff --git a/editing/other/legacy-edit-command.html b/editing/other/legacy-edit-command.html
new file mode 100644
index 0000000..81ff89d
--- /dev/null
+++ b/editing/other/legacy-edit-command.html
@@ -0,0 +1,117 @@
+<!doctype html>
+<html>
+<meta charset=utf-8>
+<meta name="variant" content="?command=increaseFontSize">
+<meta name="variant" content="?command=decreaseFontSize">
+<meta name="variant" content="?command=getHTML">
+<meta name="variant" content="?command=insertBrOrReturn&param=true">
+<meta name="variant" content="?command=insertBrOrReturn&param=false">
+<meta name="variant" content="?command=heading&param=h1">
+<meta name="variant" content="?command=heading&param=h2">
+<meta name="variant" content="?command=heading&param=h3">
+<meta name="variant" content="?command=heading&param=h4">
+<meta name="variant" content="?command=heading&param=h5">
+<meta name="variant" content="?command=heading&param=h6">
+<meta name="variant" content="?command=contentReadOnly&param=true">
+<meta name="variant" content="?command=contentReadOnly&param=false">
+<meta name="variant" content="?command=readonly&param=true">
+<meta name="variant" content="?command=readonly&param=false">
+<title>Test legacy commands won't work</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+</head>
+<body contenteditable></body>
+<script>
+"use strict";
+
+const testParams = new URLSearchParams(location.search.substring(1));
+const command = testParams.get("command");
+const param = testParams.has("param") ? testParams.get("param") : undefined;
+
+const editor = document.body;
+
+promise_test(async () => {
+  await new Promise(resolve => addEventListener("load", resolve, {once: true}));
+}, "Wait for load...");
+
+promise_test(async () => {
+  function reset() {
+    editor.innerHTML = "<p>abc</p>";
+    editor.focus();
+    getSelection().setBaseAndExtent(
+      editor.querySelector("p").firstChild,
+      1,
+      editor.querySelector("p").firstChild,
+      2
+    );
+  }
+  test(() => {
+    reset();
+    let inputEvents = [];
+    function onInput(event) {
+      inputEvents.push(event);
+    }
+    editor.addEventListener("input", onInput);
+    try {
+      assert_equals(
+        document.execCommand(command, false, param),
+        false,
+        "result should be false"
+      );
+      assert_equals(
+        editor.outerHTML,
+        "<body contenteditable=\"\"><p>abc</p></body>",
+        "editable content shouldn't be modified"
+      );
+      assert_equals(
+        inputEvents.length,
+        0,
+        "no input events should be fired"
+      );
+    } finally {
+      editor.removeEventListener("input", onInput);
+    }
+  }, `execCommand("${command}", false, ${param === undefined ? "undefined" : `"${param}"`})`);
+  test(() => {
+    reset();
+    assert_equals(
+      document.queryCommandState(command),
+      false,
+      "result should be false"
+    );
+  }, `queryCommandState("${command}")`);
+  test(() => {
+    reset();
+    assert_equals(
+      document.queryCommandEnabled(command),
+      false,
+      "result should be false"
+    );
+  }, `queryCommandEnabled("${command}")`);
+  test(() => {
+    reset();
+    assert_equals(
+      document.queryCommandIndeterm(command),
+      false,
+      "result should be false"
+    );
+  }, `queryCommandIndeterm("${command}")`);
+  test(() => {
+    reset();
+    assert_equals(
+      document.queryCommandValue(command),
+      "",
+      "result should be empty string"
+    );
+  }, `queryCommandValue("${command}")`);
+  test(() => {
+    reset();
+    assert_equals(
+      document.queryCommandSupported(command),
+      false,
+      "result should be false"
+    );
+  }, `queryCommandSupported("${command}")`);
+}, `command: "${command}", param: "${param}"`);
+</script>
+</html>