summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests
diff options
context:
space:
mode:
Diffstat (limited to 'editor/libeditor/tests')
-rw-r--r--editor/libeditor/tests/browserscope/test_richtext.html2
-rw-r--r--editor/libeditor/tests/mochitest.toml2
-rw-r--r--editor/libeditor/tests/test_bug1053048.html2
-rw-r--r--editor/libeditor/tests/test_bug1649005.html2
-rw-r--r--editor/libeditor/tests/test_bug1659276.html2
-rw-r--r--editor/libeditor/tests/test_bug502673.html2
-rw-r--r--editor/libeditor/tests/test_bug525389.html2
-rw-r--r--editor/libeditor/tests/test_bug569988.html10
-rw-r--r--editor/libeditor/tests/test_bug607584.xhtml14
-rw-r--r--editor/libeditor/tests/test_bug611182.html2
-rw-r--r--editor/libeditor/tests/test_bug616590.xhtml14
-rw-r--r--editor/libeditor/tests/test_bug674770-1.html4
-rw-r--r--editor/libeditor/tests/test_bug674770-2.html2
-rw-r--r--editor/libeditor/tests/test_bug780908.xhtml14
-rw-r--r--editor/libeditor/tests/test_command_state_when_readonly.html149
-rw-r--r--editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html6
-rw-r--r--editor/libeditor/tests/test_contenteditable_text_input_handling.html5
-rw-r--r--editor/libeditor/tests/test_dragdrop.html12
-rw-r--r--editor/libeditor/tests/test_execCommandPaste_noTarget.html2
-rw-r--r--editor/libeditor/tests/test_htmleditor_keyevent_handling.html8
-rw-r--r--editor/libeditor/tests/test_middle_click_paste.html4
-rw-r--r--editor/libeditor/tests/test_nsIEditor_documentIsEmpty.html2
-rw-r--r--editor/libeditor/tests/test_paste_redirect_focus_in_paste_event_listener.html6
-rw-r--r--editor/libeditor/tests/test_texteditor_keyevent_handling.html12
-rw-r--r--editor/libeditor/tests/test_texteditor_wrapping_long_line.html2
25 files changed, 209 insertions, 73 deletions
diff --git a/editor/libeditor/tests/browserscope/test_richtext.html b/editor/libeditor/tests/browserscope/test_richtext.html
index c07f0a366a..3322522929 100644
--- a/editor/libeditor/tests/browserscope/test_richtext.html
+++ b/editor/libeditor/tests/browserscope/test_richtext.html
@@ -23,7 +23,7 @@ SimpleTest.waitForExplicitFinish();
// Running all of the tests can take a long time, try to account for it
SimpleTest.requestLongerTimeout(5);
-function sendScore(results, continueParams) {
+function sendScore(results) {
ok(results.length > 1, "At least one test should have been run");
for (var i = 1; i < results.length; ++i) {
var result = results[i];
diff --git a/editor/libeditor/tests/mochitest.toml b/editor/libeditor/tests/mochitest.toml
index 5af13503f7..15a6d4c379 100644
--- a/editor/libeditor/tests/mochitest.toml
+++ b/editor/libeditor/tests/mochitest.toml
@@ -418,6 +418,8 @@ skip-if = ["os == 'android'"] #Bug 1575739
["test_cmd_paragraphState.html"]
+["test_command_state_when_readonly.html"]
+
["test_composition_event_created_in_chrome.html"]
["test_composition_with_highlight_in_texteditor.html"]
diff --git a/editor/libeditor/tests/test_bug1053048.html b/editor/libeditor/tests/test_bug1053048.html
index 4f9df5e602..416d6442d6 100644
--- a/editor/libeditor/tests/test_bug1053048.html
+++ b/editor/libeditor/tests/test_bug1053048.html
@@ -37,7 +37,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1053048
// synthesizing the key press. So, we don't need to check whether a
// notification actually comes here.
let selectionListener = {
- notifySelectionChanged(aDocument, aSelection, aReason, aAmount) {
+ notifySelectionChanged() {
ok(true, "selectionStart: " + textarea.selectionStart);
ok(true, "selectionEnd: " + textarea.selectionEnd);
},
diff --git a/editor/libeditor/tests/test_bug1649005.html b/editor/libeditor/tests/test_bug1649005.html
index fbd8e16ef8..5e08e16493 100644
--- a/editor/libeditor/tests/test_bug1649005.html
+++ b/editor/libeditor/tests/test_bug1649005.html
@@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1649005
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script>
/** Test for bug 1649005, bug 1779343 **/
- window.addEventListener("DOMContentLoaded", (event) => {
+ window.addEventListener("DOMContentLoaded", () => {
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
document.body.textContent = ""; // It would be \n\n otherwise...
diff --git a/editor/libeditor/tests/test_bug1659276.html b/editor/libeditor/tests/test_bug1659276.html
index 6789db2e77..6286e58327 100644
--- a/editor/libeditor/tests/test_bug1659276.html
+++ b/editor/libeditor/tests/test_bug1659276.html
@@ -63,7 +63,7 @@ SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(async () => {
function waitForTickOfRefeshDriver() {
function awaitOneRefresh() {
- return new Promise(function(aResolve, aReject) {
+ return new Promise(function(aResolve) {
requestAnimationFrame(aResolve);
});
}
diff --git a/editor/libeditor/tests/test_bug502673.html b/editor/libeditor/tests/test_bug502673.html
index 0850cf3de0..fcfb1f329e 100644
--- a/editor/libeditor/tests/test_bug502673.html
+++ b/editor/libeditor/tests/test_bug502673.html
@@ -37,7 +37,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=502673
editor.removeDocumentStateListener(this);
},
- NotifyDocumentStateChanged(aNowDirty) {
+ NotifyDocumentStateChanged() {
var editor = SpecialPowers.wrap(this.input).editor;
editor.removeDocumentStateListener(this);
},
diff --git a/editor/libeditor/tests/test_bug525389.html b/editor/libeditor/tests/test_bug525389.html
index 500720d92a..25c6e2b8e3 100644
--- a/editor/libeditor/tests/test_bug525389.html
+++ b/editor/libeditor/tests/test_bug525389.html
@@ -17,7 +17,7 @@ function getLoadContext() {
async function runTest() {
var pasteCount = 0;
- var pasteFunc = function(event) { pasteCount++; };
+ var pasteFunc = function() { pasteCount++; };
function verifyContent(s) {
var e = document.getElementById("i1");
diff --git a/editor/libeditor/tests/test_bug569988.html b/editor/libeditor/tests/test_bug569988.html
index c4d4b040ba..6181668374 100644
--- a/editor/libeditor/tests/test_bug569988.html
+++ b/editor/libeditor/tests/test_bug569988.html
@@ -33,7 +33,7 @@ function runTest() {
os.addObserver(onPromptLoad, "common-dialog-loaded");
os.addObserver(onPromptLoad, "tabmodal-dialog-loaded");
- function onPromptLoad(subject, topic, data) {
+ function onPromptLoad(subject) {
let ui = subject.Dialog ? subject.Dialog.ui : undefined;
if (!ui) {
// subject is an tab prompt, find the elements ourselves
@@ -54,19 +54,15 @@ function runTest() {
sendAsyncMessage("ok", [true, "onPromptFocus is called"]);
gPromptInput.removeEventListener("focus", onPromptFocus);
- var listenerService = Services.els;
-
var listener = {
handleEvent: function _hv(aEvent) {
var isPrevented = aEvent.defaultPrevented;
sendAsyncMessage("ok", [!isPrevented,
"ESC key event is prevented by editor"]);
- listenerService.removeSystemEventListener(gPromptInput, "keypress",
- listener, false);
+ gPromptInput.removeEventListener("keypress", listener, { mozSystemGroup: true });
},
};
- listenerService.addSystemEventListener(gPromptInput, "keypress",
- listener, false);
+ gPromptInput.addEventListener("keypress", listener, { mozSystemGroup: true });
sendAsyncMessage("info", "sending key");
var EventUtils = {};
diff --git a/editor/libeditor/tests/test_bug607584.xhtml b/editor/libeditor/tests/test_bug607584.xhtml
index f610de544b..37bb3dc5a4 100644
--- a/editor/libeditor/tests/test_bug607584.xhtml
+++ b/editor/libeditor/tests/test_bug607584.xhtml
@@ -44,7 +44,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
"nsISupportsWeakReference"]),
- onStateChange(aWebProgress, aRequest, aStateFlags, aStatus)
+ onStateChange(aWebProgress, aRequest, aStateFlags)
{
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
{
@@ -71,25 +71,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607584
},
- onProgressChange(aWebProgress, aRequest,
- aCurSelfProgress, aMaxSelfProgress,
- aCurTotalProgress, aMaxTotalProgress)
+ onProgressChange()
{
},
- onLocationChange(aWebProgress, aRequest, aLocation, aFlags)
+ onLocationChange()
{
},
- onStatusChange(aWebProgress, aRequest, aStatus, aMessage)
+ onStatusChange()
{
},
- onSecurityChange(aWebProgress, aRequest, aState)
+ onSecurityChange()
{
},
- onContentBlockingEvent(aWebProgress, aRequest, aEvent)
+ onContentBlockingEvent()
{
},
diff --git a/editor/libeditor/tests/test_bug611182.html b/editor/libeditor/tests/test_bug611182.html
index 7843156fda..125dcacb62 100644
--- a/editor/libeditor/tests/test_bug611182.html
+++ b/editor/libeditor/tests/test_bug611182.html
@@ -92,7 +92,7 @@ SimpleTest.waitForFocus(function() {
// start running all tests.
var myXHR = new XMLHttpRequest();
myXHR.open("GET", "file_bug611182.sjs?queryTotalTests");
- myXHR.onload = function(e) {
+ myXHR.onload = function() {
totalTests = myXHR.responseText;
runAllTests();
};
diff --git a/editor/libeditor/tests/test_bug616590.xhtml b/editor/libeditor/tests/test_bug616590.xhtml
index 1f6cb3d0f8..4a4bad7224 100644
--- a/editor/libeditor/tests/test_bug616590.xhtml
+++ b/editor/libeditor/tests/test_bug616590.xhtml
@@ -43,7 +43,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616590
QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
"nsISupportsWeakReference"]),
- onStateChange(aWebProgress, aRequest, aStateFlags, aStatus)
+ onStateChange(aWebProgress, aRequest, aStateFlags)
{
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
{
@@ -60,25 +60,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616590
},
- onProgressChange(aWebProgress, aRequest,
- aCurSelfProgress, aMaxSelfProgress,
- aCurTotalProgress, aMaxTotalProgress)
+ onProgressChange()
{
},
- onLocationChange(aWebProgress, aRequest, aLocation, aFlags)
+ onLocationChange()
{
},
- onStatusChange(aWebProgress, aRequest, aStatus, aMessage)
+ onStatusChange()
{
},
- onSecurityChange(aWebProgress, aRequest, aState)
+ onSecurityChange()
{
},
- onContentBlockingEvent(aWebProgress, aRequest, aEvent)
+ onContentBlockingEvent()
{
},
diff --git a/editor/libeditor/tests/test_bug674770-1.html b/editor/libeditor/tests/test_bug674770-1.html
index 0b6089e0ef..d8e792ccd2 100644
--- a/editor/libeditor/tests/test_bug674770-1.html
+++ b/editor/libeditor/tests/test_bug674770-1.html
@@ -55,7 +55,7 @@ function startTests() {
SimpleTest.executeSoon(runNextTest);
}, false);
- SpecialPowers.addSystemEventListener(window, "auxclick", function(aEvent) {
+ SpecialPowers.wrap(window).addEventListener("auxclick", function(aEvent) {
// When the click event should cause default action, e.g., opening the link,
// the event shouldn't have been consumed except the link handler.
// However, in e10s mode, it's not consumed during propagating the event but
@@ -74,7 +74,7 @@ function startTests() {
// In this case, "storage" event won't be fired.
SimpleTest.executeSoon(runNextTest);
}
- }, false);
+ }, { mozSystemGroup: true });
SimpleTest.executeSoon(runNextTest);
}
diff --git a/editor/libeditor/tests/test_bug674770-2.html b/editor/libeditor/tests/test_bug674770-2.html
index 9b05277052..ab2fbca68b 100644
--- a/editor/libeditor/tests/test_bug674770-2.html
+++ b/editor/libeditor/tests/test_bug674770-2.html
@@ -320,7 +320,7 @@ function initForBodyEditableDocumentTests() {
frameDocument.getElementById("editor2").removeEventListener("click", clickEventHandler);
iframe.onload =
- function(aEvent) { SimpleTest.executeSoon(runBodyEditableDocumentTests1); };
+ function() { SimpleTest.executeSoon(runBodyEditableDocumentTests1); };
iframe.srcdoc = "<body contenteditable>body:</body>";
}
diff --git a/editor/libeditor/tests/test_bug780908.xhtml b/editor/libeditor/tests/test_bug780908.xhtml
index 590316ef46..6bfa306a71 100644
--- a/editor/libeditor/tests/test_bug780908.xhtml
+++ b/editor/libeditor/tests/test_bug780908.xhtml
@@ -46,7 +46,7 @@ adapted from test_bug607584.xhtml by Kent James <kent@caspia.com>
QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
"nsISupportsWeakReference"]),
- onStateChange(aWebProgress, aRequest, aStateFlags, aStatus)
+ onStateChange(aWebProgress, aRequest, aStateFlags)
{
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
{
@@ -69,25 +69,23 @@ adapted from test_bug607584.xhtml by Kent James <kent@caspia.com>
},
- onProgressChange(aWebProgress, aRequest,
- aCurSelfProgress, aMaxSelfProgress,
- aCurTotalProgress, aMaxTotalProgress)
+ onProgressChange()
{
},
- onLocationChange(aWebProgress, aRequest, aLocation, aFlags)
+ onLocationChange()
{
},
- onStatusChange(aWebProgress, aRequest, aStatus, aMessage)
+ onStatusChange()
{
},
- onSecurityChange(aWebProgress, aRequest, aState)
+ onSecurityChange()
{
},
- onContentBlockingEvent(aWebProgress, aRequest, aEvent)
+ onContentBlockingEvent()
{
},
diff --git a/editor/libeditor/tests/test_command_state_when_readonly.html b/editor/libeditor/tests/test_command_state_when_readonly.html
new file mode 100644
index 0000000000..7b4daaa1b3
--- /dev/null
+++ b/editor/libeditor/tests/test_command_state_when_readonly.html
@@ -0,0 +1,149 @@
+<!doctype html>
+<title>Test for nsIEditor.isCommandEnabled for normal and read-only editors</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css">
+<div contenteditable></div>
+<script>
+ let node = document.querySelector("div");
+ node.focus();
+ let htmlEditor =
+ SpecialPowers.wrap(window).docShell.editingSession.getEditorForWindow(window);
+
+ // Supported environments for each command. Supported values for each
+ // environment property:
+ // content: "empty", "non-empty", "cleared"
+ // selected: true, false
+ // readonly: true, false
+ //
+ // If an environment definition does not state a certain property, the command
+ // supports all possible values for that property. The following definition:
+ // "cmd_copy": [{content: "non-empty", selected: true}],
+ // is equivalent to:
+ // "cmd_copy": [
+ // {content: "non-empty", selected: true, readonly: true},
+ // {content: "non-empty", selected: true, readonly: false},
+ // ],
+ const TEST_COMMANDS = {
+ "cmd_selectAll": [{content: "non-empty"}],
+
+ "cmd_copy": [{content: "non-empty", selected: true}],
+
+ "cmd_cut": [{content: "non-empty", selected: true, readonly: false}],
+ "cmd_delete": [{content: "non-empty", selected: true, readonly: false}],
+ "cmd_removeList":[{content: "non-empty", selected: true, readonly: false}],
+
+ "cmd_undo": [{content: "cleared", readonly: false}],
+ "cmd_redo": [{content: "cleared", readonly: false}],
+
+ "cmd_switchTextDirection": [{readonly: false}],
+ "cmd_bold": [{readonly: false}],
+ "cmd_italic": [{readonly: false}],
+ "cmd_underline": [{readonly: false}],
+ "cmd_em": [{readonly: false}],
+ "cmd_strong": [{readonly: false}],
+ "cmd_strikethrough": [{readonly: false}],
+ "cmd_superscript": [{readonly: false}],
+ "cmd_subscript": [{readonly: false}],
+ "cmd_indent": [{readonly: false}],
+ "cmd_outdent": [{readonly: false}],
+ "cmd_formatBlock": [{readonly: false}],
+ "cmd_paragraphState": [{readonly: false}],
+ "cmd_fontFace": [{readonly: false}],
+ "cmd_fontSize": [{readonly: false}],
+ "cmd_fontColor": [{readonly: false}],
+ "cmd_backgroundColor": [{readonly: false}],
+ "cmd_highlight": [{readonly: false}],
+ "cmd_align": [{readonly: false}],
+ "cmd_removeStyles": [{readonly: false}],
+ "cmd_increaseFont": [{readonly: false}],
+ "cmd_decreaseFont": [{readonly: false}],
+ "cmd_insertHR": [{readonly: false}],
+ "cmd_insertHTML": [{readonly: false}],
+ "cmd_insertText": [{readonly: false}],
+ "cmd_insertParagraph": [{readonly: false}],
+ "cmd_insertLineBreak": [{readonly: false}],
+ "cmd_tt":[{readonly: false}],
+ "cmd_nobreak":[{readonly: false}],
+ "cmd_cite":[{readonly: false}],
+ "cmd_abbr":[{readonly: false}],
+ "cmd_acronym":[{readonly: false}],
+ "cmd_code":[{readonly: false}],
+ "cmd_samp":[{readonly: false}],
+ "cmd_var":[{readonly: false}],
+ "cmd_removeLinks":[{readonly: false}],
+ "cmd_ol":[{readonly: false}],
+ "cmd_ul":[{readonly: false}],
+ "cmd_dt":[{readonly: false}],
+ "cmd_dd":[{readonly: false}],
+
+ // InsertTagCommand
+ "cmd_insertImageNoUI": [{readonly: false}],
+ "cmd_insertLinkNoUI": [{readonly: false}],
+ };
+
+ function testCommands(content) {
+ for (let readonly of [true, false]){
+ if (readonly) {
+ htmlEditor.flags |= SpecialPowers.Ci.nsIEditor.eEditorReadonlyMask;
+ } else {
+ htmlEditor.flags &= ~SpecialPowers.Ci.nsIEditor.eEditorReadonlyMask;
+ }
+
+ for (let selected of [true, false]) {
+ let selection = window.getSelection();
+ selection.collapse(node);
+
+ if (selected) {
+ if (content == "non-empty") {
+ // The command cmd_removeList needs selected text inside a list. It
+ // does not matter for all other commands, so lets just select that.
+ let range = document.createRange();
+ let li = document.querySelector("li");
+ range.selectNodeContents(li);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ } else {
+ document.execCommand("selectAll");
+ }
+ }
+
+ for (let [cmd, supports] of Object.entries(TEST_COMMANDS)) {
+ // Check if the command should support this environment.
+ let expected = supports.some(supported =>
+ content == (supported?.content ?? content) &&
+ readonly == (supported?.readonly ?? readonly) &&
+ selected == (supported?.selected ?? selected)
+ )
+ is(
+ SpecialPowers.isCommandEnabled(window, cmd),
+ expected,
+ `Enabled state of command ${cmd} should be ${
+ expected ? "TRUE" : "FALSE"
+ } for ${JSON.stringify({content, selected, readonly})}`
+ );
+ }
+ }
+ }
+ }
+
+ testCommands("empty");
+
+ // The cmd_removeList command needs a list.
+ node.innerHTML = "<ul><li><span>abcd</span></li></ul>";
+ testCommands("non-empty");
+
+ // Make some content modifications to enable undo and redo.
+ node.innerText = "ABC";
+ is(node.innerText.trim(), "ABC", "phase 1");
+ document.execCommand("selectAll");
+ synthesizeKey("KEY_Backspace");
+ is(node.innerText.trim(), "", "phase 2");
+ synthesizeKey("3");
+ is(node.innerText.trim(), "3", "phase 3");
+ SpecialPowers.doCommand(window, "cmd_undo");
+ is(node.innerText.trim(), "", "phase 4");
+
+ node.innerHTML = "";
+ testCommands("cleared");
+</script>
diff --git a/editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html b/editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html
index d6bb703231..0990d87adb 100644
--- a/editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html
+++ b/editor/libeditor/tests/test_composition_with_highlight_in_texteditor.html
@@ -23,9 +23,9 @@ SimpleTest.waitForFocus(() => {
);
const editActionListener = {
QueryInterface: SpecialPowers.ChromeUtils.generateQI(["nsIEditActionListener"]),
- WillDeleteText: (textNode, offset, length) => {},
- DidInsertText: (textNode, offset, aString) => {},
- WillDeleteRanges: (rangesToDelete) => {},
+ WillDeleteText: () => {},
+ DidInsertText: () => {},
+ WillDeleteRanges: () => {},
};
// Highlight "a"
findSelection.setBaseAndExtent(
diff --git a/editor/libeditor/tests/test_contenteditable_text_input_handling.html b/editor/libeditor/tests/test_contenteditable_text_input_handling.html
index c00056a0f0..13a00a65b8 100644
--- a/editor/libeditor/tests/test_contenteditable_text_input_handling.html
+++ b/editor/libeditor/tests/test_contenteditable_text_input_handling.html
@@ -34,8 +34,7 @@ function runTests() {
aEvent.preventDefault(); // prevent the browser default behavior
},
};
- var els = Services.els;
- els.addSystemEventListener(window, "keypress", listener, false);
+ SpecialPowers.wrap(window).addEventListener("keypress", listener, { mozSystemGroup: true });
var staticContent = document.getElementById("static");
staticContent._defaultValue = getTextValue(staticContent);
@@ -306,7 +305,7 @@ function runTests() {
testTextInput(inputInEditor);
testTextInput(textareaInEditor);
- els.removeSystemEventListener(window, "keypress", listener, false);
+ SpecialPowers.wrap(window).removeEventListener("keypress", listener, { mozSystemGroup: true });
SimpleTest.finish();
}
diff --git a/editor/libeditor/tests/test_dragdrop.html b/editor/libeditor/tests/test_dragdrop.html
index 6295661faa..5c7d940928 100644
--- a/editor/libeditor/tests/test_dragdrop.html
+++ b/editor/libeditor/tests/test_dragdrop.html
@@ -3101,7 +3101,7 @@ async function doTest() {
beforeinputEvents = [];
inputEvents = [];
dragEvents = [];
- const onDragStart = aEvent => {
+ const onDragStart = () => {
input.style.display = "none";
document.documentElement.scrollTop;
input.style.display = "";
@@ -3147,7 +3147,7 @@ async function doTest() {
beforeinputEvents = [];
inputEvents = [];
dragEvents = [];
- const onDragStart = aEvent => {
+ const onDragStart = () => {
textarea.style.display = "none";
document.documentElement.scrollTop;
textarea.style.display = "";
@@ -3193,13 +3193,13 @@ async function doTest() {
beforeinputEvents = [];
inputEvents = [];
dragEvents = [];
- const onMouseMove = aEvent => {
+ const onMouseMove = () => {
input.style.display = "none";
document.documentElement.scrollTop;
input.style.display = "";
document.documentElement.scrollTop;
};
- const onMouseDown = aEvent => {
+ const onMouseDown = () => {
document.addEventListener("mousemove", onMouseMove, {once: true});
}
const onDrop = aEvent => {
@@ -3243,13 +3243,13 @@ async function doTest() {
beforeinputEvents = [];
inputEvents = [];
dragEvents = [];
- const onMouseMove = aEvent => {
+ const onMouseMove = () => {
textarea.style.display = "none";
document.documentElement.scrollTop;
textarea.style.display = "";
document.documentElement.scrollTop;
};
- const onMouseDown = aEvent => {
+ const onMouseDown = () => {
document.addEventListener("mousemove", onMouseMove, {once: true});
}
const onDrop = aEvent => {
diff --git a/editor/libeditor/tests/test_execCommandPaste_noTarget.html b/editor/libeditor/tests/test_execCommandPaste_noTarget.html
index 6586ca768d..70de112a78 100644
--- a/editor/libeditor/tests/test_execCommandPaste_noTarget.html
+++ b/editor/libeditor/tests/test_execCommandPaste_noTarget.html
@@ -32,7 +32,7 @@
// Check that reading text from the clipboard in non-privileged contexts
// still doesn't work.
- function onpstfail(e) {
+ function onpstfail() {
ok(false, "Should not see paste event triggered by non-privileged call");
}
document.addEventListener("paste", onpstfail);
diff --git a/editor/libeditor/tests/test_htmleditor_keyevent_handling.html b/editor/libeditor/tests/test_htmleditor_keyevent_handling.html
index 58666beb35..6fb79212e2 100644
--- a/editor/libeditor/tests/test_htmleditor_keyevent_handling.html
+++ b/editor/libeditor/tests/test_htmleditor_keyevent_handling.html
@@ -79,8 +79,8 @@ async function runTests() {
getDesciption(aPreventedOnBubbling) + "prevented on bubbling phase");
}
- SpecialPowers.addSystemEventListener(window, "keypress", listener, true);
- SpecialPowers.addSystemEventListener(window, "keypress", listener, false);
+ SpecialPowers.wrap(window).addEventListener("keypress", listener, { capture: true, mozSystemGroup: true });
+ SpecialPowers.wrap(window).addEventListener("keypress", listener, { capture: false, mozSystemGroup: true });
// eslint-disable-next-line complexity
async function doTest(
@@ -754,8 +754,8 @@ async function runTests() {
await doTest(htmlEditor, "readonly and non-tabbable HTML editor but plaintext mode",
true, false, true);
- SpecialPowers.removeSystemEventListener(window, "keypress", listener, true);
- SpecialPowers.removeSystemEventListener(window, "keypress", listener, false);
+ SpecialPowers.wrap(window).removeEventListener("keypress", listener, { capture: true, mozSystemGroup: true });
+ SpecialPowers.wrap(window).removeEventListener("keypress", listener, { capture: false, mozSystemGroup: true });
SimpleTest.finish();
}
diff --git a/editor/libeditor/tests/test_middle_click_paste.html b/editor/libeditor/tests/test_middle_click_paste.html
index eaa918c194..d34411e54b 100644
--- a/editor/libeditor/tests/test_middle_click_paste.html
+++ b/editor/libeditor/tests/test_middle_click_paste.html
@@ -224,7 +224,7 @@ async function doTextareaTests(aTextarea) {
aTextarea.value = "";
let pasteEventCount = 0;
- function pasteEventLogger(event) {
+ function pasteEventLogger() {
pasteEventCount++;
}
aTextarea.addEventListener("paste", pasteEventLogger);
@@ -381,7 +381,7 @@ async function doContenteditableTests(aEditableDiv) {
aEditableDiv.innerHTML = "";
let pasteEventCount = 0;
- function pasteEventLogger(event) {
+ function pasteEventLogger() {
pasteEventCount++;
}
aEditableDiv.addEventListener("paste", pasteEventLogger);
diff --git a/editor/libeditor/tests/test_nsIEditor_documentIsEmpty.html b/editor/libeditor/tests/test_nsIEditor_documentIsEmpty.html
index 49c1db78a9..1e60e58191 100644
--- a/editor/libeditor/tests/test_nsIEditor_documentIsEmpty.html
+++ b/editor/libeditor/tests/test_nsIEditor_documentIsEmpty.html
@@ -80,7 +80,7 @@
ok(true, "nsIEditor.documentIsEmpty should throw an exception when no editing host has focus");
}
document.querySelector("div[contenteditable]").focus();
- todo_is(getHTMLEditor().documentIsEmpty, true,
+ is(getHTMLEditor().documentIsEmpty, true,
"nsIEditor.documentIsEmpty should be true when editing host does not have contents");
document.body.innerHTML = "<div contenteditable><br></div>";
diff --git a/editor/libeditor/tests/test_paste_redirect_focus_in_paste_event_listener.html b/editor/libeditor/tests/test_paste_redirect_focus_in_paste_event_listener.html
index b82938158e..89d7531fa5 100644
--- a/editor/libeditor/tests/test_paste_redirect_focus_in_paste_event_listener.html
+++ b/editor/libeditor/tests/test_paste_redirect_focus_in_paste_event_listener.html
@@ -57,7 +57,7 @@ SimpleTest.waitForFocus(async () => {
const editableElementDesc = `<${
editableElement.tagName.toLocaleLowerCase()
}${editableElement.hasAttribute("contenteditable") ? " contenteditable" : ""}>`;
- (test_from_editableElement_to_input => {
+ (() => {
const input = document.querySelector("#dest > input");
editableElement.focus();
editableElement.addEventListener(
@@ -84,7 +84,7 @@ SimpleTest.waitForFocus(async () => {
input.value = "";
})();
- (test_from_editableElement_to_contenteditable => {
+ (() => {
const contentEditable = document.querySelector("#dest > div[contenteditable]");
editableElement.focus();
editableElement.addEventListener(
@@ -111,7 +111,7 @@ SimpleTest.waitForFocus(async () => {
contentEditable.innerHTML = "<br>";
})();
- (test_from_editableElement_to_non_editable => {
+ (() => {
const button = document.querySelector("#dest > button");
editableElement.focus();
editableElement.addEventListener(
diff --git a/editor/libeditor/tests/test_texteditor_keyevent_handling.html b/editor/libeditor/tests/test_texteditor_keyevent_handling.html
index 2c80181b3c..6b3d5f4608 100644
--- a/editor/libeditor/tests/test_texteditor_keyevent_handling.html
+++ b/editor/libeditor/tests/test_texteditor_keyevent_handling.html
@@ -80,10 +80,8 @@ async function runTests() {
}
var parentElement = document.getElementById("display");
- SpecialPowers.addSystemEventListener(parentElement, "keypress", listener,
- true);
- SpecialPowers.addSystemEventListener(parentElement, "keypress", listener,
- false);
+ SpecialPowers.wrap(parentElement).addEventListener("keypress", listener, { capture: true, mozSystemGroup: true });
+ SpecialPowers.wrap(parentElement).addEventListener("keypress", listener, { capture: false, mozSystemGroup: true });
async function doTest(aElement, aDescription, aIsSingleLine, aIsReadonly) {
function reset(aText) {
@@ -457,10 +455,8 @@ async function runTests() {
textarea.setAttribute("readonly", "readonly");
await doTest(textarea, "<textarea readonly>", false, true);
- SpecialPowers.removeSystemEventListener(parentElement, "keypress", listener,
- true);
- SpecialPowers.removeSystemEventListener(parentElement, "keypress", listener,
- false);
+ SpecialPowers.wrap(parentElement).removeEventListener("keypress", listener, { capture: true, mozSystemGroup: true });
+ SpecialPowers.wrap(parentElement).removeEventListener("keypress", listener, { capture: false, mozSystemGroup: true });
SimpleTest.finish();
}
diff --git a/editor/libeditor/tests/test_texteditor_wrapping_long_line.html b/editor/libeditor/tests/test_texteditor_wrapping_long_line.html
index 14a445bbb0..013e563a27 100644
--- a/editor/libeditor/tests/test_texteditor_wrapping_long_line.html
+++ b/editor/libeditor/tests/test_texteditor_wrapping_long_line.html
@@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1733878
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script>
/** Test for bug 1733878 **/
- window.addEventListener("DOMContentLoaded", (event) => {
+ window.addEventListener("DOMContentLoaded", () => {
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
document.body.textContent = ""; // It would be \n\n otherwise...