diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /toolkit/content/tests | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/content/tests')
65 files changed, 416 insertions, 214 deletions
diff --git a/toolkit/content/tests/browser/browser_about_logging.js b/toolkit/content/tests/browser/browser_about_logging.js index fdf8eab57b..d9a2459c12 100644 --- a/toolkit/content/tests/browser/browser_about_logging.js +++ b/toolkit/content/tests/browser/browser_about_logging.js @@ -201,7 +201,7 @@ add_task(async function testURLParameters() { url: PAGE + "?invalid-param", }, async browser => { - await SpecialPowers.spawn(browser, [profilerPresetInURL], async inURL => { + await SpecialPowers.spawn(browser, [profilerPresetInURL], async () => { let $ = content.document.querySelector.bind(content.document); Assert.ok( !$("#error").hidden, @@ -368,7 +368,7 @@ add_task(async function testProfilerOpens() { "https://example.com/", false ); - SpecialPowers.spawn(browser, [], async savedLogModules => { + SpecialPowers.spawn(browser, [], async () => { let $ = content.document.querySelector.bind(content.document); // Override the URL the profiler uses to avoid hitting external // resources (and crash). diff --git a/toolkit/content/tests/browser/browser_bug982298.js b/toolkit/content/tests/browser/browser_bug982298.js index ffbc916a5e..9b6f636db3 100644 --- a/toolkit/content/tests/browser/browser_bug982298.js +++ b/toolkit/content/tests/browser/browser_bug982298.js @@ -50,7 +50,7 @@ add_task(async function () { let awaitFindResult2 = new Promise(resolve => { let listener = { - onFindResult(aData) { + onFindResult() { info("got find result #2"); browser.finder.removeResultListener(listener); resolve(); diff --git a/toolkit/content/tests/browser/browser_f7_caret_browsing.js b/toolkit/content/tests/browser/browser_f7_caret_browsing.js index be6ae7d1f7..c0413c459b 100644 --- a/toolkit/content/tests/browser/browser_f7_caret_browsing.js +++ b/toolkit/content/tests/browser/browser_f7_caret_browsing.js @@ -37,7 +37,7 @@ registerCleanupFunction(function () { let gCaretPromptOpeningObserver; function promiseCaretPromptOpened() { return new Promise(resolve => { - function observer(subject, topic, data) { + function observer(subject) { info("Dialog opened."); resolve(subject); gCaretPromptOpeningObserver(); diff --git a/toolkit/content/tests/browser/browser_isSynthetic.js b/toolkit/content/tests/browser/browser_isSynthetic.js index 21b22fe171..3473dfc915 100644 --- a/toolkit/content/tests/browser/browser_isSynthetic.js +++ b/toolkit/content/tests/browser/browser_isSynthetic.js @@ -11,7 +11,7 @@ LocationChangeListener.prototype = { this.browser.removeProgressListener(this); }, - onLocationChange(webProgress, request, location, flags) { + onLocationChange() { this.wasSynthetic = this.browser.isSyntheticDocument; }, diff --git a/toolkit/content/tests/browser/browser_media_wakelock_webaudio.js b/toolkit/content/tests/browser/browser_media_wakelock_webaudio.js index 7c40b5fe1a..9e18cc89f3 100644 --- a/toolkit/content/tests/browser/browser_media_wakelock_webaudio.js +++ b/toolkit/content/tests/browser/browser_media_wakelock_webaudio.js @@ -56,7 +56,6 @@ async function checkWakelockWhenChangeTabVisibility({ description, additionalParams, needLock, - elementIdForEnteringPIPMode, }) { const originalTab = gBrowser.selectedTab; info(`start a new tab for '${description}'`); diff --git a/toolkit/content/tests/browser/browser_save_folder_standalone_image.js b/toolkit/content/tests/browser/browser_save_folder_standalone_image.js index 073e71a88b..6bcc95ae65 100644 --- a/toolkit/content/tests/browser/browser_save_folder_standalone_image.js +++ b/toolkit/content/tests/browser/browser_save_folder_standalone_image.js @@ -49,7 +49,7 @@ add_task(async function () { const IMAGE_URL = "http://mochi.test:8888/browser/toolkit/content/tests/browser/doggy.png"; - await BrowserTestUtils.withNewTab(IMAGE_URL, async function (browser) { + await BrowserTestUtils.withNewTab(IMAGE_URL, async function () { let tmpDir = FileUtils.getDir("TmpD", []); let dir = newDirectory(); let downloadLastDir = new DownloadLastDir(null); diff --git a/toolkit/content/tests/browser/browser_save_resend_postdata.js b/toolkit/content/tests/browser/browser_save_resend_postdata.js index 3f3e729dab..b028cac4ae 100644 --- a/toolkit/content/tests/browser/browser_save_resend_postdata.js +++ b/toolkit/content/tests/browser/browser_save_resend_postdata.js @@ -59,7 +59,7 @@ function test() { var file = destDir.clone(); file.append("no_default_file_name"); MockFilePicker.setFiles([file]); - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { MockFilePicker.filterIndex = 1; // kSaveAsType_URL }; diff --git a/toolkit/content/tests/browser/common/mockTransfer.js b/toolkit/content/tests/browser/common/mockTransfer.js index f4afa44903..0240d9c14b 100644 --- a/toolkit/content/tests/browser/common/mockTransfer.js +++ b/toolkit/content/tests/browser/common/mockTransfer.js @@ -51,8 +51,7 @@ MockTransfer.prototype = { onStatusChange: function MTFC_onStatusChange( aWebProgress, aRequest, - aStatus, - aMessage + aStatus ) { // If at least one notification reported an error, the download failed. if (!Components.isSuccessCode(aStatus)) { diff --git a/toolkit/content/tests/browser/datetime/head.js b/toolkit/content/tests/browser/datetime/head.js index 46e2c78af5..532f7743b2 100644 --- a/toolkit/content/tests/browser/datetime/head.js +++ b/toolkit/content/tests/browser/datetime/head.js @@ -69,7 +69,7 @@ class DateTimeTestHelper { [selector], async selector => { let input = content.document.querySelector(selector); - await ContentTaskUtils.waitForEvent(input, "change", false, e => { + await ContentTaskUtils.waitForEvent(input, "change", false, () => { ok( content.window.windowUtils.isHandlingUserInput, "isHandlingUserInput should be true" diff --git a/toolkit/content/tests/browser/head.js b/toolkit/content/tests/browser/head.js index be15cd9684..03a239463d 100644 --- a/toolkit/content/tests/browser/head.js +++ b/toolkit/content/tests/browser/head.js @@ -177,7 +177,7 @@ function leave_icon(icon) { * Used to listen events if you just need it once */ function once(target, name) { - var p = new Promise(function (resolve, reject) { + var p = new Promise(function (resolve) { target.addEventListener( name, function () { diff --git a/toolkit/content/tests/chrome/bug263683_window.xhtml b/toolkit/content/tests/chrome/bug263683_window.xhtml index b124361fd7..74846e3c27 100644 --- a/toolkit/content/tests/chrome/bug263683_window.xhtml +++ b/toolkit/content/tests/chrome/bug263683_window.xhtml @@ -176,7 +176,7 @@ const matches = JSON.parse(gFindBar._foundMatches.dataset.l10nArgs); is(matches.total, 2, "Found correct amount of matches") - await SpecialPowers.spawn(gBrowser, [], async function(args) { + await SpecialPowers.spawn(gBrowser, [], async function() { function getSelection(docShell) { let controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsISelectionDisplay) diff --git a/toolkit/content/tests/chrome/bug366992_window.xhtml b/toolkit/content/tests/chrome/bug366992_window.xhtml index 698d26b43a..ee595706f5 100644 --- a/toolkit/content/tests/chrome/bug366992_window.xhtml +++ b/toolkit/content/tests/chrome/bug366992_window.xhtml @@ -46,7 +46,7 @@ isCommandEnabled(aCommand) { return aCommand == "cmd_delete"; }, - doCommand(aCommand) { } + doCommand() { } } function ok(condition, message) { diff --git a/toolkit/content/tests/chrome/chrome.toml b/toolkit/content/tests/chrome/chrome.toml index 3391a2923d..986822ac48 100644 --- a/toolkit/content/tests/chrome/chrome.toml +++ b/toolkit/content/tests/chrome/chrome.toml @@ -226,6 +226,8 @@ support-files = [ ["test_menulist_initial_selection.xhtml"] +["test_menulist_initial_selection_with_connected_callback.xhtml"] + ["test_menulist_keynav.xhtml"] ["test_menulist_null_value.xhtml"] diff --git a/toolkit/content/tests/chrome/file_editor_with_autocomplete.js b/toolkit/content/tests/chrome/file_editor_with_autocomplete.js index 78611efc70..acf2c9e9df 100644 --- a/toolkit/content/tests/chrome/file_editor_with_autocomplete.js +++ b/toolkit/content/tests/chrome/file_editor_with_autocomplete.js @@ -195,7 +195,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case: type 'Mo'", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("M", { shiftKey: true }, aWindow); synthesizeKey("o", {}, aWindow); return true; @@ -212,7 +212,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case: select 'Mozilla' to complete the word", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("KEY_ArrowDown", {}, aWindow); synthesizeKey("KEY_Enter", {}, aWindow); return true; @@ -226,7 +226,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case: undo the word, but typed text shouldn't be canceled", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -239,7 +239,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case: undo the typed text", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -252,7 +252,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case: redo the typed text", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -265,7 +265,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case: redo the word", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -278,7 +278,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case: removing all text for next test...", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("a", { accelKey: true }, aWindow); synthesizeKey("KEY_Backspace", {}, aWindow); return true; @@ -293,7 +293,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case: type 'mo'", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("m", {}, aWindow); synthesizeKey("o", {}, aWindow); return true; @@ -310,7 +310,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case: select 'Mozilla' to complete the word", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("KEY_ArrowDown", {}, aWindow); synthesizeKey("KEY_Enter", {}, aWindow); return true; @@ -324,7 +324,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case: undo the word, but typed text shouldn't be canceled", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -337,7 +337,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case: undo the typed text", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -350,7 +350,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case: redo the typed text", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -363,7 +363,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case: redo the word", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -376,7 +376,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case: removing all text for next test...", completeDefaultIndex: false, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("a", { accelKey: true }, aWindow); synthesizeKey("KEY_Backspace", {}, aWindow); return true; @@ -392,7 +392,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case (completeDefaultIndex is true): type 'Mo'", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("M", { shiftKey: true }, aWindow); synthesizeKey("o", {}, aWindow); return true; @@ -410,7 +410,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case (completeDefaultIndex is true): select 'Mozilla' to complete the word", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("KEY_ArrowDown", {}, aWindow); synthesizeKey("KEY_Enter", {}, aWindow); return true; @@ -424,7 +424,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case (completeDefaultIndex is true): undo the word, but typed text shouldn't be canceled", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -437,7 +437,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case (completeDefaultIndex is true): undo the typed text", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -450,7 +450,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case (completeDefaultIndex is true): redo the typed text", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -466,7 +466,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case (completeDefaultIndex is true): redo the word", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -479,7 +479,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text exactly matches the case (completeDefaultIndex is true): removing all text for next test...", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("a", { accelKey: true }, aWindow); synthesizeKey("KEY_Backspace", {}, aWindow); return true; @@ -494,7 +494,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): type 'mo'", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("m", {}, aWindow); synthesizeKey("o", {}, aWindow); return true; @@ -512,7 +512,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): select 'Mozilla' to complete the word", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("KEY_ArrowDown", {}, aWindow); synthesizeKey("KEY_Enter", {}, aWindow); return true; @@ -528,7 +528,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): undo the selected word, but typed text shouldn't be canceled", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -541,7 +541,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): undo the word, but typed text shouldn't be canceled", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -554,7 +554,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): undo the typed text", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("z", { accelKey: true }, aWindow); return true; }, @@ -571,7 +571,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): redo the typed text", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -587,7 +587,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): redo the default index word", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -600,7 +600,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): redo the word", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("Z", { accelKey: true, shiftKey: true }, aWindow); return true; }, @@ -613,7 +613,7 @@ nsDoTestsForEditorWithAutoComplete.prototype = { description: "Undo/Redo behavior check when typed text does not match the case (completeDefaultIndex is true): removing all text for next test...", completeDefaultIndex: true, - execute(aWindow, aTarget) { + execute(aWindow) { synthesizeKey("a", { accelKey: true }, aWindow); synthesizeKey("KEY_Backspace", {}, aWindow); return true; diff --git a/toolkit/content/tests/chrome/popup_trigger.js b/toolkit/content/tests/chrome/popup_trigger.js index 003af044e5..71846a01ea 100644 --- a/toolkit/content/tests/chrome/popup_trigger.js +++ b/toolkit/content/tests/chrome/popup_trigger.js @@ -238,7 +238,7 @@ var popupTests = [ // rollup this way. // synthesizeMouse(gTrigger, 0, -12, { }); }, - result(testname, step) { + result(testname) { is(gMenuPopup.anchorNode, null, testname + " anchorNode"); is(gMenuPopup.triggerNode, null, testname + " triggerNode"); checkClosed("trigger", testname); @@ -532,7 +532,7 @@ var popupTests = [ // event to openPopup to check the trigger node. testname: "open popup anchored with override", events: ["popupshowing thepopup 0010", "popupshown thepopup"], - test(testname, step) { + test() { // attribute overrides the position passed in gMenuPopup.setAttribute("position", "end_after"); gExpectedTriggerNode = gCachedEvent.target; @@ -546,7 +546,7 @@ var popupTests = [ gCachedEvent ); }, - result(testname, step) { + result(testname) { gExpectedTriggerNode = null; is(gMenuPopup.anchorNode, gTrigger, testname + " anchorNode"); is( @@ -564,7 +564,7 @@ var popupTests = [ "popuphidden thepopup", "DOMMenuInactive thepopup", ], - test(testname, step) { + test(testname) { synthesizeKey("KEY_Escape"); checkClosed("trigger", testname); }, @@ -574,12 +574,12 @@ var popupTests = [ testname: "open popup anchored with offsets", events: ["popupshowing thepopup", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test() { // attribute is empty so does not override gMenuPopup.setAttribute("position", ""); gMenuPopup.openPopup(gTrigger, "before_start", 5, 10, true, true); }, - result(testname, step) { + result(testname) { compareEdge(gTrigger, gMenuPopup, "before_start", 5, 10, testname); }, }, @@ -588,10 +588,10 @@ var popupTests = [ // to the viewport. testname: "open popup unanchored", events: ["popupshowing thepopup", "popupshown thepopup"], - test(testname, step) { + test() { gMenuPopup.openPopup(null, "after_start", 6, 8, false); }, - result(testname, step) { + result(testname) { var rect = gMenuPopup.getBoundingClientRect(); ok( rect.left == 6 && rect.top == 8 && rect.right && rect.bottom, @@ -607,11 +607,11 @@ var popupTests = [ "popuphiding thepopup", "popuphidden thepopup", ], - test(testname, step) { + test() { var item3 = document.getElementById("item3"); synthesizeMouse(item3, 4, 4, {}); }, - result(testname, step) { + result(testname) { checkClosed("trigger", testname); }, }, @@ -625,18 +625,18 @@ var popupTests = [ "popuphidden thepopup", "DOMMenuInactive thepopup", ], - test(testname, step) { + test() { gMenuPopup.hidePopup(); }, }, { testname: "open popup at screen", events: ["popupshowing thepopup", "popupshown thepopup"], - test(testname, step) { + test() { gExpectedTriggerNode = "notset"; gMenuPopup.openPopupAtScreen(gScreenX + 24, gScreenY + 20, false); }, - result(testname, step) { + result(testname) { gExpectedTriggerNode = null; is(gMenuPopup.anchorNode, null, testname + " anchorNode"); is(gMenuPopup.triggerNode, null, testname + " triggerNode"); @@ -670,7 +670,7 @@ var popupTests = [ { testname: "open context popup at screen", events: ["popupshowing thepopup 0010", "popupshown thepopup"], - test(testname, step) { + test() { gExpectedTriggerNode = gCachedEvent.target; gMenuPopup.openPopupAtScreen( gScreenX + 8, @@ -679,7 +679,7 @@ var popupTests = [ gCachedEvent ); }, - result(testname, step) { + result(testname) { gExpectedTriggerNode = null; is(gMenuPopup.anchorNode, null, testname + " anchorNode"); is( @@ -873,7 +873,7 @@ var popupTests = [ testname: "open context popup at screen with all modifiers set", events: ["popupshowing thepopup 1111", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test() { gMenuPopup.openPopupAtScreen( gScreenX + 8, gScreenY + 16, @@ -885,10 +885,10 @@ var popupTests = [ { testname: "open popup with open property", events: ["popupshowing thepopup", "popupshown thepopup"], - test(testname, step) { + test() { openMenu(gTrigger); }, - result(testname, step) { + result(testname) { checkOpen("trigger", testname); if (gIsMenu) { compareEdge(gTrigger, gMenuPopup, "after_start", 0, 0, testname); @@ -902,10 +902,10 @@ var popupTests = [ "DOMMenuItemActive submenu", "popupshown submenupopup", ], - test(testname, step) { + test() { openMenu(document.getElementById("submenu")); }, - result(testname, step) { + result(testname) { checkOpen("trigger", testname); checkOpen("submenu", testname); // XXXndeakin @@ -929,17 +929,17 @@ var popupTests = [ test() { gMenuPopup.hidePopup(); }, - result(testname, step) { + result(testname) { checkClosed("trigger", testname); checkClosed("submenu", testname); }, }, { testname: "open submenu with open property without parent open", - test(testname, step) { + test() { openMenu(document.getElementById("submenu")); }, - result(testname, step) { + result(testname) { checkClosed("trigger", testname); checkClosed("submenu", testname); }, @@ -950,11 +950,11 @@ var popupTests = [ return gIsMenu; }, events: ["popupshowing thepopup", "popupshown thepopup"], - test(testname, step) { + test() { gMenuPopup.setAttribute("position", "before_start"); openMenu(gTrigger); }, - result(testname, step) { + result(testname) { compareEdge(gTrigger, gMenuPopup, "before_start", 0, 0, testname); }, }, @@ -968,10 +968,10 @@ var popupTests = [ "popuphidden thepopup", "DOMMenuInactive thepopup", ], - test(testname, step) { + test() { closeMenu(gTrigger, gMenuPopup); }, - result(testname, step) { + result(testname) { checkClosed("trigger", testname); }, }, @@ -982,13 +982,13 @@ var popupTests = [ }, events: ["popupshowing thepopup", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test() { gMenuPopup.setAttribute("position", "start_after"); gMenuPopup.setAttribute("popupanchor", "topright"); gMenuPopup.setAttribute("popupalign", "bottomright"); openMenu(gTrigger); }, - result(testname, step) { + result(testname) { compareEdge(gTrigger, gMenuPopup, "start_after", 0, 0, testname); }, }, @@ -999,13 +999,13 @@ var popupTests = [ }, events: ["popupshowing thepopup", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test() { gMenuPopup.removeAttribute("position"); gMenuPopup.setAttribute("popupanchor", "bottomright"); gMenuPopup.setAttribute("popupalign", "topright"); openMenu(gTrigger); }, - result(testname, step) { + result(testname) { compareEdge(gTrigger, gMenuPopup, "after_end", 0, 0, testname); gMenuPopup.removeAttribute("popupanchor"); gMenuPopup.removeAttribute("popupalign"); @@ -1018,11 +1018,11 @@ var popupTests = [ }, events: ["popupshowing thepopup", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test() { gTrigger.focus(); synthesizeKey("KEY_ArrowDown", { altKey: !platformIsMac() }); }, - result(testname, step) { + result(testname) { checkOpen("trigger", testname); checkActive(gMenuPopup, "", testname); }, @@ -1033,11 +1033,11 @@ var popupTests = [ return gIsMenu; }, events: ["popupshowing thepopup", "popupshown thepopup"], - test(testname, step) { + test() { gTrigger.focus(); synthesizeKey("KEY_ArrowUp", { altKey: !platformIsMac() }); }, - result(testname, step) { + result(testname) { checkOpen("trigger", testname); checkActive(gMenuPopup, "", testname); }, @@ -1055,11 +1055,11 @@ var popupTests = [ "popuphiding thepopup", "popuphidden thepopup", ], - test(testname, step) { + test() { synthesizeKey("KEY_ArrowDown"); synthesizeKey("KEY_Enter"); }, - result(testname, step) { + result(testname) { checkClosed("trigger", testname); }, }, @@ -1070,11 +1070,11 @@ var popupTests = [ }, events: ["popupshowing thepopup", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test() { gTrigger.focus(); synthesizeKey(platformIsMac() ? " " : "KEY_F4"); }, - result(testname, step) { + result(testname) { checkOpen("trigger", testname); checkActive(gMenuPopup, "", testname); }, @@ -1085,7 +1085,7 @@ var popupTests = [ condition() { return gIsMenu; }, - test(testname, step) { + test() { gTrigger.focus(); if (platformIsMac()) { synthesizeKey("KEY_F4", { altKey: true }); @@ -1093,7 +1093,7 @@ var popupTests = [ synthesizeKey("", { metaKey: true }); } }, - result(testname, step) { + result(testname) { checkClosed("trigger", testname); }, }, @@ -1102,11 +1102,11 @@ var popupTests = [ condition() { return gIsMenu; }, - test(testname, step) { + test() { gTrigger.setAttribute("disabled", "true"); synthesizeMouse(gTrigger, 4, 4, {}); }, - result(testname, step) { + result(testname) { checkClosed("trigger", testname); gTrigger.removeAttribute("disabled"); }, @@ -1116,11 +1116,11 @@ var popupTests = [ testname: "openPopup with object argument", events: ["popupshowing thepopup 0000", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test(testname) { gMenuPopup.openPopup(gTrigger, { position: "before_start", x: 5, y: 7 }); checkOpen("trigger", testname); }, - result(testname, step) { + result(testname) { var triggerrect = gTrigger.getBoundingClientRect(); var popuprect = gMenuPopup.getBoundingClientRect(); is( @@ -1139,7 +1139,7 @@ var popupTests = [ testname: "openPopup with object argument with event", events: ["popupshowing thepopup 1000", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test(testname) { gMenuPopup.openPopup(gTrigger, { position: "after_start", x: 0, @@ -1153,10 +1153,10 @@ var popupTests = [ testname: "openPopup with no arguments", events: ["popupshowing thepopup", "popupshown thepopup"], autohide: "thepopup", - test(testname, step) { + test() { gMenuPopup.openPopup(); }, - result(testname, step) { + result(testname) { let isMenu = gTrigger.type == "menu"; // With no arguments, open in default menu position var triggerrect = gTrigger.getBoundingClientRect(); @@ -1184,7 +1184,7 @@ var popupTests = [ "DOMMenuItemActive submenu", "popupshown submenupopup", ], - test(testname, step) { + test(testname) { gMenuPopup.openPopup(gTrigger, "after_start", 0, 0, false, true); document .getElementById("submenupopup") @@ -1196,7 +1196,7 @@ var popupTests = [ { // remove the content nodes for the popup testname: "remove content", - test(testname, step) { + test() { var submenupopup = document.getElementById("submenupopup"); submenupopup.remove(); var popup = document.getElementById("thepopup"); diff --git a/toolkit/content/tests/chrome/test_arrowpanel.xhtml b/toolkit/content/tests/chrome/test_arrowpanel.xhtml index cd8d312e1d..f9f8a0eaf5 100644 --- a/toolkit/content/tests/chrome/test_arrowpanel.xhtml +++ b/toolkit/content/tests/chrome/test_arrowpanel.xhtml @@ -201,7 +201,7 @@ function* nextTest() // Test that a transition occurs when opening or closing the popup. if (matchMedia("(-moz-panel-animations").matches) { - function transitionEnded(event) { + function transitionEnded() { if ($("animatepanel").state != "open") { is($("animatepanel").state, "showing", "state is showing during transitionend"); ok(!animatedPopupShown, "popupshown not fired yet") diff --git a/toolkit/content/tests/chrome/test_labelcontrol.xhtml b/toolkit/content/tests/chrome/test_labelcontrol.xhtml index 06e7f96105..937d3e7403 100644 --- a/toolkit/content/tests/chrome/test_labelcontrol.xhtml +++ b/toolkit/content/tests/chrome/test_labelcontrol.xhtml @@ -40,7 +40,7 @@ function runTests() let checkboxLabel = $("checkbox-label"); is(checkboxLabel.control, "checkbox", "checkbox control"); is(checkboxLabel.labeledControlElement, checkbox, "checkbox labeledControlElement"); - is(checkbox.accessKey, "", "checkbox accessKey not set"); + is(checkbox.accessKey, null, "checkbox accessKey not set"); checkboxLabel.accessKey = "C"; is(checkbox.accessKey, "C", "checkbox accessKey set"); diff --git a/toolkit/content/tests/chrome/test_menuitem_blink.xhtml b/toolkit/content/tests/chrome/test_menuitem_blink.xhtml index 700a8a7465..ad76eee8bf 100644 --- a/toolkit/content/tests/chrome/test_menuitem_blink.xhtml +++ b/toolkit/content/tests/chrome/test_menuitem_blink.xhtml @@ -32,7 +32,7 @@ function test_crash() { var menupopup = document.getElementById("menupopup"); var menuitem = document.getElementById("menuitem"); menupopup.addEventListener("popupshown", function () { - menuitem.addEventListener("mouseup", function (e) { + menuitem.addEventListener("mouseup", function () { const observer = new MutationObserver((aMutationList, aObserver) => { for (const mutation of aMutationList) { if (mutation.attributeName != "_moz-menuactive") { diff --git a/toolkit/content/tests/chrome/test_menuitem_commands.xhtml b/toolkit/content/tests/chrome/test_menuitem_commands.xhtml index 60a35b36c5..a342b9d1d5 100644 --- a/toolkit/content/tests/chrome/test_menuitem_commands.xhtml +++ b/toolkit/content/tests/chrome/test_menuitem_commands.xhtml @@ -49,10 +49,10 @@ function runTestSet(suffix) var three = $("three" + suffix); var four = $("four" + suffix); - checkAttributes(one, "One", "", "", true, false); - checkAttributes(two, "", "", "false", false, false); + checkAttributes(one, "One", null, null, true, false); + checkAttributes(two, null, null, "false", false, false); checkAttributes(three, "Three", "T", "true", false, false); - checkAttributes(four, "Four", "F", "", false, false); + checkAttributes(four, "Four", "F", null, false, false); if (isMac && suffix) { var utils = window.windowUtils; @@ -62,8 +62,8 @@ function runTestSet(suffix) $("menu" + suffix).open = true; } - checkAttributes(one, "One", "", "", false, true); - checkAttributes(two, "Cat", "C", "", false, true); + checkAttributes(one, "One", null, null, false, true); + checkAttributes(two, "Cat", "C", null, false, true); checkAttributes(three, "Dog", "D", "false", true, true); checkAttributes(four, "Four", "F", "true", false, true); diff --git a/toolkit/content/tests/chrome/test_menulist_in_popup.xhtml b/toolkit/content/tests/chrome/test_menulist_in_popup.xhtml index 971fe90322..75fb19adcf 100644 --- a/toolkit/content/tests/chrome/test_menulist_in_popup.xhtml +++ b/toolkit/content/tests/chrome/test_menulist_in_popup.xhtml @@ -17,7 +17,7 @@ async function runTest() { let menulist = document.getElementById("menulist"); let menulistPopup = document.getElementById("menulistpopup"); - menulistPopup.addEventListener("popupshown", function(e) { + menulistPopup.addEventListener("popupshown", function() { ok(false, "Menulist popup shown"); }); diff --git a/toolkit/content/tests/chrome/test_menulist_initial_selection.xhtml b/toolkit/content/tests/chrome/test_menulist_initial_selection.xhtml index 19e9beae67..255318f5a7 100644 --- a/toolkit/content/tests/chrome/test_menulist_initial_selection.xhtml +++ b/toolkit/content/tests/chrome/test_menulist_initial_selection.xhtml @@ -29,6 +29,9 @@ async function runTest() { is(menulist2.value, "", "menulist2 should not be selected to the first item's value"); is(menulist2.label, "None", "menulist2 should not be selected to the first item's value"); + is(menulist1.menupopup.querySelectorAll('menuitem[selected="true"]').length, 1, "menulist1 should have only one selected item."); + is(menulist2.menupopup.querySelectorAll('menuitem[selected="true"]').length, 0, "menulist2 should have no selected items."); + SimpleTest.finish(); } @@ -37,17 +40,17 @@ async function runTest() { <panel> <menulist id="menulist1" value="" label="None"> - <menupopup id="menulistpopup"> + <menupopup id="menulistpopup1"> <menuitem value="1" label="One"/> <menuitem value="2" label="Two"/> <menuitem value="3" label="Three"/> </menupopup> </menulist> <menulist id="menulist2" value="" label="None" noinitialselection="true"> - <menupopup id="menulistpopup"> - <menuitem value="1" label="One"/> - <menuitem value="2" label="Two"/> - <menuitem value="3" label="Three"/> + <menupopup id="menulistpopup2"> + <menuitem value="4" label="Four"/> + <menuitem value="5" label="Five"/> + <menuitem value="6" label="Six"/> </menupopup> </menulist> </panel> diff --git a/toolkit/content/tests/chrome/test_menulist_initial_selection_with_connected_callback.xhtml b/toolkit/content/tests/chrome/test_menulist_initial_selection_with_connected_callback.xhtml new file mode 100644 index 0000000000..2c9b462948 --- /dev/null +++ b/toolkit/content/tests/chrome/test_menulist_initial_selection_with_connected_callback.xhtml @@ -0,0 +1,80 @@ +<window title="Menulist Initial Selection Connected Callback Test" + onload="setTimeout(runTest, 0)" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> +<script> +<![CDATA[ +SimpleTest.waitForExplicitFinish(); + +async function runTest() { + const panel = document.querySelector("panel"); + + // Dynamically initialize two menulists, one with the noinitialselection + // attribute and one without, but ensure that their delayConnectedCallback + // functions always return true to ensure that connectedCallback will not run yet. + const menulist1 = document.createXULElement("menulist"); + menulist1.delayConnectedCallback = () => true; + menulist1.setAttribute("id", "menulist1"); + menulist1.appendItem(/* label */ "One", /* id */ "1"); + menulist1.appendItem(/* label */ "Two", /* id */ "2"); + menulist1.appendItem(/* label */ "Three", /* id */ "3"); + is(menulist1.menupopup.querySelectorAll('menuitem[selected="true"]').length, 0, "menulist1 should have no selected items yet."); + + const menulist2 = document.createXULElement("menulist"); + menulist2.delayConnectedCallback = () => true; + menulist2.setAttribute("id", "menulist2"); + menulist2.setAttribute("noinitialselection", "true"); + menulist2.appendItem(/* label */ "Four", /* id */ "4"); + menulist2.appendItem(/* label */ "Five", /* id */ "5"); + menulist2.appendItem(/* label */ "Six", /* id */ "6"); + is(menulist2.menupopup.querySelectorAll('menuitem[selected="true"]').length, 0, "menulist2 should have no selected items yet."); + + // Set their values before allowing connectedCallback to run, simulating + // a race condition where an initial value is manually set before the + // connectedCallback is invoked. + menulist1.value = "2"; + panel.appendChild(menulist1); + menulist1.delayConnectedCallback = () => false; + menulist1.connectedCallback(); + + menulist2.value = "5"; + panel.appendChild(menulist2); + menulist2.delayConnectedCallback = () => false; + menulist2.connectedCallback(); + + const panelShown = new Promise(r => panel.addEventListener("popupshown", r, { once: true })); + info("opening panel"); + panel.openPopup(null, { x: 0, y: 0 }); + await panelShown; + info("panel opened"); + + is(menulist1.value, "2", "menulist1 should have the second menuitem's value"); + is(menulist1.label, "Two", "menulist1 should have the second menuitem's label"); + is(menulist1.menupopup.querySelectorAll('menuitem[selected="true"]').length, 1, "menulist1 should have only one selected item."); + + is(menulist2.value, "5", "menulist2 should not be selected to the second item's value"); + is(menulist2.label, "Five", "menulist2 should not be selected to the second item's value"); + is(menulist2.menupopup.querySelectorAll('menuitem[selected="true"]').length, 1, "menulist2 should have only one selected item."); + + menulist1.value = "3"; + menulist2.value = "6"; + + is(menulist1.value, "3", "menulist1 should have the third menuitem's value"); + is(menulist1.label, "Three", "menulist1 should have the third menuitem's label"); + is(menulist1.menupopup.querySelectorAll('menuitem[selected="true"]').length, 1, "menulist1 should have only one selected item."); + + is(menulist2.value, "6", "menulist2 should not be selected to the third item's value"); + is(menulist2.label, "Six", "menulist2 should not be selected to the third item's value"); + is(menulist2.menupopup.querySelectorAll('menuitem[selected="true"]').length, 1, "menulist2 should have only one selected item."); + + SimpleTest.finish(); +} + +]]> +</script> +<panel></panel> +</window> + + diff --git a/toolkit/content/tests/chrome/test_menulist_null_value.xhtml b/toolkit/content/tests/chrome/test_menulist_null_value.xhtml index 9312c236dc..e0ef42f5bd 100644 --- a/toolkit/content/tests/chrome/test_menulist_null_value.xhtml +++ b/toolkit/content/tests/chrome/test_menulist_null_value.xhtml @@ -34,7 +34,7 @@ function runTests() list.selectedItem = null; is(list.value, "", "Check list value after setting selectedItem to null"); - is(list.getAttribute("label"), "", "Check list label after setting selectedItem to null"); + is(list.getAttribute("label"), null, "Check list label after setting selectedItem to null"); // select something again to make sure the label is not already empty list.selectedIndex = 1; @@ -61,14 +61,14 @@ function runTests() // set the value to null and test it (bug 408940) list.value = null; is(list.value, "", "Check list value after setting value to null"); - is(list.getAttribute("label"), "", "Check list label after setting value to null"); + is(list.getAttribute("label"), null, "Check list label after setting value to null"); // select something again to make sure the label is not already empty list.selectedIndex = 1; // set the value to undefined and test it (bug 408940) list.value = undefined; is(list.value, "", "Check list value after setting value to undefined"); - is(list.getAttribute("label"), "", "Check list label after setting value to undefined"); + is(list.getAttribute("label"), null, "Check list label after setting value to undefined"); // select something again to make sure the label is not already empty list.selectedIndex = 1; @@ -76,7 +76,7 @@ function runTests() // and make sure the previous label is removed list.value = "this does not exist"; is(list.value, "this does not exist", "Check the list value after setting it to something not associated witn an existing menuitem"); - is(list.getAttribute("label"), "", "Check that the list label is empty after selecting a nonexistent item"); + is(list.getAttribute("label"), null, "Check that the list label is empty after selecting a nonexistent item"); SimpleTest.finish(); } diff --git a/toolkit/content/tests/chrome/test_notificationbox.xhtml b/toolkit/content/tests/chrome/test_notificationbox.xhtml index 8de985175a..9a2bc9d888 100644 --- a/toolkit/content/tests/chrome/test_notificationbox.xhtml +++ b/toolkit/content/tests/chrome/test_notificationbox.xhtml @@ -89,8 +89,8 @@ function testtag_notificationbox_buttonpressed(notification, button) } let buttonsPressedLog = ""; -function testtag_notificationbox_button1pressed(notification, button) { buttonsPressedLog += "button1"; return true; } -function testtag_notificationbox_button2pressed(notification, button) { buttonsPressedLog += "button2"; return true; } +function testtag_notificationbox_button1pressed() { buttonsPressedLog += "button1"; return true; } +function testtag_notificationbox_button2pressed() { buttonsPressedLog += "button2"; return true; } function testtag_notificationbox(nb) { @@ -227,7 +227,7 @@ var tests = nb.removeNotification(ntf); return ntf; }, - result(nb, ntf) { + result(nb) { testtag_notificationbox_State(nb, "removeNotification", null, 0); } }, @@ -394,7 +394,7 @@ var tests = nb.removeCurrentNotification(); return ntf; }, - result(nb, ntf) { + result(nb) { testtag_notificationbox_State(nb, "removeCurrentNotification", null, 0); } }, @@ -451,7 +451,7 @@ var tests = }, testtag_notificationbox_buttons_nopopup); return ntf; }, - result(nb, ntf) { + result(nb) { let buttons = nb.currentNotification.buttonContainer.querySelectorAll("* button"); buttons[0].focus(); @@ -510,7 +510,7 @@ var tests = } }, { - async test(nb, unused) { + async test(nb) { // add a number of notifications and check that they are added in order await nb.appendNotification("4", { label: "Four", priority: nb.PRIORITY_INFO_HIGH }, testtag_notificationbox_buttons); @@ -537,11 +537,11 @@ var tests = { // test closing notifications to make sure that the current notification is still set properly repeat: true, - test(nb, testidx) { + test() { this.repeat = false; return undefined; }, - result(nb, arr) { + result(nb) { let notificationOrder = [4, 7, 2, 8, 5, 6, 1, 9, 10, 3]; let allNotificationValues = [...nb.stack.children].map(n => n.getAttribute("value")); is(allNotificationValues.length, notificationOrder.length, "Expected number of notifications"); @@ -556,7 +556,7 @@ var tests = } }, { - async test(nb, ntf) { + async test(nb) { var exh = false; try { await nb.appendNotification("no", { label: "no", priority: -1 }); diff --git a/toolkit/content/tests/chrome/test_popup_keys.xhtml b/toolkit/content/tests/chrome/test_popup_keys.xhtml index 6b8dd31143..e72c496a59 100644 --- a/toolkit/content/tests/chrome/test_popup_keys.xhtml +++ b/toolkit/content/tests/chrome/test_popup_keys.xhtml @@ -37,7 +37,7 @@ let gLastFirstMenuActiveValue = null; function waitForEvent(target, eventName) { return new Promise(resolve => { - target.addEventListener(eventName, function eventOccurred(event) { + target.addEventListener(eventName, function eventOccurred() { resolve(); }, { once: true}); }); diff --git a/toolkit/content/tests/chrome/test_popup_moveToAnchor.xhtml b/toolkit/content/tests/chrome/test_popup_moveToAnchor.xhtml index a7800caaad..628ff2a851 100644 --- a/toolkit/content/tests/chrome/test_popup_moveToAnchor.xhtml +++ b/toolkit/content/tests/chrome/test_popup_moveToAnchor.xhtml @@ -20,7 +20,7 @@ <script> SimpleTest.waitForExplicitFinish(); -function runTest(id) +function runTest() { $("popup").openPopup($("button1"), "after_start"); } diff --git a/toolkit/content/tests/chrome/test_richlistbox.xhtml b/toolkit/content/tests/chrome/test_richlistbox.xhtml index 48303e0172..65f3626a8c 100644 --- a/toolkit/content/tests/chrome/test_richlistbox.xhtml +++ b/toolkit/content/tests/chrome/test_richlistbox.xhtml @@ -5,7 +5,6 @@ XUL Widget Test for listbox direction --> <window title="Listbox direction test" - onload="test_richlistbox()" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> @@ -26,8 +25,7 @@ function getScrollIndexAmount(aDirection) { return (4 * aDirection + richListBox.currentIndex); } -function test_richlistbox() -{ +add_task(function test_richlistbox() { var height = richListBox.clientHeight; var item; do { @@ -93,9 +91,22 @@ function test_richlistbox() richListBox.selectedItem = richListBox.firstChild; richListBox.firstChild.nextSibling.setAttribute("disabled", true); richListBox.focus(); + synthesizeKey("KEY_ArrowDown", {}, window); is(richListBox.selectedItems.length, 1, "one item selected"); - is(richListBox.selectedItems[0], richListBox.firstChild, "first item selected"); + is(richListBox.selectedItems[0], richListBox.getItemAtIndex(2), "skipped over disabled item on keydown"); + + synthesizeKey("KEY_ArrowUp", {}, window); + is(richListBox.selectedItems.length, 1, "one item selected"); + is(richListBox.selectedItems[0], richListBox.firstChild, "skipped over disabled item on keyup"); + + synthesizeMouseAtCenter(richListBox.getItemAtIndex(1), {}); + is(richListBox.selectedItems.length, 1, "one item selected"); + is(richListBox.selectedItems[0], richListBox.firstChild, "cannot select disabled item"); + + synthesizeMouseAtCenter(richListBox.getItemAtIndex(2), {}); + is(richListBox.selectedItems.length, 1, "one item selected"); + is(richListBox.selectedItems[0], richListBox.getItemAtIndex(2), "can select enabled item"); // Selected item re-insertion should keep the item selected. richListBox.clearSelection(); @@ -107,9 +118,7 @@ function test_richlistbox() richListBox.append(item); is(richListBox.selectedItems.length, 1, "one item selected"); is(richListBox.selectedItems[0], item, "last (previosly first) item selected"); - - SimpleTest.finish(); -} +}); ]]> </script> diff --git a/toolkit/content/tests/chrome/test_tree_view.xhtml b/toolkit/content/tests/chrome/test_tree_view.xhtml index 5e45161c6c..c9ec889995 100644 --- a/toolkit/content/tests/chrome/test_tree_view.xhtml +++ b/toolkit/content/tests/chrome/test_tree_view.xhtml @@ -24,23 +24,23 @@ var view = value: "", rowCount: 8, getCellText(row, column) { return this.treeData[row % 4][column.index]; }, - getCellValue(row, column) { return this.value; }, + getCellValue() { return this.value; }, setCellText(row, column, val) { this.treeData[row % 4][column.index] = val; }, setCellValue(row, column, val) { this.value = val; }, setTree(tree) { this.tree = tree; }, - isContainer(row) { return false; }, - isContainerOpen(row) { return false; }, - isContainerEmpty(row) { return false; }, - isSeparator(row) { return false; }, - isSorted(row) { return false; }, + isContainer() { return false; }, + isContainerOpen() { return false; }, + isContainerEmpty() { return false; }, + isSeparator() { return false; }, + isSorted() { return false; }, isEditable(row, column) { return row != 2 || column.index != 1; }, - getParentIndex(row, column) { return -1; }, - getLevel(row) { return 0; }, - hasNextSibling(row, column) { return row != this.rowCount - 1; }, - getImageSrc(row, column) { return ""; }, - cycleHeader(column) { }, - getRowProperties(row) { return ""; }, - getCellProperties(row, column) { return ""; }, + getParentIndex() { return -1; }, + getLevel() { return 0; }, + hasNextSibling(row) { return row != this.rowCount - 1; }, + getImageSrc() { return ""; }, + cycleHeader() { }, + getRowProperties() { return ""; }, + getCellProperties() { return ""; }, getColumnProperties(column) { if (!column.index) { diff --git a/toolkit/content/tests/chrome/window_chromemargin.xhtml b/toolkit/content/tests/chrome/window_chromemargin.xhtml index 81bcba62fe..8c7cf5c0d3 100644 --- a/toolkit/content/tests/chrome/window_chromemargin.xhtml +++ b/toolkit/content/tests/chrome/window_chromemargin.xhtml @@ -16,15 +16,19 @@ function ok(condition, message) { window.arguments[0].SimpleTest.ok(condition, message); } +function is(a, b, message) { + window.arguments[0].SimpleTest.is(a, b, message); +} + function doSingleTest(param) { var exception = null; try { document.documentElement.removeAttribute("chromemargin"); document.documentElement.setAttribute("chromemargin", param); - ok(document. + is(document. documentElement. - getAttribute("chromemargin") == param, "couldn't set/get chromemargin?"); + getAttribute("chromemargin"), param, "couldn't set/get chromemargin?"); } catch (ex) { exception = ex; } @@ -44,7 +48,7 @@ function runTests() // test remove doc.removeAttribute("chromemargin"); - ok(doc.getAttribute("chromemargin") == "", "couldn't remove chromemargin?"); + is(doc.getAttribute("chromemargin"), null, "couldn't remove chromemargin?"); // we already test these really well in a c++ test in widget doSingleTest("1,2,3,4"); diff --git a/toolkit/content/tests/chrome/window_cursorsnap_dialog.xhtml b/toolkit/content/tests/chrome/window_cursorsnap_dialog.xhtml index d5c0e2753e..fa239a87af 100644 --- a/toolkit/content/tests/chrome/window_cursorsnap_dialog.xhtml +++ b/toolkit/content/tests/chrome/window_cursorsnap_dialog.xhtml @@ -60,7 +60,7 @@ function finish() window.close(); } -function onMouseMove(aEvent) +function onMouseMove() { var button = document.getElementById("dialog").getButton("accept"); if (button.disabled) diff --git a/toolkit/content/tests/chrome/window_keys.xhtml b/toolkit/content/tests/chrome/window_keys.xhtml index 77a098ef0b..51f3be0a33 100644 --- a/toolkit/content/tests/chrome/window_keys.xhtml +++ b/toolkit/content/tests/chrome/window_keys.xhtml @@ -82,7 +82,7 @@ function runTest() document.documentElement.appendChild(keyset); iterateKeys(true, "appended"); - var accelText = menuitem => menuitem.getAttribute("acceltext").toLowerCase(); + var accelText = menuitem => (menuitem.getAttribute("acceltext") || "").toLowerCase(); $("menubutton").open = true; diff --git a/toolkit/content/tests/chrome/window_largemenu.xhtml b/toolkit/content/tests/chrome/window_largemenu.xhtml index d84b045e78..8e6b6718b4 100644 --- a/toolkit/content/tests/chrome/window_largemenu.xhtml +++ b/toolkit/content/tests/chrome/window_largemenu.xhtml @@ -363,8 +363,8 @@ function testPopupMovement() is(screenX, expectedx, gTests[gTestIndex] + " (6000, 100) x"); is(screenY, 100, gTests[gTestIndex] + " (6000, 100) y"); - is(popup.getAttribute("left"), "", gTests[gTestIndex] + " left is empty after moving"); - is(popup.getAttribute("top"), "", gTests[gTestIndex] + " top is empty after moving"); + is(popup.getAttribute("left"), null, gTests[gTestIndex] + " left is empty after moving"); + is(popup.getAttribute("top"), null, gTests[gTestIndex] + " top is empty after moving"); popup.setAttribute("left", "80"); popup.setAttribute("top", "82"); [screenX, screenY] = getScreenXY(popup); @@ -387,8 +387,8 @@ function testPopupMovement() is(screenX, expectedx, gTests[gTestIndex] + " move after set left and top x to -1"); is(screenY, expectedy, gTests[gTestIndex] + " move after set left and top y to -1"); - is(popup.getAttribute("left"), "", gTests[gTestIndex] + " left is not set after moving to -1"); - is(popup.getAttribute("top"), "", gTests[gTestIndex] + " top is not set after moving to -1"); + is(popup.getAttribute("left"), null, gTests[gTestIndex] + " left is not set after moving to -1"); + is(popup.getAttribute("top"), null, gTests[gTestIndex] + " top is not set after moving to -1"); popup.hidePopup(); } diff --git a/toolkit/content/tests/chrome/window_maximized_persist.xhtml b/toolkit/content/tests/chrome/window_maximized_persist.xhtml index f7eb695f0f..10f7d36d07 100644 --- a/toolkit/content/tests/chrome/window_maximized_persist.xhtml +++ b/toolkit/content/tests/chrome/window_maximized_persist.xhtml @@ -8,7 +8,7 @@ id="window" persist="height width sizemode"> <script type="application/javascript"><![CDATA[ - window.addEventListener("sizemodechange", evt => { + window.addEventListener("sizemodechange", () => { window.arguments[0].postMessage("sizemodechange", "*"); }); ]]></script> diff --git a/toolkit/content/tests/chrome/window_maximized_persist_with_no_titlebar.xhtml b/toolkit/content/tests/chrome/window_maximized_persist_with_no_titlebar.xhtml index 83fede7fae..e104dfa652 100644 --- a/toolkit/content/tests/chrome/window_maximized_persist_with_no_titlebar.xhtml +++ b/toolkit/content/tests/chrome/window_maximized_persist_with_no_titlebar.xhtml @@ -9,7 +9,7 @@ id="window" persist="height width sizemode"> <script type="application/javascript"><![CDATA[ - window.addEventListener("sizemodechange", evt => { + window.addEventListener("sizemodechange", () => { window.arguments[0].postMessage("sizemodechange", "*"); }); ]]></script> diff --git a/toolkit/content/tests/chrome/window_popup_anchoratrect.xhtml b/toolkit/content/tests/chrome/window_popup_anchoratrect.xhtml index 524a95b643..2262ba08e9 100644 --- a/toolkit/content/tests/chrome/window_popup_anchoratrect.xhtml +++ b/toolkit/content/tests/chrome/window_popup_anchoratrect.xhtml @@ -79,7 +79,7 @@ let tests = [ }, ]; -function runTest(id) +function runTest() { menupopup = $("popup"); nextTest(); diff --git a/toolkit/content/tests/chrome/window_tooltip.xhtml b/toolkit/content/tests/chrome/window_tooltip.xhtml index b78075de45..e6ee5c6b42 100644 --- a/toolkit/content/tests/chrome/window_tooltip.xhtml +++ b/toolkit/content/tests/chrome/window_tooltip.xhtml @@ -30,6 +30,8 @@ var gOriginalWidth = -1; var gOriginalHeight = -1; var gButton = null; +const kTooltipOffsetVertical = 10; + function runTest() { startPopupTests(popupTests); @@ -112,7 +114,7 @@ var popupTests = [ Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 6), testname + " left position of tooltip"); is(Math.round(rect.top), - Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6), + Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6 + kTooltipOffsetVertical), testname + " top position of tooltip"); var labelrect = document.getElementById("label").getBoundingClientRect(); @@ -159,7 +161,7 @@ var popupTests = [ Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 4), testname + " left position of tooltip"); is(Math.round(rect.top), - Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 4), + Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 4 + kTooltipOffsetVertical), testname + " top position of tooltip"); var labelrect = document.getElementById("label").getBoundingClientRect(); @@ -204,7 +206,7 @@ var popupTests = [ Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 6), testname + " left position of tooltip"); is(Math.round(rect.top), - Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6), + Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6 + kTooltipOffsetVertical), testname + " top position of tooltip"); var labelrect = document.getElementById("label").getBoundingClientRect(); @@ -327,7 +329,43 @@ var popupTests = [ // that the original height has increased by at least 10 pixels ok(gOriginalHeight + 10 < rect.bottom - rect.top, testname + " tooltip is wrapped"); } -} +}, +{ + testname: "anchored tooltip with no offset", + events: ["popupshowing thetooltip", "popupshown thetooltip"], + autohide: "thetooltip", + test() { + gButton = document.getElementById("withtooltip"); + document + .getElementById("thetooltip") + .setAttribute( + "onpopupshowing", + "this.moveToAnchor(this.triggerNode, 'after_start');" + ); + disableNonTestMouse(true); + synthesizeMouse(gButton, 2, 2, { type: "mouseover" }); + synthesizeMouse(gButton, 4, 4, { type: "mousemove" }); + synthesizeMouse(gButton, 6, 6, { type: "mousemove" }); + disableNonTestMouse(false); + }, + result(testname) { + var buttonrect = document + .getElementById("withtooltip") + .getBoundingClientRect(); + var tooltip = document.getElementById("thetooltip"); + var rect = tooltip.getBoundingClientRect(); + var popupstyle = window.getComputedStyle(tooltip); + + // Offset does not apply to anchored tooltips + is( + Math.round(rect.top), + Math.round(buttonrect.bottom + parseFloat(popupstyle.marginTop)), + testname + " top position of tooltip" + ); + + tooltip.removeAttribute("onpopupshowing"); + }, +}, ]; var waitSteps = 0; @@ -359,7 +397,14 @@ function moveWindowTo(x, y, callback, arg) } } -window.arguments[0].SimpleTest.waitForFocus(runTest, window); +(async function() { + let parent = window.arguments[0]; + await Promise.all([ + parent.SimpleTest.promiseFocus(window), + parent.SpecialPowers.pushPrefEnv({set: [["ui.tooltipOffsetVertical", kTooltipOffsetVertical]]}), + ]); + runTest(); +})(); ]]> </script> diff --git a/toolkit/content/tests/widgets/chrome.toml b/toolkit/content/tests/widgets/chrome.toml index 18fe0d153a..fa10249e89 100644 --- a/toolkit/content/tests/widgets/chrome.toml +++ b/toolkit/content/tests/widgets/chrome.toml @@ -5,7 +5,7 @@ support-files = [ "popup_shared.js", "window_label_checkbox.xhtml", "window_menubar.xhtml", - "seek_with_sound.ogg", + "seek_with_sound.webm", ] prefs = ["app.support.baseURL='https://support.mozilla.org/'"] @@ -63,7 +63,7 @@ skip-if = [ ["test_videocontrols_focus.html"] support-files = [ "head.js", - "video.ogg", + "video.webm", ] skip-if = [ "os == 'android'", diff --git a/toolkit/content/tests/widgets/file_videocontrols_jsdisabled.html b/toolkit/content/tests/widgets/file_videocontrols_jsdisabled.html index 56917b69ac..95dba91eea 100644 --- a/toolkit/content/tests/widgets/file_videocontrols_jsdisabled.html +++ b/toolkit/content/tests/widgets/file_videocontrols_jsdisabled.html @@ -1,2 +1,2 @@ -<video src="seek_with_sound.ogg" controls autoplay=true></video> +<video src="seek_with_sound.webm" controls autoplay=true></video> <script>window.testExpando = true;</script> diff --git a/toolkit/content/tests/widgets/head.js b/toolkit/content/tests/widgets/head.js index d7473fa92d..2a72845a27 100644 --- a/toolkit/content/tests/widgets/head.js +++ b/toolkit/content/tests/widgets/head.js @@ -51,7 +51,7 @@ function executeTests() { } function once(target, name, cb) { - let p = new Promise(function (resolve, reject) { + let p = new Promise(function (resolve) { target.addEventListener( name, function () { diff --git a/toolkit/content/tests/widgets/mochitest.toml b/toolkit/content/tests/widgets/mochitest.toml index 7e20352256..efd86f1208 100644 --- a/toolkit/content/tests/widgets/mochitest.toml +++ b/toolkit/content/tests/widgets/mochitest.toml @@ -5,8 +5,8 @@ support-files = [ "file_videocontrols_jsdisabled.html", "image.png", "image-zh.png", - "seek_with_sound.ogg", - "video.ogg", + "seek_with_sound.webm", + "video.webm", "head.js", "tree_shared.js", "test-webvtt-1.vtt", @@ -97,7 +97,10 @@ skip-if = [ ["test_videocontrols_size.html"] ["test_videocontrols_standalone.html"] -skip-if = ["os == 'android'"] # bug 1075573 +skip-if = [ + "os == 'linux'", # bug 1804621 + "os == 'android'", # bug 1075573 +] ["test_videocontrols_video_direction.html"] skip-if = [ diff --git a/toolkit/content/tests/widgets/seek_with_sound.ogg b/toolkit/content/tests/widgets/seek_with_sound.ogg Binary files differdeleted file mode 100644 index c86d9946bd..0000000000 --- a/toolkit/content/tests/widgets/seek_with_sound.ogg +++ /dev/null diff --git a/toolkit/content/tests/widgets/seek_with_sound.webm b/toolkit/content/tests/widgets/seek_with_sound.webm Binary files differnew file mode 100644 index 0000000000..dd60cc5a0a --- /dev/null +++ b/toolkit/content/tests/widgets/seek_with_sound.webm diff --git a/toolkit/content/tests/widgets/test_moz_button.html b/toolkit/content/tests/widgets/test_moz_button.html index 473b2d1a1c..a849ccc956 100644 --- a/toolkit/content/tests/widgets/test_moz_button.html +++ b/toolkit/content/tests/widgets/test_moz_button.html @@ -75,24 +75,23 @@ color: "--button-text-color-primary", height: "--button-min-height", }); - assertButtonPropertiesMatch(four, { width: "--button-size-icon", height: "--button-size-icon", backgroundColor: "--button-background-color", - fill: "--button-text-color", + fill: "--icon-color", }); assertButtonPropertiesMatch(five, { width: "--button-size-icon", height: "--button-size-icon", backgroundColor: "transparent", - fill: "--button-text-color", + fill: "--icon-color", }); assertButtonPropertiesMatch(six, { width: "--button-size-icon", height: "--button-size-icon", backgroundColor: "transparent", - fill: "--button-text-color", + fill: "--icon-color", }); buttons.forEach(btn => (btn.size = "small")); diff --git a/toolkit/content/tests/widgets/test_moz_card.html b/toolkit/content/tests/widgets/test_moz_card.html index ef4e67d0fa..aa9ecfde31 100644 --- a/toolkit/content/tests/widgets/test_moz_card.html +++ b/toolkit/content/tests/widgets/test_moz_card.html @@ -13,6 +13,11 @@ <body> <p id="display"></p> + <style> + moz-card.withHeadingIcon::part(icon) { + background-image: url("chrome://browser/skin/preferences/category-general.svg"); + } + </style> <div id="content"> <moz-card id="default-card" data-l10n-id="test-id-1" data-l10n-attrs="heading"> <div>TEST</div> @@ -25,6 +30,12 @@ </moz-card> <hr /> + <moz-card id="heading-icon-card" data-l10n-id="test-id-3" data-l10n-attrs="heading" heading="heading with icon" + type="accordion" icon class="withHeadingIcon"> + <div>heading icon test content</div> + </moz-card> + <hr /> + </div> <pre id="test"></pre> <script> @@ -58,12 +69,16 @@ } - function assertAccordionCardProperties(card, expectedValues) { + function assertAccordionCardProperties(card) { ok(card.detailsEl, "The details element should exist"); ok(card.detailsEl.querySelector("summary"), "There should be a summary element within the details element"); ok(card.detailsEl.querySelector("summary").querySelector(".chevron-icon"), "There should be a chevron icon div within the summary element"); } + function assertHeadingIconCardProperties(card) { + ok(card.shadowRoot.querySelector("#heading-wrapper").querySelector("#heading-icon"), "The heading icon element should exist"); + } + async function generateCard(values) { let card = document.createElement("moz-card"); for (let [key, value] of Object.entries(values)) { @@ -152,6 +167,54 @@ ); }); + add_task(async function testHeadingIconCard() { + assertBasicProperties(document.getElementById("heading-icon-card"), + { + "data-l10n-id": "test-id-3", + "data-l10n-attrs": "heading", + contentText: "heading icon test content", + headingText: "heading with icon", + } + ); + assertHeadingIconCardProperties(document.getElementById("heading-icon-card"), + { + "data-l10n-id": "test-id-3", + "data-l10n-attrs": "heading", + contentText: "heading icon test content", + headingText: "heading with icon", + } + ); + + let headingIconCard = await generateCard( + { + class: "heading-icon-class", + type: "accordion", + icon: "", + id: "generated-heading-icon-card", + "data-l10n-id": "generated-id-3", + "data-l10n-attrs": "heading", + heading: testHeading + } + ); + + assertBasicProperties(headingIconCard, + { + "data-l10n-id": "generated-id-3", + "data-l10n-attrs": "heading", + headingText: testHeading, + contentText: generatedSlotText, + } + ); + assertHeadingIconCardProperties(headingIconCard, + { + "data-l10n-id": "generated-id-3", + "data-l10n-attrs": "heading", + headingText: testHeading, + contentText: generatedSlotText, + } + ); + }); + </script> </body> diff --git a/toolkit/content/tests/widgets/test_popupreflows.xhtml b/toolkit/content/tests/widgets/test_popupreflows.xhtml index c3f8068779..c014d6bee4 100644 --- a/toolkit/content/tests/widgets/test_popupreflows.xhtml +++ b/toolkit/content/tests/widgets/test_popupreflows.xhtml @@ -20,7 +20,7 @@ let panel, anchor; // done by the panel. let observer = { reflows: [], - reflow (start, end) { + reflow () { // Ignore reflows triggered by native code // (Reflows from native code only have an empty stack after the first frame) var path = (new Error().stack).split("\n").slice(1).join(""); @@ -31,7 +31,7 @@ let observer = { this.reflows.push(new Error().stack); }, - reflowInterruptible (start, end) { + reflowInterruptible () { // We're not interested in interruptible reflows. Why, you ask? Because // we've simply cargo-culted this test from browser_tabopen_reflows.js! }, diff --git a/toolkit/content/tests/widgets/test_videocontrols.html b/toolkit/content/tests/widgets/test_videocontrols.html index 076b4350fd..f2fc53a1cc 100644 --- a/toolkit/content/tests/widgets/test_videocontrols.html +++ b/toolkit/content/tests/widgets/test_videocontrols.html @@ -184,7 +184,7 @@ add_task(async function setup() { ]}); await new Promise(resolve => { video.addEventListener("canplaythrough", resolve, {once: true}); - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; }); video.addEventListener("play", captureEventThenCheck); @@ -437,7 +437,7 @@ add_task(async function click_and_hold_slider() { * Bug 1402877: Don't let click event dispatch through media controls to video element. */ add_task(async function click_event_dispatch() { - const clientScriptClickHandler = (e) => { + const clientScriptClickHandler = () => { ok(false, "Should not receive the event"); }; video.addEventListener("click", clientScriptClickHandler); diff --git a/toolkit/content/tests/widgets/test_videocontrols_audio.html b/toolkit/content/tests/widgets/test_videocontrols_audio.html index ad528f4c27..0a7a2dcbc3 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_audio.html +++ b/toolkit/content/tests/widgets/test_videocontrols_audio.html @@ -18,7 +18,7 @@ <script> const video = document.getElementById("video"); - function loadedmetadata(event) { + function loadedmetadata() { SimpleTest.executeSoon(function() { const controlBar = SpecialPowers.wrap(video).openOrClosedShadowRoot.querySelector(".controlBar"); is(controlBar.getAttribute("fullscreen-unavailable"), "true", "Fullscreen button is hidden"); diff --git a/toolkit/content/tests/widgets/test_videocontrols_closed_caption_menu.html b/toolkit/content/tests/widgets/test_videocontrols_closed_caption_menu.html index 39d6ff494f..5a2602d204 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_closed_caption_menu.html +++ b/toolkit/content/tests/widgets/test_videocontrols_closed_caption_menu.html @@ -49,7 +49,7 @@ ["media.videocontrols.keyboard-tab-to-all-controls", true], ]}, done); }, done => { - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; video.addEventListener("loadedmetadata", done); }, cleanup); diff --git a/toolkit/content/tests/widgets/test_videocontrols_error.html b/toolkit/content/tests/widgets/test_videocontrols_error.html index af90a4672a..922726d5be 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_error.html +++ b/toolkit/content/tests/widgets/test_videocontrols_error.html @@ -27,7 +27,7 @@ add_task(async function check_normal_status() { await new Promise(resolve => { - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; video.addEventListener("loadedmetadata", () => SimpleTest.executeSoon(resolve)); }); @@ -44,7 +44,7 @@ const errorType = "errorNoSource"; await new Promise(resolve => { - video.src = "invalid_source.ogg"; + video.src = "invalid_source.webm"; video.addEventListener("error", () => SimpleTest.executeSoon(resolve)); }); diff --git a/toolkit/content/tests/widgets/test_videocontrols_focus.html b/toolkit/content/tests/widgets/test_videocontrols_focus.html index 0982947ffe..e19262bf6e 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_focus.html +++ b/toolkit/content/tests/widgets/test_videocontrols_focus.html @@ -36,7 +36,7 @@ add_task(async function setup() { video.controls = true; video.preload = "auto"; video.loop = true; - video.src = "video.ogg"; + video.src = "video.webm"; const caption = video.addTextTrack("captions", "English", "en"); caption.mode = "showing"; const content = document.getElementById("content"); diff --git a/toolkit/content/tests/widgets/test_videocontrols_iframe_fullscreen.html b/toolkit/content/tests/widgets/test_videocontrols_iframe_fullscreen.html index 0a74b25609..d30d10b8bc 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_iframe_fullscreen.html +++ b/toolkit/content/tests/widgets/test_videocontrols_iframe_fullscreen.html @@ -30,7 +30,7 @@ ifr.addEventListener("load", resolve); }).then(() => new Promise(resolve => { video = ifr.contentDocument.getElementById("video"); - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; video.addEventListener("loadedmetadata", resolve); })).then(() => new Promise(resolve => { const available = video.ownerDocument.fullscreenEnabled; diff --git a/toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html b/toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html index f3fdecc47f..16cf2b92e0 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html +++ b/toolkit/content/tests/widgets/test_videocontrols_jsdisabled.html @@ -45,7 +45,7 @@ SpecialPowers.pushPrefEnv({"set": [["javascript.enabled", false]]}, startTest); var testnum = 1; var video; -function loadevent(event) { +function loadevent() { is(win.testExpando, undefined, "expando shouldn't exist because js is disabled"); video = win.document.querySelector("video"); // Other events expected by the test. diff --git a/toolkit/content/tests/widgets/test_videocontrols_keyhandler.html b/toolkit/content/tests/widgets/test_videocontrols_keyhandler.html index 5b771fc745..9737a9fff2 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_keyhandler.html +++ b/toolkit/content/tests/widgets/test_videocontrols_keyhandler.html @@ -31,7 +31,7 @@ ["media.videocontrols.keyboard-tab-to-all-controls", true], ]}, done); }, done => { - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; video.addEventListener("loadedmetadata", done); }); diff --git a/toolkit/content/tests/widgets/test_videocontrols_onclickplay.html b/toolkit/content/tests/widgets/test_videocontrols_onclickplay.html index 9023512ab7..3b1bd4653c 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_onclickplay.html +++ b/toolkit/content/tests/widgets/test_videocontrols_onclickplay.html @@ -22,11 +22,11 @@ var video = document.getElementById("video"); function startMediaLoad() { // Kick off test once video has loaded, in its canplaythrough event handler. - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; video.addEventListener("canplaythrough", runTest); } -function loadevent(event) { +function loadevent() { SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, startMediaLoad); } diff --git a/toolkit/content/tests/widgets/test_videocontrols_scrubber_position.html b/toolkit/content/tests/widgets/test_videocontrols_scrubber_position.html index b1d2ab9e74..51117e7955 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_scrubber_position.html +++ b/toolkit/content/tests/widgets/test_videocontrols_scrubber_position.html @@ -26,7 +26,7 @@ const video = document.getElementById("video"); add_task(async function setup() { await new Promise(resolve => { video.addEventListener("canplaythrough", resolve, {once: true}); - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; }); // Check initial state upon load diff --git a/toolkit/content/tests/widgets/test_videocontrols_scrubber_position_nopreload.html b/toolkit/content/tests/widgets/test_videocontrols_scrubber_position_nopreload.html index 9fbb6fbcb5..968ba5db96 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_scrubber_position_nopreload.html +++ b/toolkit/content/tests/widgets/test_videocontrols_scrubber_position_nopreload.html @@ -13,7 +13,7 @@ <p id="display"></p> <div id="content"> - <video width="320" height="240" id="video" mozNoDynamicControls controls="true" preload="none" src="seek_with_sound.ogg"></video> + <video width="320" height="240" id="video" mozNoDynamicControls controls="true" preload="none" src="seek_with_sound.webm"></video> </div> <div id="host"></div> diff --git a/toolkit/content/tests/widgets/test_videocontrols_size.html b/toolkit/content/tests/widgets/test_videocontrols_size.html index 559cc66e86..d940b1d295 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_size.html +++ b/toolkit/content/tests/widgets/test_videocontrols_size.html @@ -148,7 +148,7 @@ testCases.push(() => Promise.all(videoElems.map(video => new Promise(resolve => { video.addEventListener("loadedmetadata", resolve); - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; })))); videoElems.forEach(video => { diff --git a/toolkit/content/tests/widgets/test_videocontrols_standalone.html b/toolkit/content/tests/widgets/test_videocontrols_standalone.html index 14208923dd..1eaa026cdc 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_standalone.html +++ b/toolkit/content/tests/widgets/test_videocontrols_standalone.html @@ -22,7 +22,7 @@ function getMediaElement(aWindow) { return aWindow.document.getElementsByTagName("video")[0]; } -var popup = window.open("seek_with_sound.ogg"); +var popup = window.open("seek_with_sound.webm"); popup.addEventListener("load", function() { var video = getMediaElement(popup); diff --git a/toolkit/content/tests/widgets/test_videocontrols_video_noaudio.html b/toolkit/content/tests/widgets/test_videocontrols_video_noaudio.html index bfc8018466..99d5bdad01 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_video_noaudio.html +++ b/toolkit/content/tests/widgets/test_videocontrols_video_noaudio.html @@ -23,7 +23,7 @@ add_task(async function setup() { await SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}); await new Promise(resolve => { - video.src = "video.ogg"; + video.src = "video.webm"; video.addEventListener("loadedmetadata", () => SimpleTest.executeSoon(resolve)); }); }); diff --git a/toolkit/content/tests/widgets/test_videocontrols_vtt.html b/toolkit/content/tests/widgets/test_videocontrols_vtt.html index 2f8d70f35a..33b8bcf24e 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_vtt.html +++ b/toolkit/content/tests/widgets/test_videocontrols_vtt.html @@ -26,7 +26,7 @@ add_task(async function wait_for_media_ready() { await SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}); await new Promise(resolve => { - video.src = "seek_with_sound.ogg"; + video.src = "seek_with_sound.webm"; video.addEventListener("loadedmetadata", resolve); }); }); diff --git a/toolkit/content/tests/widgets/tree_shared.js b/toolkit/content/tests/widgets/tree_shared.js index ba52bf828e..2cc40686ec 100644 --- a/toolkit/content/tests/widgets/tree_shared.js +++ b/toolkit/content/tests/widgets/tree_shared.js @@ -321,11 +321,7 @@ function testtag_tree_columns(tree, expectedColumns, testid) { // check the view's getColumnProperties method var properties = tree.view.getColumnProperties(column); var expectedProperties = expectedColumn.properties; - is( - properties, - expectedProperties ? expectedProperties : "", - adjtestid + "getColumnProperties" - ); + is(properties, expectedProperties || "", adjtestid + "getColumnProperties"); } is(columns.getFirstColumn(), columns[0], testid + "getFirstColumn"); @@ -574,10 +570,10 @@ function testtag_tree_TreeSelection_UI(tree, testid, multiple) { var keydownFired = 0; var keypressFired = 0; - function keydownListener(event) { + function keydownListener() { keydownFired++; } - function keypressListener(event) { + function keypressListener() { keypressFired++; } @@ -1307,7 +1303,7 @@ function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow) { isContainer(row) { return row.container; }, - isContainerOpen(row) { + isContainerOpen() { return false; }, isContainerEmpty(row) { @@ -1325,7 +1321,7 @@ function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow) { getParentIndex(row) { return row.parent; }, - hasNextSibling(row) { + hasNextSibling() { return r < startRow + length - 1; }, }; @@ -1433,7 +1429,7 @@ function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow) { } } -function testtag_tree_TreeView_rows_sort(tree, testid, rowInfo) { +function testtag_tree_TreeView_rows_sort(tree) { // check if cycleHeader sorts the columns var columnIndex = 0; var view = tree.view; @@ -1734,7 +1730,7 @@ function testtag_tree_wheel(aTree) { var defaultPrevented = 0; - function wheelListener(event) { + function wheelListener() { defaultPrevented++; } window.addEventListener("wheel", wheelListener); @@ -2109,7 +2105,7 @@ function mouseClickOnColumnHeader( } } -function mouseDblClickOnCell(tree, row, column, testname) { +function mouseDblClickOnCell(tree, row, column) { // select the row we will edit var selection = tree.view.selection; selection.select(row); @@ -2151,12 +2147,12 @@ function convertDOMtoTreeRowInfo(treechildren, level, rowidx) { for (var c = 0; c < treerow.childNodes.length; c++) { var cell = treerow.childNodes[c]; cellInfo.push({ - label: "" + cell.getAttribute("label"), - value: cell.getAttribute("value"), - properties: cell.getAttribute("properties"), + label: cell.getAttribute("label") || "", + value: cell.getAttribute("value") || "", + properties: cell.getAttribute("properties") || "", editable: cell.getAttribute("editable") != "false", selectable: cell.getAttribute("selectable") != "false", - image: cell.getAttribute("src"), + image: cell.getAttribute("src") || "", mode: cell.hasAttribute("mode") ? parseInt(cell.getAttribute("mode")) : 3, @@ -2170,7 +2166,7 @@ function convertDOMtoTreeRowInfo(treechildren, level, rowidx) { : convertDOMtoTreeRowInfo(descendants, level + 1, rowidx); obj.rows.push({ cells: cellInfo, - properties: treerow.getAttribute("properties"), + properties: treerow.getAttribute("properties") || "", container: treeitem.getAttribute("container") == "true", separator: treeitem.localName == "treeseparator", children, diff --git a/toolkit/content/tests/widgets/video.ogg b/toolkit/content/tests/widgets/video.ogg Binary files differdeleted file mode 100644 index ac7ece3519..0000000000 --- a/toolkit/content/tests/widgets/video.ogg +++ /dev/null diff --git a/toolkit/content/tests/widgets/video.webm b/toolkit/content/tests/widgets/video.webm Binary files differnew file mode 100644 index 0000000000..87a8d837a8 --- /dev/null +++ b/toolkit/content/tests/widgets/video.webm diff --git a/toolkit/content/tests/widgets/videocontrols_direction_test.js b/toolkit/content/tests/widgets/videocontrols_direction_test.js index e937f06b3f..608a39cc5b 100644 --- a/toolkit/content/tests/widgets/videocontrols_direction_test.js +++ b/toolkit/content/tests/widgets/videocontrols_direction_test.js @@ -26,7 +26,7 @@ RemoteCanvas.prototype.load = function (callback) { var m = iframe.contentDocument.getElementById("av"); m.addEventListener( "suspend", - function (aEvent) { + function () { setTimeout(function () { let mediaElement = iframe.contentDocument.querySelector("audio, video"); diff --git a/toolkit/content/tests/widgets/window_menubar.xhtml b/toolkit/content/tests/widgets/window_menubar.xhtml index c4ced844ad..ded1361365 100644 --- a/toolkit/content/tests/widgets/window_menubar.xhtml +++ b/toolkit/content/tests/widgets/window_menubar.xhtml @@ -426,7 +426,7 @@ var popupTests = [ test() { synthesizeKey("KEY_Escape"); }, - result(testname) { + result() { }, }, { @@ -504,14 +504,14 @@ var popupTests = [ testname: "cursor up wrap", events: [ "DOMMenuItemInactive contents", "DOMMenuItemActive about" ], test() { synthesizeKey("KEY_ArrowUp"); }, - result(testname) { } + result() { } }, { // check that pressing cursor down skips non menuitems testname: "cursor down wrap", events: [ "DOMMenuItemInactive about", "DOMMenuItemActive contents" ], test() { synthesizeKey("KEY_ArrowDown"); }, - result(testname) { } + result() { } }, { // check that pressing a menuitem's accelerator selects it @@ -617,7 +617,7 @@ var popupTests = [ condition() { return kIsWindows; }, events: [ "DOMMenuItemInactive only", "DOMMenuItemActive other" ], test() { sendChar("o"); }, - result(testname) { } + result() { } }, { // when only one menuitem starting with that letter exists, it should be |