diff --git a/editor/libeditor/tests/test_bug569988.html b/editor/libeditor/tests/test_bug569988.html index 6133d383c9c1..618166837463 100644 --- a/editor/libeditor/tests/test_bug569988.html +++ b/editor/libeditor/tests/test_bug569988.html @@ -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_bug674770-1.html b/editor/libeditor/tests/test_bug674770-1.html index 0b6089e0ef1c..d8e792ccd2db 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_contenteditable_text_input_handling.html b/editor/libeditor/tests/test_contenteditable_text_input_handling.html index c00056a0f0c7..13a00a65b8b1 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_htmleditor_keyevent_handling.html b/editor/libeditor/tests/test_htmleditor_keyevent_handling.html index 58666beb3512..6fb79212e2ed 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_texteditor_keyevent_handling.html b/editor/libeditor/tests/test_texteditor_keyevent_handling.html index 2c80181b3c70..6b3d5f460827 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, "