diff options
Diffstat (limited to 'browser/base/content/test')
204 files changed, 1199 insertions, 620 deletions
diff --git a/browser/base/content/test/about/browser_aboutCertError.js b/browser/base/content/test/about/browser_aboutCertError.js index 9af82b807f..5939b026bd 100644 --- a/browser/base/content/test/about/browser_aboutCertError.js +++ b/browser/base/content/test/about/browser_aboutCertError.js @@ -121,7 +121,7 @@ add_task(async function checkReturnToPreviousPage() { "pageshow", true ); - await SpecialPowers.spawn(bc, [useFrame], async function (subFrame) { + await SpecialPowers.spawn(bc, [useFrame], async function () { let returnButton = content.document.getElementById("returnButton"); returnButton.click(); }); @@ -544,7 +544,7 @@ add_task(async function checkViewSource() { certOverrideService.clearValidityOverride("expired.example.com", -1, {}); loaded = BrowserTestUtils.waitForErrorPage(browser); - BrowserReloadSkipCache(); + BrowserCommands.reloadSkipCache(); await loaded; BrowserTestUtils.removeTab(gBrowser.selectedTab); diff --git a/browser/base/content/test/alerts/browser_notification_open_settings.js b/browser/base/content/test/alerts/browser_notification_open_settings.js index ed51cd782b..e7f1c28251 100644 --- a/browser/base/content/test/alerts/browser_notification_open_settings.js +++ b/browser/base/content/test/alerts/browser_notification_open_settings.js @@ -14,7 +14,7 @@ add_task(async function test_settingsOpen_observer() { gBrowser, url: "about:robots", }, - async function dummyTabTask(aBrowser) { + async function dummyTabTask() { // Ensure preferences is loaded before removing the tab. let syncPaneLoadedPromise = TestUtils.topicObserved( "sync-pane-loaded", diff --git a/browser/base/content/test/alerts/head.js b/browser/base/content/test/alerts/head.js index 4be18f6c41..eaf3a2bb74 100644 --- a/browser/base/content/test/alerts/head.js +++ b/browser/base/content/test/alerts/head.js @@ -20,7 +20,7 @@ async function addNotificationPermission(originString) { */ function promiseWindowClosed(window) { return new Promise(function (resolve) { - Services.ww.registerNotification(function observer(subject, topic, data) { + Services.ww.registerNotification(function observer(subject, topic) { if (topic == "domwindowclosed" && subject == window) { Services.ww.unregisterNotification(observer); resolve(); diff --git a/browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js b/browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js index 6389338a6f..b65a419884 100644 --- a/browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js +++ b/browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js @@ -117,7 +117,7 @@ add_task(async function testCaptivePortalAdvancedPanel() { await BrowserTestUtils.waitForLocationChange(gBrowser, BAD_CERT_PAGE); info("(waitForLocationChange resolved)"); })(); - await SpecialPowers.spawn(browser, [BAD_CERT_PAGE], async expectedURL => { + await SpecialPowers.spawn(browser, [BAD_CERT_PAGE], async () => { const doc = content.document; let advancedButton = doc.getElementById("advancedButton"); await ContentTaskUtils.waitForCondition( diff --git a/browser/base/content/test/contextMenu/browser.toml b/browser/base/content/test/contextMenu/browser.toml index 3eb6a1d606..660f6a955b 100644 --- a/browser/base/content/test/contextMenu/browser.toml +++ b/browser/base/content/test/contextMenu/browser.toml @@ -8,7 +8,6 @@ support-files = [ "subtst_contextmenu_xul.xhtml", "ctxmenu-image.png", "../general/head.js", - "../general/video.ogg", "../general/audio.ogg", "../../../../../toolkit/components/pdfjs/test/file_pdfjs_test.pdf", "contextmenu_common.js", @@ -19,6 +18,7 @@ support-files = [ ["browser_bug1798178.js"] ["browser_contextmenu.js"] +support-files = [ "../general/video.webm" ] tags = "fullscreen" skip-if = [ "os == 'linux'", @@ -86,6 +86,8 @@ skip-if = ["os == 'linux' && socketprocess_networking"] ["browser_strip_on_share_link.js"] +["browser_strip_on_share_nested_link.js"] + ["browser_utilityOverlay.js"] https_first_disabled = true skip-if = ["os == 'linux' && socketprocess_networking"] diff --git a/browser/base/content/test/contextMenu/browser_contextmenu.js b/browser/base/content/test/contextMenu/browser_contextmenu.js index ebeb4bdb04..00da3113c6 100644 --- a/browser/base/content/test/contextMenu/browser_contextmenu.js +++ b/browser/base/content/test/contextMenu/browser_contextmenu.js @@ -137,7 +137,7 @@ add_task(async function test_setup_html() { audio.loop = true; audio.src = "audio.ogg"; video.loop = true; - video.src = "video.ogg"; + video.src = "video.webm"; let awaitPause = ContentTaskUtils.waitForEvent(audio, "pause"); await ContentTaskUtils.waitForCondition( diff --git a/browser/base/content/test/contextMenu/browser_contextmenu_badiframe.js b/browser/base/content/test/contextMenu/browser_contextmenu_badiframe.js index 991a55af70..57d9808f5d 100644 --- a/browser/base/content/test/contextMenu/browser_contextmenu_badiframe.js +++ b/browser/base/content/test/contextMenu/browser_contextmenu_badiframe.js @@ -30,7 +30,7 @@ async function openTestPage() { let pageAndIframesLoaded = BrowserTestUtils.browserLoaded( browser, true /* includeSubFrames */, - url => { + () => { expectedLoads--; return !expectedLoads; }, diff --git a/browser/base/content/test/contextMenu/browser_contextmenu_save_blocked.js b/browser/base/content/test/contextMenu/browser_contextmenu_save_blocked.js index 062fbeac08..7e6b71e8e4 100644 --- a/browser/base/content/test/contextMenu/browser_contextmenu_save_blocked.js +++ b/browser/base/content/test/contextMenu/browser_contextmenu_save_blocked.js @@ -64,7 +64,7 @@ add_task(async function test_save_link_blocked_by_extension() { setTimeout(resolve, 0); }; - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { ok(false, "filepicker should never been shown"); setTimeout(resolve, 0); return Ci.nsIFilePicker.returnCancel; diff --git a/browser/base/content/test/contextMenu/browser_strip_on_share_nested_link.js b/browser/base/content/test/contextMenu/browser_strip_on_share_nested_link.js new file mode 100644 index 0000000000..d11649e648 --- /dev/null +++ b/browser/base/content/test/contextMenu/browser_strip_on_share_nested_link.js @@ -0,0 +1,162 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +let listService; + +const TEST_URL = + "https://example.com/browser/browser/base/content/test/general/dummy_page.html"; + +add_setup(async function () { + await SpecialPowers.pushPrefEnv({ + set: [["privacy.query_stripping.strip_list", "stripParam"]], + }); + + // Get the list service so we can wait for it to be fully initialized before running tests. + listService = Cc["@mozilla.org/query-stripping-list-service;1"].getService( + Ci.nsIURLQueryStrippingListService + ); + + await listService.testWaitForInit(); +}); + +/* +Tests the strip-on-share feature for in-content links with nested urls +*/ + +// Testing nested stripping with global params +add_task(async function testNestedStrippingGlobalParam() { + let validUrl = + "https://www.example.com/?test=https%3A%2F%2Fwww.example.net%2F%3Futm_ad%3D1234"; + let shortenedUrl = + "https://www.example.com/?test=https%3A%2F%2Fwww.example.net%2F"; + await testStripOnShare({ + originalURI: validUrl, + strippedURI: shortenedUrl, + }); +}); + +// Testing nested stripping with site specific params +add_task(async function testNestedStrippingSiteSpecific() { + let validUrl = + "https://www.example.com/?test=https%3A%2F%2Fwww.example.net%2F%3Ftest_3%3D1234"; + let shortenedUrl = + "https://www.example.com/?test=https%3A%2F%2Fwww.example.net%2F"; + await testStripOnShare({ + originalURI: validUrl, + strippedURI: shortenedUrl, + }); +}); + +// Testing nested stripping with incorrect site specific params +add_task(async function testNoStrippedNestedParam() { + let validUrl = + "https://www.example.com/?test=https%3A%2F%2Fwww.example.com%2F%3Ftest_3%3D1234"; + let shortenedUrl = + "https://www.example.com/?test=https%3A%2F%2Fwww.example.com%2F%3Ftest_3%3D1234"; + await testStripOnShare({ + originalURI: validUrl, + strippedURI: shortenedUrl, + }); +}); + +// Testing order of stripping for nested stripping +add_task(async function testOrderOfStripping() { + let validUrl = + "https://www.example.com/?test_1=https%3A%2F%2Fwww.example.net%2F%3Ftest_3%3D1234"; + let shortenedUrl = "https://www.example.com/"; + await testStripOnShare({ + originalURI: validUrl, + strippedURI: shortenedUrl, + }); +}); + +// Testing correct scoping of site specific params for nested stripping +add_task(async function testMultipleQueryParamsWithNestedStripping() { + let validUrl = + "https://www.example.com/?test_3=1234&test=https%3A%2F%2Fwww.example.net%2F%3Ftest_3%3D1234"; + let shortenedUrl = + "https://www.example.com/?test_3=1234&test=https%3A%2F%2Fwww.example.net%2F"; + await testStripOnShare({ + originalURI: validUrl, + strippedURI: shortenedUrl, + }); +}); + +// Testing functionality with no https pages +add_task(async function testNonHTTPsPages() { + let validUrl = "https://www.example.com/?test_2=1234&test=about%3A%3Aconfig"; + let shortenedUrl = "https://www.example.com/?test=about%3A%3Aconfig"; + await testStripOnShare({ + originalURI: validUrl, + strippedURI: shortenedUrl, + }); +}); + +/** + * Opens a new tab, opens the context menu and checks that the strip-on-share menu item is visible. + * Checks that the stripped version of the url is copied to the clipboard. + * + * @param {string} originalURI - The orginal url before the stripping occurs + * @param {string} strippedURI - The expected url after stripping occurs + */ +async function testStripOnShare({ originalURI, strippedURI }) { + await SpecialPowers.pushPrefEnv({ + set: [ + ["privacy.query_stripping.strip_on_share.enabled", true], + ["privacy.query_stripping.strip_on_share.enableTestMode", true], + ], + }); + + let testJson = { + global: { + queryParams: ["utm_ad"], + topLevelSites: ["*"], + }, + example: { + queryParams: ["test_2", "test_1"], + topLevelSites: ["www.example.com"], + }, + exampleNet: { + queryParams: ["test_3", "test_4"], + topLevelSites: ["www.example.net"], + }, + }; + + await listService.testSetList(testJson); + + await BrowserTestUtils.withNewTab(TEST_URL, async function (browser) { + // Prepare a link + await SpecialPowers.spawn(browser, [originalURI], function (startingURI) { + let link = content.document.createElement("a"); + link.href = startingURI; + link.textContent = "link with query param"; + link.id = "link"; + content.document.body.appendChild(link); + }); + let contextMenu = document.getElementById("contentAreaContextMenu"); + // Open the context menu + let awaitPopupShown = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + await BrowserTestUtils.synthesizeMouseAtCenter( + "#link", + { type: "contextmenu", button: 2 }, + browser + ); + await awaitPopupShown; + let awaitPopupHidden = BrowserTestUtils.waitForEvent( + contextMenu, + "popuphidden" + ); + let stripOnShare = contextMenu.querySelector("#context-stripOnShareLink"); + Assert.ok(BrowserTestUtils.isVisible(stripOnShare), "Menu item is visible"); + // Make sure the stripped link will be copied to the clipboard + await SimpleTest.promiseClipboardChange(strippedURI, () => { + contextMenu.activateItem(stripOnShare); + }); + await awaitPopupHidden; + }); +} diff --git a/browser/base/content/test/contextMenu/contextmenu_common.js b/browser/base/content/test/contextMenu/contextmenu_common.js index ac61aa2a3a..2c9a1967f6 100644 --- a/browser/base/content/test/contextMenu/contextmenu_common.js +++ b/browser/base/content/test/contextMenu/contextmenu_common.js @@ -39,7 +39,7 @@ function closeContextMenu() { contextMenu.hidePopup(); } -function getVisibleMenuItems(aMenu, aData) { +function getVisibleMenuItems(aMenu) { var items = []; var accessKeys = {}; for (var i = 0; i < aMenu.children.length; i++) { @@ -65,7 +65,7 @@ function getVisibleMenuItems(aMenu, aData) { var label = item.getAttribute("label"); ok(label.length, "menuitem " + item.id + " has a label"); if (isGenerated) { - is(key, "", "Generated items shouldn't have an access key"); + is(key, null, "Generated items shouldn't have an access key"); items.push("*" + label); } else if ( item.id.indexOf("spell-check-dictionary-") != 0 && diff --git a/browser/base/content/test/contextMenu/subtst_contextmenu.html b/browser/base/content/test/contextMenu/subtst_contextmenu.html index 2c263fbce4..2facd9fecc 100644 --- a/browser/base/content/test/contextMenu/subtst_contextmenu.html +++ b/browser/base/content/test/contextMenu/subtst_contextmenu.html @@ -26,14 +26,14 @@ document.getElementById("shadow-host-in-link").attachShadow({ mode: "closed" }). <image id="test-svg-image" href="ctxmenu-image.png"/> </svg> <canvas id="test-canvas" width="100" height="100" style="background-color: blue"></canvas> -<video controls id="test-video-ok" src="video.ogg" width="100" height="100" style="background-color: green"></video> +<video controls id="test-video-ok" src="video.webm" width="100" height="100" style="background-color: green"></video> <video id="test-audio-in-video" src="audio.ogg" width="100" height="100" style="background-color: red"></video> <video controls id="test-video-bad" src="bogus.duh" width="100" height="100" style="background-color: orange"></video> <video controls id="test-video-bad2" width="100" height="100" style="background-color: yellow"> <source src="bogus.duh" type="video/durrrr;"> </video> <iframe id="test-iframe" width="98" height="98" style="border: 1px solid black"></iframe> -<iframe id="test-video-in-iframe" src="video.ogg" width="98" height="98" style="border: 1px solid black"></iframe> +<iframe id="test-video-in-iframe" src="video.webm" width="98" height="98" style="border: 1px solid black"></iframe> <iframe id="test-audio-in-iframe" src="audio.ogg" width="98" height="98" style="border: 1px solid black"></iframe> <iframe id="test-image-in-iframe" src="ctxmenu-image.png" width="98" height="98" style="border: 1px solid black"></iframe> <iframe id="test-pdf-viewer-in-frame" src="file_pdfjs_test.pdf" width="100" height="100" style="border: 1px solid black"></iframe> diff --git a/browser/base/content/test/contextMenu/subtst_contextmenu_webext.html b/browser/base/content/test/contextMenu/subtst_contextmenu_webext.html index ac3b5415dd..be45c2ddd0 100644 --- a/browser/base/content/test/contextMenu/subtst_contextmenu_webext.html +++ b/browser/base/content/test/contextMenu/subtst_contextmenu_webext.html @@ -7,6 +7,6 @@ <body> Browser context menu subtest. <a href="moz-extension://foo-bar/tab.html" id="link">Link to an extension resource</a> - <video src="moz-extension://foo-bar/video.ogg" id="video"></video> + <video src="moz-extension://foo-bar/video.webm" id="video"></video> </body> </html> diff --git a/browser/base/content/test/favicons/browser_favicon_change_not_in_document.js b/browser/base/content/test/favicons/browser_favicon_change_not_in_document.js index b8215dcc3e..85240aaa95 100644 --- a/browser/base/content/test/favicons/browser_favicon_change_not_in_document.js +++ b/browser/base/content/test/favicons/browser_favicon_change_not_in_document.js @@ -36,8 +36,8 @@ add_task(async function () { )); let domLinkAddedFired = 0; let domLinkChangedFired = 0; - const linkAddedHandler = event => domLinkAddedFired++; - const linkChangedhandler = event => domLinkChangedFired++; + const linkAddedHandler = () => domLinkAddedFired++; + const linkChangedhandler = () => domLinkChangedFired++; BrowserTestUtils.addContentEventListener( gBrowser.selectedBrowser, "DOMLinkAdded", @@ -80,8 +80,8 @@ add_task(async function () { let domLinkAddedFired = 0; let domLinkChangedFired = 0; - const linkAddedHandler = event => domLinkAddedFired++; - const linkChangedhandler = event => domLinkChangedFired++; + const linkAddedHandler = () => domLinkAddedFired++; + const linkChangedhandler = () => domLinkChangedFired++; BrowserTestUtils.addContentEventListener( browser, "DOMLinkAdded", diff --git a/browser/base/content/test/favicons/browser_favicon_load.js b/browser/base/content/test/favicons/browser_favicon_load.js index 10c2b8f24e..7b78ae494f 100644 --- a/browser/base/content/test/favicons/browser_favicon_load.js +++ b/browser/base/content/test/favicons/browser_favicon_load.js @@ -50,7 +50,7 @@ function FaviconObserver(aPageURI, aFaviconURL, aTailingEnabled) { } FaviconObserver.prototype = { - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { // Make sure that the topic is 'http-on-modify-request'. if (aTopic === "http-on-modify-request") { let httpChannel = aSubject.QueryInterface(Ci.nsIHttpChannel); diff --git a/browser/base/content/test/favicons/browser_favicon_nostore.js b/browser/base/content/test/favicons/browser_favicon_nostore.js index 3fec666bbe..c12c7a87cd 100644 --- a/browser/base/content/test/favicons/browser_favicon_nostore.js +++ b/browser/base/content/test/favicons/browser_favicon_nostore.js @@ -140,20 +140,17 @@ add_task(async function root_icon_stored() { response.write("<html>A page without icon</html>"); }); - let noStorePromise = TestUtils.topicObserved( - "http-on-stop-request", - (s, t, d) => { - let chan = s.QueryInterface(Ci.nsIHttpChannel); - return chan?.URI.spec == "http://www.nostore.com/favicon.ico"; - } - ).then(([chan]) => chan.isNoStoreResponse()); + let noStorePromise = TestUtils.topicObserved("http-on-stop-request", s => { + let chan = s.QueryInterface(Ci.nsIHttpChannel); + return chan?.URI.spec == "http://www.nostore.com/favicon.ico"; + }).then(([chan]) => chan.isNoStoreResponse()); await BrowserTestUtils.withNewTab( { gBrowser, url: "http://www.nostore.com/page", }, - async function (browser) { + async function () { await TestUtils.waitForCondition(async () => { let uri = await new Promise(resolve => PlacesUtils.favicons.getFaviconURLForPage( diff --git a/browser/base/content/test/favicons/browser_favicon_referer.js b/browser/base/content/test/favicons/browser_favicon_referer.js index ed332e7413..9fee9771b0 100644 --- a/browser/base/content/test/favicons/browser_favicon_referer.js +++ b/browser/base/content/test/favicons/browser_favicon_referer.js @@ -14,7 +14,7 @@ add_task(async function test_check_referrer_for_discovered_favicon() { async browser => { let referrerPromise = TestUtils.topicObserved( "http-on-modify-request", - (s, t, d) => { + s => { let chan = s.QueryInterface(Ci.nsIHttpChannel); return chan.URI.spec == "http://mochi.test:8888/favicon.ico"; } @@ -42,7 +42,7 @@ add_task( async browser => { let referrerPromise = TestUtils.topicObserved( "http-on-modify-request", - (s, t, d) => { + s => { let chan = s.QueryInterface(Ci.nsIHttpChannel); return chan.URI.spec == `${FOLDER}file_favicon.png`; } diff --git a/browser/base/content/test/favicons/browser_missing_favicon.js b/browser/base/content/test/favicons/browser_missing_favicon.js index f619425909..fd60d362b4 100644 --- a/browser/base/content/test/favicons/browser_missing_favicon.js +++ b/browser/base/content/test/favicons/browser_missing_favicon.js @@ -28,7 +28,7 @@ add_task(async () => { is(browser.mIconURL, null, "Should have blanked the icon."); is( gBrowser.getTabForBrowser(browser).getAttribute("image"), - "", + null, "Should have blanked the tab icon." ); } diff --git a/browser/base/content/test/forms/browser_selectpopup.js b/browser/base/content/test/forms/browser_selectpopup.js index abcdee486f..72112974c2 100644 --- a/browser/base/content/test/forms/browser_selectpopup.js +++ b/browser/base/content/test/forms/browser_selectpopup.js @@ -186,7 +186,7 @@ async function doSelectTests(contentType, content) { ); // Backspace should not go back - let handleKeyPress = function (event) { + let handleKeyPress = function () { ok(false, "Should not get keypress event"); }; window.addEventListener("keypress", handleKeyPress); @@ -708,7 +708,7 @@ add_task(async function test_mousemove_correcttarget() { window, "sizemodechange" ); - BrowserFullScreen(); + BrowserCommands.fullScreen(); await sizeModeChanged; await popupHiddenPromise; } diff --git a/browser/base/content/test/forms/browser_selectpopup_colors.js b/browser/base/content/test/forms/browser_selectpopup_colors.js index 63cece0ce5..f4b3e8a516 100644 --- a/browser/base/content/test/forms/browser_selectpopup_colors.js +++ b/browser/base/content/test/forms/browser_selectpopup_colors.js @@ -255,7 +255,7 @@ function rgbaToString(parsedColor) { return `rgba(${r}, ${g}, ${b}, ${a})`; } -function testOptionColors(test, index, item, menulist) { +function testOptionColors(test, index, item) { // The label contains a JSON string of the expected colors for // `color` and `background-color`. let expected = JSON.parse(item.label); diff --git a/browser/base/content/test/forms/browser_selectpopup_dir.js b/browser/base/content/test/forms/browser_selectpopup_dir.js index aaf4a61fc2..a0ad90d909 100644 --- a/browser/base/content/test/forms/browser_selectpopup_dir.js +++ b/browser/base/content/test/forms/browser_selectpopup_dir.js @@ -13,7 +13,7 @@ add_task(async function () { gBrowser, url, }, - async function (browser) { + async function () { let popup = await openSelectPopup("click"); is(popup.style.direction, "rtl", "Should be the right dir"); } diff --git a/browser/base/content/test/forms/browser_selectpopup_large.js b/browser/base/content/test/forms/browser_selectpopup_large.js index 722e0d9588..40f6d1b160 100644 --- a/browser/base/content/test/forms/browser_selectpopup_large.js +++ b/browser/base/content/test/forms/browser_selectpopup_large.js @@ -297,7 +297,7 @@ add_task(async function test_large_popup_in_small_window() { newWin, "resize", false, - e => { + () => { info(`Got resize event (innerHeight: ${newWin.innerHeight})`); return newWin.innerHeight <= 450; } diff --git a/browser/base/content/test/forms/browser_selectpopup_minFontSize.js b/browser/base/content/test/forms/browser_selectpopup_minFontSize.js index d240c2d2d0..522ed1ffcf 100644 --- a/browser/base/content/test/forms/browser_selectpopup_minFontSize.js +++ b/browser/base/content/test/forms/browser_selectpopup_minFontSize.js @@ -20,7 +20,7 @@ add_task(async function () { gBrowser, url, }, - async function (browser) { + async function () { let popup = await openSelectPopup("click"); let menuitems = popup.querySelectorAll("menuitem"); is( diff --git a/browser/base/content/test/forms/browser_selectpopup_text_transform.js b/browser/base/content/test/forms/browser_selectpopup_text_transform.js index 671f39e2a6..04da532ddc 100644 --- a/browser/base/content/test/forms/browser_selectpopup_text_transform.js +++ b/browser/base/content/test/forms/browser_selectpopup_text_transform.js @@ -16,7 +16,7 @@ add_task(async function () { gBrowser, url, }, - async function (browser) { + async function () { let popup = await openSelectPopup("click"); let menuitems = popup.querySelectorAll("menuitem"); is(menuitems[0].textContent, "abc", "Option text should be lowercase"); diff --git a/browser/base/content/test/forms/browser_selectpopup_user_input.js b/browser/base/content/test/forms/browser_selectpopup_user_input.js index b3cdeaf7e6..028ceadf9a 100644 --- a/browser/base/content/test/forms/browser_selectpopup_user_input.js +++ b/browser/base/content/test/forms/browser_selectpopup_user_input.js @@ -71,7 +71,7 @@ async function testHandlingUserInputOnChange(aTriggerFn) { // This test checks if the change/click event is considered as user input event. add_task(async function test_handling_user_input_key() { - return testHandlingUserInputOnChange(async function (popup) { + return testHandlingUserInputOnChange(async function () { EventUtils.synthesizeKey("KEY_ArrowDown"); await hideSelectPopup(); }); diff --git a/browser/base/content/test/forms/browser_selectpopup_width.js b/browser/base/content/test/forms/browser_selectpopup_width.js index d8f748fb18..0df0fd24ee 100644 --- a/browser/base/content/test/forms/browser_selectpopup_width.js +++ b/browser/base/content/test/forms/browser_selectpopup_width.js @@ -19,7 +19,7 @@ add_task(async function () { gBrowser, url, }, - async function (browser) { + async function () { let popup = await openSelectPopup("click"); let arrowSB = popup.shadowRoot.querySelector(".menupopup-arrowscrollbox"); is( diff --git a/browser/base/content/test/forms/browser_selectpopup_xhtml.js b/browser/base/content/test/forms/browser_selectpopup_xhtml.js index 091649be89..27597eb5ac 100644 --- a/browser/base/content/test/forms/browser_selectpopup_xhtml.js +++ b/browser/base/content/test/forms/browser_selectpopup_xhtml.js @@ -21,7 +21,7 @@ add_task(async function () { gBrowser, url, }, - async function (browser) { + async function () { let popup = await openSelectPopup("click"); let menuitems = popup.querySelectorAll("menuitem"); is(menuitems.length, 2, "Should've properly detected two menu items"); diff --git a/browser/base/content/test/fullscreen/browser_fullscreen_context_menu.js b/browser/base/content/test/fullscreen/browser_fullscreen_context_menu.js index 9d9891acd2..3bca1a205d 100644 --- a/browser/base/content/test/fullscreen/browser_fullscreen_context_menu.js +++ b/browser/base/content/test/fullscreen/browser_fullscreen_context_menu.js @@ -51,7 +51,7 @@ async function testContextMenu() { window, "sizemodechange", false, - e => window.fullScreen + () => window.fullScreen ), BrowserTestUtils.waitForPopupEvent(contextMenu, "hidden"), ]); @@ -96,7 +96,7 @@ async function testContextMenu() { window, "sizemodechange", false, - e => !window.fullScreen + () => !window.fullScreen ), BrowserTestUtils.waitForPopupEvent(contextMenu2, "hidden"), ]); diff --git a/browser/base/content/test/fullscreen/browser_fullscreen_window_focus.js b/browser/base/content/test/fullscreen/browser_fullscreen_window_focus.js index 5dd71e1a92..6e471e8124 100644 --- a/browser/base/content/test/fullscreen/browser_fullscreen_window_focus.js +++ b/browser/base/content/test/fullscreen/browser_fullscreen_window_focus.js @@ -74,7 +74,7 @@ async function testWindowElementFocus(isPopup) { false, async () => { info("Calling element.focus() on popup"); - await ContentTask.spawn(tab.linkedBrowser, {}, async args => { + await ContentTask.spawn(tab.linkedBrowser, {}, async () => { await content.wrappedJSObject.sendMessage( content.wrappedJSObject.openedWindow, "elementfocus" diff --git a/browser/base/content/test/fullscreen/head.js b/browser/base/content/test/fullscreen/head.js index 4d5543461e..0d56c5a7c9 100644 --- a/browser/base/content/test/fullscreen/head.js +++ b/browser/base/content/test/fullscreen/head.js @@ -5,7 +5,7 @@ function waitForFullScreenState(browser, state, actionAfterFSEvent) { return new Promise(resolve => { let eventReceived = false; - let observe = (subject, topic, data) => { + let observe = () => { if (!eventReceived) { return; } diff --git a/browser/base/content/test/general/browser.toml b/browser/base/content/test/general/browser.toml index 6928ba2d4b..31d519d550 100644 --- a/browser/base/content/test/general/browser.toml +++ b/browser/base/content/test/general/browser.toml @@ -37,10 +37,6 @@ support-files = [ "title_test.svg", "unknownContentType_file.pif", "unknownContentType_file.pif^headers^", - "video.ogg", - "web_video.html", - "web_video1.ogv", - "web_video1.ogv^headers^", "!/image/test/mochitest/blue.png", "!/toolkit/content/tests/browser/common/mockTransfer.js", ] @@ -211,6 +207,7 @@ support-files = [ "dummy.ics", "dummy.ics^headers^", "redirect_download.sjs", + "video.webm", ] # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. @@ -435,9 +432,19 @@ skip-if = [ "os == 'win' && debug", "os =='linux'", #Bug 1212419 ] +support-files = [ + "web_video.html", + "web_video1.webm", + "web_video1.webm^headers^", +] # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. ["browser_save_video_frame.js"] +support-files = [ + "web_video.html", + "web_video1.webm", + "web_video1.webm^headers^", +] # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. ["browser_selectTabAtIndex.js"] diff --git a/browser/base/content/test/general/browser_accesskeys.js b/browser/base/content/test/general/browser_accesskeys.js index 0809553404..965da8d9df 100644 --- a/browser/base/content/test/general/browser_accesskeys.js +++ b/browser/base/content/test/general/browser_accesskeys.js @@ -122,7 +122,7 @@ add_task(async function () { function performAccessKey(browser, key) { return new Promise(resolve => { let removeFocus, removeKeyDown, removeKeyUp; - function callback(eventName, result) { + function callback() { removeFocus(); removeKeyUp(); removeKeyDown(); @@ -190,7 +190,7 @@ function performAccessKey(browser, key) { } // This version is used when a chrome element is expected to be found for an accesskey. -async function performAccessKeyForChrome(key, inChild) { +async function performAccessKeyForChrome(key) { let waitFocusChangePromise = BrowserTestUtils.waitForEvent( document, "focus", diff --git a/browser/base/content/test/general/browser_alltabslistener.js b/browser/base/content/test/general/browser_alltabslistener.js index c7829d16fe..fc950d6ce5 100644 --- a/browser/base/content/test/general/browser_alltabslistener.js +++ b/browser/base/content/test/general/browser_alltabslistener.js @@ -7,16 +7,9 @@ function getOriginalURL(request) { } var gFrontProgressListener = { - onProgressChange( - aWebProgress, - aRequest, - aCurSelfProgress, - aMaxSelfProgress, - aCurTotalProgress, - aMaxTotalProgress - ) {}, + onProgressChange() {}, - onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aWebProgress, aRequest, aStateFlags) { var url = getOriginalURL(aRequest); if (url == "about:blank") { return; @@ -28,7 +21,7 @@ var gFrontProgressListener = { assertCorrectBrowserAndEventOrderForFront(state); }, - onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) { + onLocationChange(aWebProgress, aRequest, aLocationURI) { var url = getOriginalURL(aRequest); if (url == "about:blank") { return; @@ -64,7 +57,7 @@ function assertCorrectBrowserAndEventOrderForFront(aEventName) { } var gAllProgressListener = { - onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags) { var url = getOriginalURL(aRequest); if (url == "about:blank") { // ignore initial about blank diff --git a/browser/base/content/test/general/browser_beforeunload_duplicate_dialogs.js b/browser/base/content/test/general/browser_beforeunload_duplicate_dialogs.js index 8eb07a863a..81ed5a1040 100644 --- a/browser/base/content/test/general/browser_beforeunload_duplicate_dialogs.js +++ b/browser/base/content/test/general/browser_beforeunload_duplicate_dialogs.js @@ -57,7 +57,7 @@ add_task(async function closeWindowWithMultipleTabsIncludingOneBeforeUnload() { ); let windowClosedPromise = BrowserTestUtils.domWindowClosed(newWin); expectingDialog = true; - newWin.BrowserTryToCloseWindow(); + newWin.BrowserCommands.tryToCloseWindow(); await windowClosedPromise; ok(!expectingDialog, "There should have been a dialog."); ok(newWin.closed, "Window should be closed."); @@ -71,7 +71,7 @@ add_task(async function closeWindoWithSingleTabTwice() { let windowClosedPromise = BrowserTestUtils.domWindowClosed(newWin); expectingDialog = true; wantToClose = false; - let firstDialogShownPromise = new Promise((resolve, reject) => { + let firstDialogShownPromise = new Promise(resolve => { resolveDialogPromise = resolve; }); firstTab.closeButton.click(); diff --git a/browser/base/content/test/general/browser_bug356571.js b/browser/base/content/test/general/browser_bug356571.js index aa3569c93d..69b45e040d 100644 --- a/browser/base/content/test/general/browser_bug356571.js +++ b/browser/base/content/test/general/browser_bug356571.js @@ -45,7 +45,7 @@ const kURIs = ["bad://www.mozilla.org/", kDummyPage, kDummyPage]; var gProgressListener = { _runCount: 0, - onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags) { if ((aStateFlags & kCompleteState) == kCompleteState) { if (++this._runCount != kURIs.length) { return; diff --git a/browser/base/content/test/general/browser_bug417483.js b/browser/base/content/test/general/browser_bug417483.js index 68e2e99511..28da91eea1 100644 --- a/browser/base/content/test/general/browser_bug417483.js +++ b/browser/base/content/test/general/browser_bug417483.js @@ -8,7 +8,7 @@ add_task(async function () { BrowserTestUtils.startLoadingURIString(gBrowser, htmlContent); await loadedPromise; - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function (arg) { + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () { let frame = content.frames[0]; let sel = frame.getSelection(); let range = frame.document.createRange(); diff --git a/browser/base/content/test/general/browser_bug537013.js b/browser/base/content/test/general/browser_bug537013.js index 5c871a759c..58bcec9754 100644 --- a/browser/base/content/test/general/browser_bug537013.js +++ b/browser/base/content/test/general/browser_bug537013.js @@ -15,7 +15,7 @@ var HasFindClipboard = Services.clipboard.isClipboardTypeSupported( Services.clipboard.kFindClipboard ); -function addTabWithText(aText, aCallback) { +function addTabWithText(aText) { let newTab = BrowserTestUtils.addTab( gBrowser, "data:text/html;charset=utf-8,<h1 id='h1'>" + aText + "</h1>" diff --git a/browser/base/content/test/general/browser_bug565575.js b/browser/base/content/test/general/browser_bug565575.js index 6176c537e3..b974b17205 100644 --- a/browser/base/content/test/general/browser_bug565575.js +++ b/browser/base/content/test/general/browser_bug565575.js @@ -3,7 +3,7 @@ add_task(async function () { await BrowserTestUtils.openNewForegroundTab( gBrowser, - () => BrowserOpenTab(), + () => BrowserCommands.openTab(), false ); ok(gURLBar.focused, "location bar is focused for a new tab"); diff --git a/browser/base/content/test/general/browser_bug567306.js b/browser/base/content/test/general/browser_bug567306.js index 3d3e47e17d..24280371d8 100644 --- a/browser/base/content/test/general/browser_bug567306.js +++ b/browser/base/content/test/general/browser_bug567306.js @@ -10,7 +10,7 @@ add_task(async function () { let newwindow = await BrowserTestUtils.openNewBrowserWindow(); let selectedBrowser = newwindow.gBrowser.selectedBrowser; - await new Promise((resolve, reject) => { + await new Promise(resolve => { BrowserTestUtils.waitForContentEvent( selectedBrowser, "pageshow", diff --git a/browser/base/content/test/general/browser_bug609700.js b/browser/base/content/test/general/browser_bug609700.js index 8195eba4ec..615b63c3d8 100644 --- a/browser/base/content/test/general/browser_bug609700.js +++ b/browser/base/content/test/general/browser_bug609700.js @@ -1,11 +1,7 @@ function test() { waitForExplicitFinish(); - Services.ww.registerNotification(function notification( - aSubject, - aTopic, - aData - ) { + Services.ww.registerNotification(function notification(aSubject, aTopic) { if (aTopic == "domwindowopened") { Services.ww.unregisterNotification(notification); diff --git a/browser/base/content/test/general/browser_bug623893.js b/browser/base/content/test/general/browser_bug623893.js index 79cd10c591..0f742a8e8e 100644 --- a/browser/base/content/test/general/browser_bug623893.js +++ b/browser/base/content/test/general/browser_bug623893.js @@ -38,7 +38,7 @@ async function promiseGetIndex(browser) { return shistory.index; } -let duplicate = async function (delta, msg, cb) { +let duplicate = async function (delta, msg) { var startIndex = await promiseGetIndex(gBrowser.selectedBrowser); duplicateTabIn(gBrowser.selectedTab, "tab", delta); diff --git a/browser/base/content/test/general/browser_bug676619.js b/browser/base/content/test/general/browser_bug676619.js index 80bbce8cb0..90dd8f4f7c 100644 --- a/browser/base/content/test/general/browser_bug676619.js +++ b/browser/base/content/test/general/browser_bug676619.js @@ -22,7 +22,7 @@ function waitForNewWindow() { var domwindow = aXULWindow.docShell.domWindow; domwindow.addEventListener("load", downloadOnLoad, true); }, - onCloseWindow: aXULWindow => {}, + onCloseWindow: () => {}, }; Services.wm.addListener(listener); @@ -97,7 +97,7 @@ async function testLink(link, name) { } // Cross-origin URL does not trigger a download -async function testLocation(link, url) { +async function testLocation(link) { let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser); SpecialPowers.spawn(gBrowser.selectedBrowser, [link], contentLink => { @@ -116,8 +116,8 @@ async function runTest(url) { await BrowserTestUtils.browserLoaded(browser); await testLink("link1", "test.txt"); - await testLink("link2", "video.ogg"); - await testLink("link3", "just some video.ogg"); + await testLink("link2", "video.webm"); + await testLink("link3", "just some video.webm"); await testLink("link4", "with-target.txt"); await testLink("link5", "javascript.html"); await testLink("link6", "test.blob"); @@ -132,8 +132,8 @@ async function runTest(url) { // Check that we enforce the correct extension if the website's // is bogus or missing. These extensions can differ slightly (ogx vs ogg, // htm vs html) on different OSes. - let oggExtension = getMIMEInfoForType("application/ogg").primaryExtension; - await testLink("link13", "no file extension." + oggExtension); + let webmExtension = getMIMEInfoForType("video/webm").primaryExtension; + await testLink("link13", "no file extension." + webmExtension); // See https://bugzilla.mozilla.org/show_bug.cgi?id=1690051#c8 if (AppConstants.platform != "win") { diff --git a/browser/base/content/test/general/browser_bug734076.js b/browser/base/content/test/general/browser_bug734076.js index bd86f8e2b3..e9bec6834e 100644 --- a/browser/base/content/test/general/browser_bug734076.js +++ b/browser/base/content/test/general/browser_bug734076.js @@ -36,7 +36,7 @@ add_task(async function () { ); }, verify(browser) { - return SpecialPowers.spawn(browser, [], async function (arg) { + return SpecialPowers.spawn(browser, [], async function () { Assert.equal( content.document.body.textContent, "", @@ -67,7 +67,7 @@ add_task(async function () { ); }, verify(browser) { - return SpecialPowers.spawn(browser, [], async function (arg) { + return SpecialPowers.spawn(browser, [], async function () { Assert.equal( content.document.body.textContent, "", @@ -105,7 +105,7 @@ add_task(async function () { ); }, verify(browser) { - return SpecialPowers.spawn(browser, [], async function (arg) { + return SpecialPowers.spawn(browser, [], async function () { Assert.equal( content.document.body.textContent, "", diff --git a/browser/base/content/test/general/browser_bug763468_perwindowpb.js b/browser/base/content/test/general/browser_bug763468_perwindowpb.js index bed03561ca..05a7f90550 100644 --- a/browser/base/content/test/general/browser_bug763468_perwindowpb.js +++ b/browser/base/content/test/general/browser_bug763468_perwindowpb.js @@ -44,7 +44,7 @@ add_task(async function testPBNewTab() { async function openNewTab(aWindow, aExpectedURL) { // Open a new tab - aWindow.BrowserOpenTab(); + aWindow.BrowserCommands.openTab(); let browser = aWindow.gBrowser.selectedBrowser; // We're already loaded. diff --git a/browser/base/content/test/general/browser_bug767836_perwindowpb.js b/browser/base/content/test/general/browser_bug767836_perwindowpb.js index 7fcc6ad565..e237f1216d 100644 --- a/browser/base/content/test/general/browser_bug767836_perwindowpb.js +++ b/browser/base/content/test/general/browser_bug767836_perwindowpb.js @@ -59,7 +59,7 @@ add_task(async function test_newTabService() { async function openNewTab(aWindow, aExpectedURL) { // Open a new tab - aWindow.BrowserOpenTab(); + aWindow.BrowserCommands.openTab(); let browser = aWindow.gBrowser.selectedBrowser; // We're already loaded. diff --git a/browser/base/content/test/general/browser_bug817947.js b/browser/base/content/test/general/browser_bug817947.js index ea3c39222e..f83e07a9af 100644 --- a/browser/base/content/test/general/browser_bug817947.js +++ b/browser/base/content/test/general/browser_bug817947.js @@ -32,7 +32,7 @@ add_task(async () => { win.close(); }); -async function preparePendingTab(aCallback) { +async function preparePendingTab() { let tab = BrowserTestUtils.addTab(gBrowser, URL); await BrowserTestUtils.browserLoaded(tab.linkedBrowser); diff --git a/browser/base/content/test/general/browser_clipboard.js b/browser/base/content/test/general/browser_clipboard.js index a4c823969f..7820c4ec89 100644 --- a/browser/base/content/test/general/browser_clipboard.js +++ b/browser/base/content/test/general/browser_clipboard.js @@ -68,7 +68,7 @@ add_task(async function () { let selection = content.document.getSelection(); selection.modify("move", "right", "line"); - return new Promise((resolve, reject) => { + return new Promise(resolve => { content.addEventListener( "paste", event => { @@ -130,7 +130,7 @@ add_task(async function () { selection.modify("extend", "left", "word"); selection.modify("extend", "left", "character"); - return new Promise((resolve, reject) => { + return new Promise(resolve => { content.addEventListener( "cut", event => { @@ -157,7 +157,7 @@ add_task(async function () { let selection = content.document.getSelection(); selection.modify("move", "left", "line"); - return new Promise((resolve, reject) => { + return new Promise(resolve => { content.addEventListener( "paste", event => { diff --git a/browser/base/content/test/general/browser_clipboard_pastefile.js b/browser/base/content/test/general/browser_clipboard_pastefile.js index f034883ef2..6ef3edf30e 100644 --- a/browser/base/content/test/general/browser_clipboard_pastefile.js +++ b/browser/base/content/test/general/browser_clipboard_pastefile.js @@ -50,7 +50,7 @@ add_task(async function () { ); let browser = tab.linkedBrowser; - let resultPromise = SpecialPowers.spawn(browser, [], function (arg) { + let resultPromise = SpecialPowers.spawn(browser, [], function () { return new Promise(resolve => { content.document.addEventListener("testresult", event => { resolve(event.detail.result); @@ -73,7 +73,7 @@ add_task(async function () { document.documentElement.appendChild(input); input.focus(); - await new Promise((resolve, reject) => { + await new Promise(resolve => { input.addEventListener( "paste", function (event) { diff --git a/browser/base/content/test/general/browser_domFullscreen_fullscreenMode.js b/browser/base/content/test/general/browser_domFullscreen_fullscreenMode.js index c96fa6cf7b..f44620c29e 100644 --- a/browser/base/content/test/general/browser_domFullscreen_fullscreenMode.js +++ b/browser/base/content/test/general/browser_domFullscreen_fullscreenMode.js @@ -149,7 +149,7 @@ add_task(async function () { gBrowser.selectedBrowser, FS_CHANGE_SIZE ); - executeSoon(() => BrowserFullScreen()); + executeSoon(() => BrowserCommands.fullScreen()); await fullscreenPromise; } }); @@ -195,7 +195,7 @@ add_task(async function () { // dispatched synchronously, which would cause the event listener // miss that event and wait infinitely. fullscreenPromise = waitForFullscreenChanges(browser, FS_CHANGE_SIZE); - executeSoon(() => BrowserFullScreen()); + executeSoon(() => BrowserCommands.fullScreen()); contentStates = await fullscreenPromise; checkState({ inDOMFullscreen: false, inFullscreen: true }, contentStates); @@ -228,7 +228,7 @@ add_task(async function () { if (window.fullScreen) { info("> Cleanup"); fullscreenPromise = waitForFullscreenChanges(browser, FS_CHANGE_SIZE); - executeSoon(() => BrowserFullScreen()); + executeSoon(() => BrowserCommands.fullScreen()); await fullscreenPromise; } } diff --git a/browser/base/content/test/general/browser_double_close_tab.js b/browser/base/content/test/general/browser_double_close_tab.js index f5f2f1b6c7..6beea0f42b 100644 --- a/browser/base/content/test/general/browser_double_close_tab.js +++ b/browser/base/content/test/general/browser_double_close_tab.js @@ -18,7 +18,7 @@ function waitForDialog(callback) { function waitForDialogDestroyed(node, callback) { // Now listen for the dialog going away again... - let observer = new MutationObserver(function (muts) { + let observer = new MutationObserver(function () { if (!node.parentNode) { ok(true, "Dialog is gone"); done(); diff --git a/browser/base/content/test/general/browser_focusonkeydown.js b/browser/base/content/test/general/browser_focusonkeydown.js index 9cf1f113f5..53919bc1b3 100644 --- a/browser/base/content/test/general/browser_focusonkeydown.js +++ b/browser/base/content/test/general/browser_focusonkeydown.js @@ -20,7 +20,7 @@ add_task(async function () { gURLBar.addEventListener( "keydown", - function (event) { + function () { gBrowser.selectedBrowser.focus(); }, { capture: true, once: true } diff --git a/browser/base/content/test/general/browser_fullscreen-window-open.js b/browser/base/content/test/general/browser_fullscreen-window-open.js index 2b21e34e92..be1d2ca3a3 100644 --- a/browser/base/content/test/general/browser_fullscreen-window-open.js +++ b/browser/base/content/test/general/browser_fullscreen-window-open.js @@ -26,14 +26,14 @@ async function test() { await promiseTabLoadEvent(newBrowser.selectedTab, gHttpTestRoot + TEST_FILE); // Enter browser fullscreen mode. - newWin.BrowserFullScreen(); + newWin.BrowserCommands.fullScreen(); runNextTest(); } registerCleanupFunction(async function () { // Exit browser fullscreen mode. - newWin.BrowserFullScreen(); + newWin.BrowserCommands.fullScreen(); await BrowserTestUtils.closeWindow(newWin); @@ -336,7 +336,7 @@ WindowListener.prototype = { Services.wm.removeListener(this); let domwindow = aXULWindow.docShell.domWindow; - let onLoad = aEvent => { + let onLoad = () => { is( domwindow.document.location.href, this.test_url, @@ -361,6 +361,6 @@ WindowListener.prototype = { }; domwindow.addEventListener("load", onLoad, true); }, - onCloseWindow(aXULWindow) {}, + onCloseWindow() {}, QueryInterface: ChromeUtils.generateQI(["nsIWindowMediatorListener"]), }; diff --git a/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js b/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js index 1624a1514d..fae1130685 100644 --- a/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js +++ b/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js @@ -33,7 +33,7 @@ add_task(async function checkBackFromInvalidURI() { false, // Be paranoid we *are* actually seeing this other page load, not some kind of race // for if/when we do start firing pageshow for the error page... - function (e) { + function () { return gBrowser.currentURI.spec == "about:robots"; } ); diff --git a/browser/base/content/test/general/browser_newWindowDrop.js b/browser/base/content/test/general/browser_newWindowDrop.js index 3e41b0d6ac..445999befd 100644 --- a/browser/base/content/test/general/browser_newWindowDrop.js +++ b/browser/base/content/test/general/browser_newWindowDrop.js @@ -184,7 +184,7 @@ function dropText(text, expectedURLs, ignoreFirstWindow = false) { ); } -async function drop(dragData, expectedURLs, ignoreFirstWindow = false) { +async function drop(dragData, expectedURLs) { let dragDataString = JSON.stringify(dragData); info( `Starting test for dragData:${dragDataString}; expectedURLs.length:${expectedURLs.length}` diff --git a/browser/base/content/test/general/browser_plainTextLinks.js b/browser/base/content/test/general/browser_plainTextLinks.js index 706f21387c..44c9b8422b 100644 --- a/browser/base/content/test/general/browser_plainTextLinks.js +++ b/browser/base/content/test/general/browser_plainTextLinks.js @@ -19,7 +19,7 @@ add_task(async function () { await SimpleTest.promiseFocus(gBrowser.selectedBrowser); // Initial setup of the content area. - await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function (arg) { + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () { let doc = content.document; let range = doc.createRange(); let selection = content.getSelection(); diff --git a/browser/base/content/test/general/browser_private_no_prompt.js b/browser/base/content/test/general/browser_private_no_prompt.js index d8c9f8e7b5..80ba0ca746 100644 --- a/browser/base/content/test/general/browser_private_no_prompt.js +++ b/browser/base/content/test/general/browser_private_no_prompt.js @@ -3,8 +3,8 @@ function test() { var privateWin = OpenBrowserWindow({ private: true }); whenDelayedStartupFinished(privateWin, function () { - privateWin.BrowserOpenTab(); - privateWin.BrowserTryToCloseWindow(); + privateWin.BrowserCommands.openTab(); + privateWin.BrowserCommands.tryToCloseWindow(); ok(true, "didn't prompt"); executeSoon(finish); diff --git a/browser/base/content/test/general/browser_remoteTroubleshoot.js b/browser/base/content/test/general/browser_remoteTroubleshoot.js index 84722b2603..55627f0b28 100644 --- a/browser/base/content/test/general/browser_remoteTroubleshoot.js +++ b/browser/base/content/test/general/browser_remoteTroubleshoot.js @@ -19,9 +19,9 @@ const TEST_URI_GOOD_OBJECT = Services.io.newURI( // Creates a one-shot web-channel for the test data to be sent back from the test page. function promiseChannelResponse(channelID, originOrPermission) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let channel = new WebChannel(channelID, originOrPermission); - channel.listen((id, data, target) => { + channel.listen((id, data) => { channel.stopListening(); resolve(data); }); diff --git a/browser/base/content/test/general/browser_save_link-perwindowpb.js b/browser/base/content/test/general/browser_save_link-perwindowpb.js index d5a0eef86c..29fd54d2d9 100644 --- a/browser/base/content/test/general/browser_save_link-perwindowpb.js +++ b/browser/base/content/test/general/browser_save_link-perwindowpb.js @@ -68,7 +68,7 @@ function triggerSave(aWindow, aCallback) { info("popup hidden"); } - function onTransferComplete(aWindow2, downloadSuccess, destDir) { + function onTransferComplete(aWindow2, downloadSuccess) { ok(downloadSuccess, "Link should have been downloaded successfully"); aWindow2.close(); @@ -118,7 +118,7 @@ function test() { info("Finished running the cleanup code"); }); - function observer(subject, topic, state) { + function observer(subject, topic) { info("observer called with " + topic); if (topic == "http-on-modify-request") { onModifyRequest(subject); diff --git a/browser/base/content/test/general/browser_save_link_when_window_navigates.js b/browser/base/content/test/general/browser_save_link_when_window_navigates.js index 1c68b91ddf..e5c7fa76b2 100644 --- a/browser/base/content/test/general/browser_save_link_when_window_navigates.js +++ b/browser/base/content/test/general/browser_save_link_when_window_navigates.js @@ -70,7 +70,7 @@ function triggerSave(aWindow, aCallback) { info("done mockTransferCallback"); }; - function onUCTDialog(dialog) { + function onUCTDialog() { SpecialPowers.spawn(testBrowser, [], async () => { content.document.querySelector("iframe").remove(); }).then(() => executeSoon(continueDownloading)); @@ -104,7 +104,7 @@ var windowObserver = { } this._callback = aCallback; }, - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic != "domwindowopened") { return; } @@ -113,7 +113,7 @@ var windowObserver = { win.addEventListener( "load", - function (event) { + function () { if (win.location == UCT_URI) { SimpleTest.executeSoon(function () { if (windowObserver._callback) { diff --git a/browser/base/content/test/general/browser_save_private_link_perwindowpb.js b/browser/base/content/test/general/browser_save_private_link_perwindowpb.js index 42632bdc5a..1312c7b954 100644 --- a/browser/base/content/test/general/browser_save_private_link_perwindowpb.js +++ b/browser/base/content/test/general/browser_save_private_link_perwindowpb.js @@ -12,9 +12,9 @@ function createTemporarySaveDirectory() { } function promiseNoCacheEntry(filename) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { Visitor.prototype = { - onCacheStorageInfo(num, consumption) { + onCacheStorageInfo(num) { info("disk storage contains " + num + " entries"); }, onCacheEntryInfo(uri) { @@ -40,7 +40,7 @@ function promiseNoCacheEntry(filename) { } function promiseImageDownloaded() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let fileName; let MockFilePicker = SpecialPowers.MockFilePicker; MockFilePicker.init(window.browsingContext); diff --git a/browser/base/content/test/general/browser_save_video.js b/browser/base/content/test/general/browser_save_video.js index d8dc5c6e2e..f0450ac1fa 100644 --- a/browser/base/content/test/general/browser_save_video.js +++ b/browser/base/content/test/general/browser_save_video.js @@ -52,7 +52,7 @@ add_task(async function () { is( fileName, - "web-video1-expectedName.ogv", + "web-video1-expectedName.webm", "Video file name is correctly retrieved from Content-Disposition http header" ); resolve(); diff --git a/browser/base/content/test/general/browser_tabfocus.js b/browser/base/content/test/general/browser_tabfocus.js index b057a504e5..7cc9158084 100644 --- a/browser/base/content/test/general/browser_tabfocus.js +++ b/browser/base/content/test/general/browser_tabfocus.js @@ -322,7 +322,7 @@ add_task(async function () { "tab change when selected tab element was focused" ); - let switchWaiter = new Promise((resolve, reject) => { + let switchWaiter = new Promise(resolve => { gBrowser.addEventListener( "TabSwitchDone", function () { @@ -516,7 +516,7 @@ add_task(async function () { // now go back again gURLBar.focus(); - await new Promise((resolve, reject) => { + await new Promise(resolve => { BrowserTestUtils.waitForContentEvent( window.gBrowser.selectedBrowser, "pageshow", diff --git a/browser/base/content/test/general/browser_tabs_owner.js b/browser/base/content/test/general/browser_tabs_owner.js index 4a32da12f1..e214b861e8 100644 --- a/browser/base/content/test/general/browser_tabs_owner.js +++ b/browser/base/content/test/general/browser_tabs_owner.js @@ -8,13 +8,13 @@ function test() { is(gBrowser.tabs.length, 4, "4 tabs are open"); owner = gBrowser.selectedTab = gBrowser.tabs[2]; - BrowserOpenTab(); + BrowserCommands.openTab(); is(gBrowser.selectedTab, gBrowser.tabs[4], "newly opened tab is selected"); gBrowser.removeCurrentTab(); is(gBrowser.selectedTab, owner, "owner is selected"); owner = gBrowser.selectedTab; - BrowserOpenTab(); + BrowserCommands.openTab(); gBrowser.selectedTab = gBrowser.tabs[1]; gBrowser.selectedTab = gBrowser.tabs[4]; gBrowser.removeCurrentTab(); @@ -25,7 +25,7 @@ function test() { ); owner = gBrowser.selectedTab; - BrowserOpenTab(); + BrowserCommands.openTab(); gBrowser.moveTabTo(gBrowser.selectedTab, 0); gBrowser.removeCurrentTab(); is( diff --git a/browser/base/content/test/general/browser_viewSourceInTabOnViewSource.js b/browser/base/content/test/general/browser_viewSourceInTabOnViewSource.js index 6c62670e6f..26c040324a 100644 --- a/browser/base/content/test/general/browser_viewSourceInTabOnViewSource.js +++ b/browser/base/content/test/general/browser_viewSourceInTabOnViewSource.js @@ -1,7 +1,7 @@ function wait_while_tab_is_busy() { return new Promise(resolve => { let progressListener = { - onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aWebProgress, aRequest, aStateFlags) { if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) { gBrowser.removeProgressListener(this); setTimeout(resolve, 0); @@ -27,7 +27,7 @@ var with_new_tab_opened = async function (options, taskFn) { }; add_task(async function test_regular_page() { - function test_expect_view_source_enabled(browser) { + function test_expect_view_source_enabled() { for (let element of [...XULBrowserWindow._elementsForViewSource]) { ok(!element.hasAttribute("disabled"), "View Source should be enabled"); } @@ -44,7 +44,7 @@ add_task(async function test_regular_page() { }); add_task(async function test_view_source_page() { - function test_expect_view_source_disabled(browser) { + function test_expect_view_source_disabled() { for (let element of [...XULBrowserWindow._elementsForViewSource]) { ok(element.hasAttribute("disabled"), "View Source should be disabled"); } diff --git a/browser/base/content/test/general/browser_zbug569342.js b/browser/base/content/test/general/browser_zbug569342.js index 4aa6bfbb9c..0c30ff3d1d 100644 --- a/browser/base/content/test/general/browser_zbug569342.js +++ b/browser/base/content/test/general/browser_zbug569342.js @@ -57,7 +57,7 @@ function testFindDisabled(url) { } async function testFindEnabled(url) { - return BrowserTestUtils.withNewTab(url, async function (browser) { + return BrowserTestUtils.withNewTab(url, async function () { ok( !document.getElementById("cmd_find").getAttribute("disabled"), "Find command should not be disabled" diff --git a/browser/base/content/test/general/download_page.html b/browser/base/content/test/general/download_page.html index 300bacdb72..625ff46aab 100644 --- a/browser/base/content/test/general/download_page.html +++ b/browser/base/content/test/general/download_page.html @@ -13,10 +13,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=676619 <ul> <li><a href="download_page_1.txt" download="test.txt" id="link1">Download "test.txt"</a></li> - <li><a href="video.ogg" - download id="link2">Download "video.ogg"</a></li> - <li><a href="video.ogg" - download="just some video.ogg" id="link3">Download "just some video.ogg"</a></li> + <li><a href="video.webm" + download id="link2">Download "video.webm"</a></li> + <li><a href="video.webm" + download="just some video.webm" id="link3">Download "just some video.webm"</a></li> <li><a href="download_page_2.txt" download="with-target.txt" id="link4">Download "with-target.txt"</a></li> <li><a href="javascript:(1+2)+''" @@ -33,7 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=676619 download="download_page_4.txt" id="link11">Download "download_page_4.txt"</a></li> <li><a href="http://example.com/" download="example.com" id="link12" target="_blank">Download "example.com"</a></li> - <li><a href="video.ogg" + <li><a href="video.webm" download="no file extension" id="link13">Download "force extension"</a></li> <li><a href="dummy.ics" download="dummy.not-ics" id="link14">Download "dummy.not-ics"</a></li> @@ -64,7 +64,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=676619 "wrong-file-name", {type: "application/x-some-file"})); document.getElementById("link7").href = fileURL; - window.addEventListener("beforeunload", function(evt) { + window.addEventListener("beforeunload", function() { document.getElementById("unload-flag").textContent = "Fail"; }); </script> diff --git a/browser/base/content/test/general/head.js b/browser/base/content/test/general/head.js index f7b4a0d93b..94f60f2936 100644 --- a/browser/base/content/test/general/head.js +++ b/browser/base/content/test/general/head.js @@ -165,7 +165,7 @@ function promiseOpenAndLoadWindow(aOptions, aWaitForDelayedStartup = false) { return new Promise(resolve => { let win = OpenBrowserWindow(aOptions); if (aWaitForDelayedStartup) { - Services.obs.addObserver(function onDS(aSubject, aTopic, aData) { + Services.obs.addObserver(function onDS(aSubject) { if (aSubject != win) { return; } @@ -185,7 +185,7 @@ function promiseOpenAndLoadWindow(aOptions, aWaitForDelayedStartup = false) { } async function whenNewTabLoaded(aWindow, aCallback) { - aWindow.BrowserOpenTab(); + aWindow.BrowserCommands.openTab(); let expectedURL = AboutNewTab.newTabURL; let browser = aWindow.gBrowser.selectedBrowser; diff --git a/browser/base/content/test/general/video.ogg b/browser/base/content/test/general/video.ogg Binary files differdeleted file mode 100644 index ac7ece3519..0000000000 --- a/browser/base/content/test/general/video.ogg +++ /dev/null diff --git a/browser/base/content/test/general/video.webm b/browser/base/content/test/general/video.webm Binary files differnew file mode 100644 index 0000000000..0ca38d3cf0 --- /dev/null +++ b/browser/base/content/test/general/video.webm diff --git a/browser/base/content/test/general/web_video.html b/browser/base/content/test/general/web_video.html index 467fb0ce1c..e03c85d1dc 100644 --- a/browser/base/content/test/general/web_video.html +++ b/browser/base/content/test/general/web_video.html @@ -5,6 +5,6 @@ <body> This document has some web video in it. <br> - <video src="web_video1.ogv" id="video1"> </video> + <video src="web_video1.webm" id="video1"> </video> </body> </html> diff --git a/browser/base/content/test/general/web_video1.ogv b/browser/base/content/test/general/web_video1.ogv Binary files differdeleted file mode 100644 index 093158432a..0000000000 --- a/browser/base/content/test/general/web_video1.ogv +++ /dev/null diff --git a/browser/base/content/test/general/web_video1.ogv^headers^ b/browser/base/content/test/general/web_video1.ogv^headers^ deleted file mode 100644 index 4511e92552..0000000000 --- a/browser/base/content/test/general/web_video1.ogv^headers^ +++ /dev/null @@ -1,3 +0,0 @@ -Content-Disposition: filename="web-video1-expectedName.ogv" -Content-Type: video/ogg - diff --git a/browser/base/content/test/general/web_video1.webm b/browser/base/content/test/general/web_video1.webm Binary files differnew file mode 100644 index 0000000000..2c9d7dad8d --- /dev/null +++ b/browser/base/content/test/general/web_video1.webm diff --git a/browser/base/content/test/general/web_video1.webm^headers^ b/browser/base/content/test/general/web_video1.webm^headers^ new file mode 100644 index 0000000000..d027132ea2 --- /dev/null +++ b/browser/base/content/test/general/web_video1.webm^headers^ @@ -0,0 +1,3 @@ +Content-Disposition: filename="web-video1-expectedName.webm" +Content-Type: video/webm + diff --git a/browser/base/content/test/historySwipeAnimation/browser_historySwipeAnimation.js b/browser/base/content/test/historySwipeAnimation/browser_historySwipeAnimation.js index a5910964e7..eeeb7e8b9e 100644 --- a/browser/base/content/test/historySwipeAnimation/browser_historySwipeAnimation.js +++ b/browser/base/content/test/historySwipeAnimation/browser_historySwipeAnimation.js @@ -5,7 +5,7 @@ function test() { waitForExplicitFinish(); - BrowserOpenTab(); + BrowserCommands.openTab(); let tab = gBrowser.selectedTab; registerCleanupFunction(function () { gBrowser.removeTab(tab); diff --git a/browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js b/browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js index 8640716bab..ef92d4c528 100644 --- a/browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js +++ b/browser/base/content/test/keyboard/browser_toolbarButtonKeyPress.js @@ -12,7 +12,7 @@ const kDevPanelID = "PanelUI-developer-tools"; function waitForLocationChange() { let promise = new Promise(resolve => { let wpl = { - onLocationChange(aWebProgress, aRequest, aLocation) { + onLocationChange() { gBrowser.removeProgressListener(wpl); resolve(); }, @@ -213,31 +213,23 @@ add_task(async function testSidebarsButtonPress() { // This is an image with a click handler on its parent and no command handler, // but the toolbar keyboard navigation code should handle keyboard activation. add_task(async function testBookmarkButtonPress() { - await BrowserTestUtils.withNewTab( - "https://example.com", - async function (aBrowser) { - let button = document.getElementById("star-button-box"); - StarUI._createPanelIfNeeded(); - let panel = document.getElementById("editBookmarkPanel"); - let focused = BrowserTestUtils.waitForEvent(panel, "focus", true); - // The button ignores activation while the bookmarked status is being - // updated. So, wait for it to finish updating. - await TestUtils.waitForCondition( - () => BookmarkingUI.status != BookmarkingUI.STATUS_UPDATING - ); - await focusAndActivateElement(button, () => - EventUtils.synthesizeKey(" ") - ); - await focused; - ok( - true, - "Focus inside edit bookmark panel after Bookmark button pressed" - ); - let hidden = BrowserTestUtils.waitForEvent(panel, "popuphidden"); - EventUtils.synthesizeKey("KEY_Escape"); - await hidden; - } - ); + await BrowserTestUtils.withNewTab("https://example.com", async function () { + let button = document.getElementById("star-button-box"); + StarUI._createPanelIfNeeded(); + let panel = document.getElementById("editBookmarkPanel"); + let focused = BrowserTestUtils.waitForEvent(panel, "focus", true); + // The button ignores activation while the bookmarked status is being + // updated. So, wait for it to finish updating. + await TestUtils.waitForCondition( + () => BookmarkingUI.status != BookmarkingUI.STATUS_UPDATING + ); + await focusAndActivateElement(button, () => EventUtils.synthesizeKey(" ")); + await focused; + ok(true, "Focus inside edit bookmark panel after Bookmark button pressed"); + let hidden = BrowserTestUtils.waitForEvent(panel, "popuphidden"); + EventUtils.synthesizeKey("KEY_Escape"); + await hidden; + }); }); // Test activation of the Bookmarks Menu button from the keyboard. @@ -302,33 +294,24 @@ add_task(async function testDownloadsButtonPress() { // with a browser element to embed the pocket UI into it. // The Pocket panel should appear and focus should move inside it. add_task(async function testPocketButtonPress() { - await BrowserTestUtils.withNewTab( - "https://example.com", - async function (aBrowser) { - let button = document.getElementById("save-to-pocket-button"); - // The panel is created on the fly, so we can't simply wait for focus - // inside it. - let showing = BrowserTestUtils.waitForEvent( - document, - "popupshowing", - true - ); - await focusAndActivateElement(button, () => - EventUtils.synthesizeKey(" ") - ); - let event = await showing; - let panel = event.target; - is(panel.id, "customizationui-widget-panel"); - let focused = BrowserTestUtils.waitForEvent(panel, "focus", true); - await focused; - is( - document.activeElement.tagName, - "browser", - "Focus inside Pocket panel after Bookmark button pressed" - ); - let hidden = BrowserTestUtils.waitForEvent(panel, "popuphidden"); - EventUtils.synthesizeKey("KEY_Escape"); - await hidden; - } - ); + await BrowserTestUtils.withNewTab("https://example.com", async function () { + let button = document.getElementById("save-to-pocket-button"); + // The panel is created on the fly, so we can't simply wait for focus + // inside it. + let showing = BrowserTestUtils.waitForEvent(document, "popupshowing", true); + await focusAndActivateElement(button, () => EventUtils.synthesizeKey(" ")); + let event = await showing; + let panel = event.target; + is(panel.id, "customizationui-widget-panel"); + let focused = BrowserTestUtils.waitForEvent(panel, "focus", true); + await focused; + is( + document.activeElement.tagName, + "browser", + "Focus inside Pocket panel after Bookmark button pressed" + ); + let hidden = BrowserTestUtils.waitForEvent(panel, "popuphidden"); + EventUtils.synthesizeKey("KEY_Escape"); + await hidden; + }); }); diff --git a/browser/base/content/test/metaTags/browser_bad_meta_tags.js b/browser/base/content/test/metaTags/browser_bad_meta_tags.js index 00cc128ec0..aa025725dc 100644 --- a/browser/base/content/test/metaTags/browser_bad_meta_tags.js +++ b/browser/base/content/test/metaTags/browser_bad_meta_tags.js @@ -9,11 +9,12 @@ const TEST_PATH = ) + "bad_meta_tags.html"; /** - * This tests that with the page bad_meta_tags.html, ContentMetaHandler.jsm parses - * out the meta tags available and does not store content provided by a malformed - * meta tag. In this case the best defined meta tags are malformed, so here we - * test that we store the next best ones - "description" and "twitter:image". The - * list of meta tags and order of preference is found in ContentMetaHandler.jsm. + * This tests that with the page bad_meta_tags.html, ContentMetaHandler.sys.mjs + * parses out the meta tags available and does not store content provided by a + * malformed meta tag. In this case the best defined meta tags are malformed, so + * here we test that we store the next best ones - "description" and "twitter:image". + * The list of meta tags and order of preference is found in + * ContentMetaHandler.sys.mjs. */ add_task(async function test_bad_meta_tags() { const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PATH); diff --git a/browser/base/content/test/metaTags/browser_meta_tags.js b/browser/base/content/test/metaTags/browser_meta_tags.js index 380a71214c..870860dc18 100644 --- a/browser/base/content/test/metaTags/browser_meta_tags.js +++ b/browser/base/content/test/metaTags/browser_meta_tags.js @@ -8,11 +8,11 @@ const TEST_PATH = "https://example.com" ) + "meta_tags.html"; /** - * This tests that with the page meta_tags.html, ContentMetaHandler.jsm parses - * out the meta tags avilable and only stores the best one for description and - * one for preview image url. In the case of this test, the best defined meta + * This tests that with the page meta_tags.html, ContentMetaHandler.sys.mjs + * parses out the meta tags avilable and only stores the best one for description + * and one for preview image url. In the case of this test, the best defined meta * tags are "og:description" and "og:image:secure_url". The list of meta tags - * and order of preference is found in ContentMetaHandler.jsm. + * and order of preference is found in ContentMetaHandler.sys.mjs. */ add_task(async function test_metadata() { const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PATH); diff --git a/browser/base/content/test/outOfProcess/browser_basic_outofprocess.js b/browser/base/content/test/outOfProcess/browser_basic_outofprocess.js index 50914a286c..41fc96986e 100644 --- a/browser/base/content/test/outOfProcess/browser_basic_outofprocess.js +++ b/browser/base/content/test/outOfProcess/browser_basic_outofprocess.js @@ -121,12 +121,9 @@ add_task(async function test_subframes_function() { let browser = tab.linkedBrowser; let counter = 0; - let browsingContexts = await initChildFrames( - browser, - function (browsingContext) { - return "<p>Text " + ++counter + "</p>"; - } - ); + let browsingContexts = await initChildFrames(browser, function () { + return "<p>Text " + ++counter + "</p>"; + }); is( counter, diff --git a/browser/base/content/test/pageActions/head.js b/browser/base/content/test/pageActions/head.js index cd269bf9b5..370f01734c 100644 --- a/browser/base/content/test/pageActions/head.js +++ b/browser/base/content/test/pageActions/head.js @@ -124,7 +124,7 @@ async function promiseAnimationFrame(win = window) { async function promisePopupNotShown(id, win = window) { let deferred = Promise.withResolvers(); - function listener(e) { + function listener() { deferred.reject("Unexpected popupshown"); } let panel = win.document.getElementById(id); diff --git a/browser/base/content/test/pageinfo/browser.toml b/browser/base/content/test/pageinfo/browser.toml index ae70eb68ff..9e14392450 100644 --- a/browser/base/content/test/pageinfo/browser.toml +++ b/browser/base/content/test/pageinfo/browser.toml @@ -5,7 +5,7 @@ support-files = [ "image.html", "../general/audio.ogg", "../general/moz.png", - "../general/video.ogg", + "../general/video.webm", ] ["browser_pageinfo_iframe_media.js"] diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_firstPartyIsolation.js b/browser/base/content/test/pageinfo/browser_pageinfo_firstPartyIsolation.js index 354e85a241..dbd5d8fe25 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_firstPartyIsolation.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_firstPartyIsolation.js @@ -76,7 +76,7 @@ async function test() { // Pass a dummy imageElement, if there isn't an imageElement, pageInfo.js // will do a preview, however this sometimes will cause intermittent failures, // see bug 1403365. - let pageInfo = BrowserPageInfo(url, "mediaTab", {}); + let pageInfo = BrowserCommands.pageInfo(url, "mediaTab", {}); info("waitForEvent pageInfo"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_iframe_media.js b/browser/base/content/test/pageinfo/browser_pageinfo_iframe_media.js index 7550379ad1..3dad0a50f3 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_iframe_media.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_iframe_media.js @@ -10,7 +10,7 @@ add_task(async function test_all_images_mentioned() { await BrowserTestUtils.withNewTab( TEST_PATH + "iframes.html", async function () { - let pageInfo = BrowserPageInfo( + let pageInfo = BrowserCommands.pageInfo( gBrowser.selectedBrowser.currentURI.spec, "mediaTab" ); diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js b/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js index 374cd5f032..0fea68d640 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_image_info.js @@ -28,7 +28,7 @@ add_task(async function () { }; }); - let pageInfo = BrowserPageInfo( + let pageInfo = BrowserCommands.pageInfo( browser.currentURI.spec, "mediaTab", imageInfo diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_images.js b/browser/base/content/test/pageinfo/browser_pageinfo_images.js index e1f71204d0..c356c1c690 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_images.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_images.js @@ -10,7 +10,7 @@ add_task(async function test_all_images_mentioned() { await BrowserTestUtils.withNewTab( TEST_PATH + "all_images.html", async function () { - let pageInfo = BrowserPageInfo( + let pageInfo = BrowserCommands.pageInfo( gBrowser.selectedBrowser.currentURI.spec, "mediaTab" ); @@ -97,7 +97,7 @@ add_task(async function test_image_size() { await BrowserTestUtils.withNewTab( TEST_PATH + "all_images.html", async function () { - let pageInfo = BrowserPageInfo( + let pageInfo = BrowserCommands.pageInfo( gBrowser.selectedBrowser.currentURI.spec, "mediaTab" ); diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_permissions.js b/browser/base/content/test/pageinfo/browser_pageinfo_permissions.js index ebf027811d..6b11ac19b9 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_permissions.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_permissions.js @@ -7,8 +7,8 @@ const TEST_ORIGIN_CERT_ERROR = "https://expired.example.com"; const LOW_TLS_VERSION = "https://tls1.example.com/"; async function testPermissions(defaultPermission) { - await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function (browser) { - let pageInfo = BrowserPageInfo(TEST_ORIGIN, "permTab"); + await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function () { + let pageInfo = BrowserCommands.pageInfo(TEST_ORIGIN, "permTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let defaultCheckbox = await TestUtils.waitForCondition(() => @@ -94,7 +94,7 @@ add_task(async function test_CertificateError() { await pageLoaded; - let pageInfo = BrowserPageInfo(TEST_ORIGIN_CERT_ERROR, "permTab"); + let pageInfo = BrowserCommands.pageInfo(TEST_ORIGIN_CERT_ERROR, "permTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let permissionTab = pageInfo.document.getElementById("permTab"); await TestUtils.waitForCondition( @@ -145,7 +145,7 @@ add_task(async function test_NetworkError() { await pageLoaded; - let pageInfo = BrowserPageInfo(LOW_TLS_VERSION, "permTab"); + let pageInfo = BrowserCommands.pageInfo(LOW_TLS_VERSION, "permTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let permissionTab = pageInfo.document.getElementById("permTab"); await TestUtils.waitForCondition( @@ -192,8 +192,8 @@ add_task(async function test_default_geo_permission() { // Test special behavior for cookie permissions. add_task(async function test_cookie_permission() { - await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function (browser) { - let pageInfo = BrowserPageInfo(TEST_ORIGIN, "permTab"); + await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function () { + let pageInfo = BrowserCommands.pageInfo(TEST_ORIGIN, "permTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let defaultCheckbox = await TestUtils.waitForCondition(() => diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_rtl.js b/browser/base/content/test/pageinfo/browser_pageinfo_rtl.js index d0c06a03ff..677a58516e 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_rtl.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_rtl.js @@ -1,18 +1,15 @@ async function testPageInfo() { - await BrowserTestUtils.withNewTab( - "https://example.com", - async function (browser) { - let pageInfo = BrowserPageInfo(); - await BrowserTestUtils.waitForEvent(pageInfo, "page-info-init"); - is( - getComputedStyle(pageInfo.document.documentElement).direction, - "rtl", - "Should be RTL" - ); - ok(true, "Didn't assert or crash"); - pageInfo.close(); - } - ); + await BrowserTestUtils.withNewTab("https://example.com", async function () { + let pageInfo = BrowserCommands.pageInfo(); + await BrowserTestUtils.waitForEvent(pageInfo, "page-info-init"); + is( + getComputedStyle(pageInfo.document.documentElement).direction, + "rtl", + "Should be RTL" + ); + ok(true, "Didn't assert or crash"); + pageInfo.close(); + }); } add_task(async function test_page_info_rtl() { diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_security.js b/browser/base/content/test/pageinfo/browser_pageinfo_security.js index 47df97db06..17ff0b9b75 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_security.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_security.js @@ -24,7 +24,7 @@ add_task(async function test_ShowCertificate() { TEST_SUB_ORIGIN ); - let pageInfo = BrowserPageInfo(TEST_SUB_ORIGIN, "securityTab"); + let pageInfo = BrowserCommands.pageInfo(TEST_SUB_ORIGIN, "securityTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; let securityTab = pageInfoDoc.getElementById("securityTab"); @@ -74,7 +74,7 @@ add_task(async function test_image() { let url = TEST_PATH + "moz.png"; await BrowserTestUtils.openNewForegroundTab(gBrowser, url); - let pageInfo = BrowserPageInfo(url, "securityTab"); + let pageInfo = BrowserCommands.pageInfo(url, "securityTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; let securityTab = pageInfoDoc.getElementById("securityTab"); @@ -128,7 +128,10 @@ add_task(async function test_CertificateError() { await pageLoaded; - let pageInfo = BrowserPageInfo(TEST_ORIGIN_CERT_ERROR, "securityTab"); + let pageInfo = BrowserCommands.pageInfo( + TEST_ORIGIN_CERT_ERROR, + "securityTab" + ); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; let securityTab = pageInfoDoc.getElementById("securityTab"); @@ -165,7 +168,7 @@ add_task(async function test_CertificateError() { add_task(async function test_SecurityHTTP() { await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_HTTP_ORIGIN); - let pageInfo = BrowserPageInfo(TEST_HTTP_ORIGIN, "securityTab"); + let pageInfo = BrowserCommands.pageInfo(TEST_HTTP_ORIGIN, "securityTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; let securityTab = pageInfoDoc.getElementById("securityTab"); @@ -201,7 +204,7 @@ add_task(async function test_SecurityHTTP() { add_task(async function test_ValidCert() { await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_ORIGIN); - let pageInfo = BrowserPageInfo(TEST_ORIGIN, "securityTab"); + let pageInfo = BrowserCommands.pageInfo(TEST_ORIGIN, "securityTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; let securityTab = pageInfoDoc.getElementById("securityTab"); @@ -237,11 +240,11 @@ add_task(async function test_ValidCert() { add_task(async function test_SiteData() { await SiteDataTestUtils.addToIndexedDB(TEST_ORIGIN); - await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function (browser) { + await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function () { let totalUsage = await SiteDataTestUtils.getQuotaUsage(TEST_ORIGIN); Assert.greater(totalUsage, 0, "The total usage should not be 0"); - let pageInfo = BrowserPageInfo(TEST_ORIGIN, "securityTab"); + let pageInfo = BrowserCommands.pageInfo(TEST_ORIGIN, "securityTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; @@ -302,8 +305,8 @@ add_task(async function test_Cookies() { value: "1", }); - await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function (browser) { - let pageInfo = BrowserPageInfo(TEST_ORIGIN, "securityTab"); + await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function () { + let pageInfo = BrowserCommands.pageInfo(TEST_ORIGIN, "securityTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js b/browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js index ac93b7ddb2..74289107a8 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_separate_private.js @@ -9,7 +9,7 @@ add_task(async function () { "https://example.com" ); let browser = tab.linkedBrowser; - let pageInfo = BrowserPageInfo(browser.currentURI.spec); + let pageInfo = BrowserCommands.pageInfo(browser.currentURI.spec); await BrowserTestUtils.waitForEvent(pageInfo, "page-info-init"); Assert.strictEqual( pageInfo.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing, @@ -25,7 +25,7 @@ add_task(async function () { "https://example.com" ); let privateBrowser = privateTab.linkedBrowser; - let privatePageInfo = privateWindow.BrowserPageInfo( + let privatePageInfo = privateWindow.BrowserCommands.pageInfo( privateBrowser.currentURI.spec ); await BrowserTestUtils.waitForEvent(privatePageInfo, "page-info-init"); diff --git a/browser/base/content/test/pageinfo/browser_pageinfo_svg_image.js b/browser/base/content/test/pageinfo/browser_pageinfo_svg_image.js index 3934cd2aea..b00df72851 100644 --- a/browser/base/content/test/pageinfo/browser_pageinfo_svg_image.js +++ b/browser/base/content/test/pageinfo/browser_pageinfo_svg_image.js @@ -7,7 +7,7 @@ add_task(async function () { BrowserTestUtils.startLoadingURIString(gBrowser.selectedBrowser, URI); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, URI); - const pageInfo = BrowserPageInfo( + const pageInfo = BrowserCommands.pageInfo( gBrowser.selectedBrowser.currentURI.spec, "mediaTab" ); diff --git a/browser/base/content/test/pageinfo/image.html b/browser/base/content/test/pageinfo/image.html index 1261be8e7b..35e2d78e1e 100644 --- a/browser/base/content/test/pageinfo/image.html +++ b/browser/base/content/test/pageinfo/image.html @@ -1,5 +1,5 @@ <html> <img src='moz.png' height=100 width=150 id='test-image'> - <video src='video.ogg' id='test-video'></video> + <video src='video.webm' id='test-video'></video> <audio src='audio.ogg' id='test-audio'></audio> </html> diff --git a/browser/base/content/test/performance/StartupContentSubframe.sys.mjs b/browser/base/content/test/performance/StartupContentSubframe.sys.mjs index a78e456afb..7d2d711765 100644 --- a/browser/base/content/test/performance/StartupContentSubframe.sys.mjs +++ b/browser/base/content/test/performance/StartupContentSubframe.sys.mjs @@ -16,7 +16,7 @@ export class StartupContentSubframeParent extends JSWindowActorParent { } export class StartupContentSubframeChild extends JSWindowActorChild { - async handleEvent(event) { + async handleEvent() { // When the remote subframe is loaded, an event will be fired to this actor, // which will cause us to send the `LoadedScripts` message to the parent // process. diff --git a/browser/base/content/test/performance/browser_preferences_usage.js b/browser/base/content/test/performance/browser_preferences_usage.js index 6bc623a360..b0ff140d19 100644 --- a/browser/base/content/test/performance/browser_preferences_usage.js +++ b/browser/base/content/test/performance/browser_preferences_usage.js @@ -107,7 +107,7 @@ add_task(async function startup() { "browser.startup.record": { // This pref is accessed in Nighly and debug builds only. min: 200, - max: 400, + max: 450, }, "network.loadinfo.skip_type_assertion": { // This is accessed in debug only. diff --git a/browser/base/content/test/performance/browser_startup_content.js b/browser/base/content/test/performance/browser_startup_content.js index b0f861e47f..fac82ad990 100644 --- a/browser/base/content/test/performance/browser_startup_content.js +++ b/browser/base/content/test/performance/browser_startup_content.js @@ -57,18 +57,11 @@ const known_scripts = { ]), }; -if (!Services.appinfo.sessionHistoryInParent) { - known_scripts.modules.add( - "resource:///modules/sessionstore/ContentSessionStore.sys.mjs" - ); -} - // Items on this list *might* load when creating the process, as opposed to // items in the main list, which we expect will always load. const intermittently_loaded_scripts = { modules: new Set([ "resource://gre/modules/nsAsyncShutdown.sys.mjs", - "resource://gre/modules/sessionstore/Utils.sys.mjs", // Translations code which may be preffed on. "resource://gre/actors/TranslationsChild.sys.mjs", @@ -119,7 +112,8 @@ add_task(async function () { let mm = gBrowser.selectedBrowser.messageManager; let promise = BrowserTestUtils.waitForMessage(mm, "Test:LoadedScripts"); - // Load a custom frame script to avoid using ContentTask which loads Task.jsm + // Load a custom frame script to avoid using SpecialPowers.spawn which may + // load other modules. mm.loadFrameScript( "data:text/javascript,(" + function () { diff --git a/browser/base/content/test/performance/browser_startup_mainthreadio.js b/browser/base/content/test/performance/browser_startup_mainthreadio.js index b65ede26d5..a89a068f13 100644 --- a/browser/base/content/test/performance/browser_startup_mainthreadio.js +++ b/browser/base/content/test/performance/browser_startup_mainthreadio.js @@ -189,6 +189,7 @@ const startupPhases = { { // bug 1541601 path: "PrfDef:channel-prefs.js", + condition: !MAC, stat: 1, read: 1, close: 1, diff --git a/browser/base/content/test/performance/browser_tabdetach.js b/browser/base/content/test/performance/browser_tabdetach.js index a860362f1f..3cbdde50fc 100644 --- a/browser/base/content/test/performance/browser_tabdetach.js +++ b/browser/base/content/test/performance/browser_tabdetach.js @@ -59,7 +59,7 @@ add_task(async function test_detach_not_overflowed() { expectedReflows: EXPECTED_REFLOWS, // we are opening a whole new window, so there's no point in tracking // rects being painted - frames: { filter: rects => [] }, + frames: { filter: () => [] }, } ); @@ -87,7 +87,7 @@ add_task(async function test_detach_overflowed() { expectedReflows: EXPECTED_REFLOWS, // we are opening a whole new window, so there's no point in tracking // rects being painted - frames: { filter: rects => [] }, + frames: { filter: () => [] }, } ); diff --git a/browser/base/content/test/performance/browser_tabopen.js b/browser/base/content/test/performance/browser_tabopen.js index 2457812cb7..b7eabf4844 100644 --- a/browser/base/content/test/performance/browser_tabopen.js +++ b/browser/base/content/test/performance/browser_tabopen.js @@ -144,7 +144,7 @@ add_task(async function () { await withPerfObserver( async function () { let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone"); - BrowserOpenTab(); + BrowserCommands.openTab(); await BrowserTestUtils.waitForEvent( gBrowser.selectedTab, "TabAnimationEnd" diff --git a/browser/base/content/test/performance/browser_tabopen_squeeze.js b/browser/base/content/test/performance/browser_tabopen_squeeze.js index f92bdc2ea4..dd73f66030 100644 --- a/browser/base/content/test/performance/browser_tabopen_squeeze.js +++ b/browser/base/content/test/performance/browser_tabopen_squeeze.js @@ -52,7 +52,7 @@ add_task(async function () { await withPerfObserver( async function () { let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone"); - BrowserOpenTab(); + BrowserCommands.openTab(); await BrowserTestUtils.waitForEvent( gBrowser.selectedTab, "TabAnimationEnd" diff --git a/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js b/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js index 1fd33ed836..50d108c062 100644 --- a/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js +++ b/browser/base/content/test/performance/browser_tabstrip_overflow_underflow.js @@ -90,7 +90,7 @@ add_task(async function () { await withPerfObserver( async function () { let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone"); - BrowserOpenTab(); + BrowserCommands.openTab(); await BrowserTestUtils.waitForEvent( gBrowser.selectedTab, "TabAnimationEnd" @@ -115,7 +115,7 @@ add_task(async function () { await withPerfObserver( async function () { let switchDone = BrowserTestUtils.waitForEvent(window, "TabSwitchDone"); - BrowserOpenTab(); + BrowserCommands.openTab(); await switchDone; await TestUtils.waitForCondition(() => { return gBrowser.tabContainer.arrowScrollbox.hasAttribute( diff --git a/browser/base/content/test/performance/browser_tabswitch.js b/browser/base/content/test/performance/browser_tabswitch.js index bbbbac3a21..ba29efa662 100644 --- a/browser/base/content/test/performance/browser_tabswitch.js +++ b/browser/base/content/test/performance/browser_tabswitch.js @@ -59,6 +59,14 @@ add_task(async function () { getComputedStyle(gBrowser.selectedTab).paddingInlineStart ); let minTabWidth = firstTabRect.width - 2 * tabPaddingStart; + if (AppConstants.platform == "macosx") { + // On macOS, after bug 1886729, gecko screenshots like the ones for this + // test can't screenshot the native titlebar. That, plus the fact that + // there's no border or shadow (see bug 1702653) means that we only end up + // with the tab text color changing, which is smaller than the tab + // background size. + minTabWidth = 0; + } let maxTabWidth = firstTabRect.width; let inRange = (val, min, max) => min <= val && val <= max; @@ -84,11 +92,7 @@ add_task(async function () { // The tab selection changes between 2 adjacent tabs, so we expect // both to change color at once: this should be a single rect of the // width of 2 tabs. - inRange( - r.w, - minTabWidth - 1, // -1 for the border on Win7 - maxTabWidth * 2 - ) + inRange(r.w, minTabWidth, maxTabWidth * 2) ) ) ), diff --git a/browser/base/content/test/performance/browser_windowclose.js b/browser/base/content/test/performance/browser_windowclose.js index 7d11779acc..11fa669be0 100644 --- a/browser/base/content/test/performance/browser_windowclose.js +++ b/browser/base/content/test/performance/browser_windowclose.js @@ -53,7 +53,7 @@ add_task(async function () { { expectedReflows: EXPECTED_REFLOWS, frames: { - filter(rects, frame, previousFrame) { + filter(rects, frame) { // Ignore the focus-out animation. if (isLikelyFocusChange(rects, frame)) { return []; diff --git a/browser/base/content/test/performance/browser_windowopen.js b/browser/base/content/test/performance/browser_windowopen.js index 02c6172948..b258cb67f5 100644 --- a/browser/base/content/test/performance/browser_windowopen.js +++ b/browser/base/content/test/performance/browser_windowopen.js @@ -44,7 +44,7 @@ add_task(async function () { let expectations = { expectedReflows: EXPECTED_REFLOWS, frames: { - filter(rects, frame, previousFrame) { + filter(rects, frame) { // The first screenshot we get in OSX / Windows shows an unfocused browser // window for some reason. See bug 1445161. if (!alreadyFocused && isLikelyFocusChange(rects, frame)) { diff --git a/browser/base/content/test/performance/head.js b/browser/base/content/test/performance/head.js index 29722e6bbe..42f7ae95fc 100644 --- a/browser/base/content/test/performance/head.js +++ b/browser/base/content/test/performance/head.js @@ -42,7 +42,7 @@ async function recordReflows(testPromise, win = window) { let reflows = []; let observer = { - reflow(start, end) { + reflow() { // Gather information about the current code path. reflows.push(new Error().stack); @@ -50,7 +50,7 @@ async function recordReflows(testPromise, win = window) { dirtyFrame(win); }, - reflowInterruptible(start, end) { + reflowInterruptible() { // Interruptible reflows are the reflows caused by the refresh // driver ticking. These are fine. }, @@ -99,11 +99,9 @@ async function recordReflows(testPromise, win = window) { * // Sometimes, due to unpredictable timings, the reflow may be hit * // less times. * stack: [ - * "select@chrome://global/content/bindings/textbox.xml", - * "focusAndSelectUrlBar@chrome://browser/content/browser.js", - * "openLinkIn@chrome://browser/content/utilityOverlay.js", - * "openUILinkIn@chrome://browser/content/utilityOverlay.js", - * "BrowserOpenTab@chrome://browser/content/browser.js", + * "somefunction@chrome://somepackage/content/somefile.mjs", + * "otherfunction@chrome://otherpackage/content/otherfile.js", + * "morecode@resource://somewhereelse/SomeModule.sys.mjs", * ], * // We expect this particular reflow to happen up to 2 times. * maxCount: 2, @@ -113,10 +111,9 @@ async function recordReflows(testPromise, win = window) { * // This reflow is caused by lorem ipsum. We expect this reflow * // to only happen once, so we can omit the "maxCount" property. * stack: [ - * "get_scrollPosition@chrome://global/content/bindings/scrollbox.xml", - * "_fillTrailingGap@chrome://browser/content/tabbrowser.xml", - * "_handleNewTab@chrome://browser/content/tabbrowser.xml", - * "onxbltransitionend@chrome://browser/content/tabbrowser.xml", + * "somefunction@chrome://somepackage/content/somefile.mjs", + * "otherfunction@chrome://otherpackage/content/otherfile.js", + * "morecode@resource://somewhereelse/SomeModule.sys.mjs", * ], * } * ] @@ -430,7 +427,7 @@ async function recordFrames(testPromise, win = window) { let frames = []; - let afterPaintListener = event => { + let afterPaintListener = () => { let width, height; canvas.width = width = win.innerWidth; canvas.height = height = win.innerHeight; diff --git a/browser/base/content/test/permissions/browser_autoplay_blocked.js b/browser/base/content/test/permissions/browser_autoplay_blocked.js index d81481d6a5..7fd45a4340 100644 --- a/browser/base/content/test/permissions/browser_autoplay_blocked.js +++ b/browser/base/content/test/permissions/browser_autoplay_blocked.js @@ -102,7 +102,7 @@ add_task(async function testMainViewVisible() { Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.BLOCKED); - await BrowserTestUtils.withNewTab(AUTOPLAY_PAGE, async function (browser) { + await BrowserTestUtils.withNewTab(AUTOPLAY_PAGE, async function () { let permissionsList = document.getElementById( "permission-popup-permission-list" ); diff --git a/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js b/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js index dbb2d1ea32..62a49e359c 100644 --- a/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js +++ b/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js @@ -336,7 +336,7 @@ async function withNewTabInput( await SpecialPowers.spawn(browser, [], initTab); await enableResistFingerprinting(randomDataOnCanvasExtract, true); let popupShown = promisePopupShown(); - await SpecialPowers.spawn(browser, [], function (host) { + await SpecialPowers.spawn(browser, [], function () { E10SUtils.wrapHandlingUserInput(content, true, function () { var button = content.document.getElementById("clickme"); button.click(); @@ -361,11 +361,7 @@ async function withNewTabInput( await SpecialPowers.popPrefEnv(); } -async function doTestInput( - randomDataOnCanvasExtract, - grantPermission, - autoDeclineNoInput -) { +async function doTestInput(randomDataOnCanvasExtract, grantPermission) { await BrowserTestUtils.withNewTab( kUrl, withNewTabInput.bind(null, randomDataOnCanvasExtract, grantPermission) diff --git a/browser/base/content/test/permissions/browser_site_scoped_permissions.js b/browser/base/content/test/permissions/browser_site_scoped_permissions.js index 7a8953de47..949d7a0596 100644 --- a/browser/base/content/test/permissions/browser_site_scoped_permissions.js +++ b/browser/base/content/test/permissions/browser_site_scoped_permissions.js @@ -21,7 +21,7 @@ add_task(async function testSiteScopedPermissionSubdomainAffectsBaseDomain() { ); let id = "3rdPartyStorage^https://example.org"; - await BrowserTestUtils.withNewTab(EMPTY_PAGE, async function (browser) { + await BrowserTestUtils.withNewTab(EMPTY_PAGE, async function () { Services.perms.addFromPrincipal( subdomainPrincipal, id, @@ -76,49 +76,46 @@ add_task(async function testSiteScopedPermissionBaseDomainAffectsSubdomain() { Services.scriptSecurityManager.createContentPrincipalFromOrigin(origin); let id = "3rdPartyStorage^https://example.org"; - await BrowserTestUtils.withNewTab( - SUBDOMAIN_EMPTY_PAGE, - async function (browser) { - Services.perms.addFromPrincipal(principal, id, SitePermissions.ALLOW); - await openPermissionPopup(); - - let permissionsList = document.getElementById( - "permission-popup-permission-list" - ); - let listEntryCount = permissionsList.querySelectorAll( - ".permission-popup-permission-item" - ).length; - is( - listEntryCount, - 1, - "Permission exists on base domain when set on subdomain" - ); - - closePermissionPopup(); - - Services.perms.removeFromPrincipal(principal, id); - - // We intentionally turn off a11y_checks, because the following function - // is expected to click a toolbar button that may be already hidden - // with "display:none;". The permissions panel anchor is hidden because - // the last permission was removed, however we force opening the panel - // anyways in order to test that the list has been properly emptied: - AccessibilityUtils.setEnv({ - mustHaveAccessibleRule: false, - }); - await openPermissionPopup(); - AccessibilityUtils.resetEnv(); - - listEntryCount = permissionsList.querySelectorAll( - ".permission-popup-permission-item-3rdPartyStorage" - ).length; - is( - listEntryCount, - 0, - "Permission removed on base domain when removed on subdomain" - ); - - await closePermissionPopup(); - } - ); + await BrowserTestUtils.withNewTab(SUBDOMAIN_EMPTY_PAGE, async function () { + Services.perms.addFromPrincipal(principal, id, SitePermissions.ALLOW); + await openPermissionPopup(); + + let permissionsList = document.getElementById( + "permission-popup-permission-list" + ); + let listEntryCount = permissionsList.querySelectorAll( + ".permission-popup-permission-item" + ).length; + is( + listEntryCount, + 1, + "Permission exists on base domain when set on subdomain" + ); + + closePermissionPopup(); + + Services.perms.removeFromPrincipal(principal, id); + + // We intentionally turn off a11y_checks, because the following function + // is expected to click a toolbar button that may be already hidden + // with "display:none;". The permissions panel anchor is hidden because + // the last permission was removed, however we force opening the panel + // anyways in order to test that the list has been properly emptied: + AccessibilityUtils.setEnv({ + mustHaveAccessibleRule: false, + }); + await openPermissionPopup(); + AccessibilityUtils.resetEnv(); + + listEntryCount = permissionsList.querySelectorAll( + ".permission-popup-permission-item-3rdPartyStorage" + ).length; + is( + listEntryCount, + 0, + "Permission removed on base domain when removed on subdomain" + ); + + await closePermissionPopup(); + }); }); diff --git a/browser/base/content/test/permissions/browser_temporary_permissions_navigation.js b/browser/base/content/test/permissions/browser_temporary_permissions_navigation.js index 7da79b1810..490da04374 100644 --- a/browser/base/content/test/permissions/browser_temporary_permissions_navigation.js +++ b/browser/base/content/test/permissions/browser_temporary_permissions_navigation.js @@ -41,7 +41,7 @@ add_task(async function testTempPermissionOnReload() { reloaded = BrowserTestUtils.browserLoaded(browser, false, origin); // Reload as a user (should remove the temp permission). - BrowserReload(); + BrowserCommands.reload(); await reloaded; diff --git a/browser/base/content/test/plugins/head.js b/browser/base/content/test/plugins/head.js index 4f6c25b92a..76f87dfc43 100644 --- a/browser/base/content/test/plugins/head.js +++ b/browser/base/content/test/plugins/head.js @@ -147,7 +147,7 @@ function promiseWaitForFocus(aWindow) { * @return Promise */ function waitForNotificationBar(notificationID, browser, callback) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let notification; let notificationBox = gBrowser.getNotificationBox(browser); waitForCondition( @@ -189,7 +189,7 @@ function waitForNotificationShown(notification, callback) { } PopupNotifications.panel.addEventListener( "popupshown", - function (e) { + function () { callback(); }, { once: true } diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification.js b/browser/base/content/test/popupNotifications/browser_popupNotification.js index 235aa90b5f..4479cb1ee7 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification.js @@ -26,7 +26,7 @@ var tests = [ checkPopup(popup, this.notifyObj); triggerMainCommand(popup); }, - onHidden(popup) { + onHidden() { ok(this.notifyObj.mainActionClicked, "mainAction was clicked"); ok( !this.notifyObj.dismissalCallbackTriggered, @@ -55,7 +55,7 @@ var tests = [ checkPopup(popup, this.notifyObj); triggerSecondaryCommand(popup, 0); }, - onHidden(popup) { + onHidden() { ok(this.notifyObj.secondaryActionClicked, "secondaryAction was clicked"); ok( !this.notifyObj.dismissalCallbackTriggered, @@ -89,7 +89,7 @@ var tests = [ checkPopup(popup, this.notifyObj); triggerSecondaryCommand(popup, 1); }, - onHidden(popup) { + onHidden() { ok( this.extraSecondaryActionClicked, "extra secondary action was clicked" @@ -123,7 +123,7 @@ var tests = [ checkPopup(popup, this.notifyObj); triggerSecondaryCommand(popup, 2); }, - onHidden(popup) { + onHidden() { ok( this.extraSecondaryActionClicked, "extra secondary action was clicked" @@ -145,7 +145,7 @@ var tests = [ checkPopup(popup, this.notifyObj); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { ok( this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered" @@ -205,7 +205,7 @@ var tests = [ // switch back to the old browser gBrowser.selectedTab = this.oldSelectedTab; }, - onHidden(popup) { + onHidden() { // actually remove the notification to prevent it from reappearing ok( wrongBrowserNotificationObject.dismissalCallbackTriggered, @@ -247,7 +247,7 @@ var tests = [ checkPopup(popup, this.notifyObj); this.notification2.remove(); }, - onHidden(popup) { + onHidden() { ok( !this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered" @@ -276,7 +276,7 @@ var tests = [ is(popup.children.length, 1, "only one notification left"); triggerSecondaryCommand(popup, 0); }, - onHidden(popup) { + onHidden() { ok(this.testNotif1.mainActionClicked, "main action #1 was clicked"); ok( !this.testNotif1.secondaryActionClicked, @@ -316,7 +316,7 @@ var tests = [ ); triggerMainCommand(popup); }, - onHidden(popup) { + onHidden() { ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked"); ok( !this.notifyObj.dismissalCallbackTriggered, @@ -348,7 +348,7 @@ var tests = [ ); triggerMainCommand(popup); }, - onHidden(popup) { + onHidden() { ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked"); ok( !this.notifyObj.dismissalCallbackTriggered, @@ -380,7 +380,7 @@ var tests = [ ); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { // Remove the notifications this.firstNotification.remove(); this.secondNotification.remove(); diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_2.js b/browser/base/content/test/popupNotifications/browser_popupNotification_2.js index 8738a3b605..1b0dea66f6 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_2.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_2.js @@ -24,7 +24,7 @@ var tests = [ checkPopup(popup, this.notifyObj); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { ok( this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered" @@ -52,7 +52,7 @@ var tests = [ ); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { let icon = document.getElementById("geo-notification-icon"); isnot( icon.getBoundingClientRect().width, @@ -84,7 +84,7 @@ var tests = [ }); this.notification = showNotification(this.notifyObj); }, - async onShown(popup) { + async onShown() { this.complete = false; // eslint-disable-next-line @microsoft/sdl/no-insecure-url await promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/"); @@ -95,7 +95,7 @@ var tests = [ // eslint-disable-next-line @microsoft/sdl/no-insecure-url await promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/"); }, - onHidden(popup) { + onHidden() { ok( this.complete, "Should only have hidden the notification after 3 page loads" @@ -122,7 +122,7 @@ var tests = [ }); this.notification = showNotification(this.notifyObj); }, - async onShown(popup) { + async onShown() { this.complete = false; // eslint-disable-next-line @microsoft/sdl/no-insecure-url await promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/"); @@ -134,7 +134,7 @@ var tests = [ // eslint-disable-next-line @microsoft/sdl/no-insecure-url await promiseTabLoadEvent(gBrowser.selectedTab, "http://example.org/"); }, - onHidden(popup) { + onHidden() { ok( this.complete, "Should only have hidden the notification after the timeout was passed" @@ -172,7 +172,7 @@ var tests = [ this.complete = true; dismissNotification(popup); }, - onHidden(popup) { + onHidden() { ok( this.complete, "Should only have hidden the notification after it was dismissed" @@ -212,7 +212,7 @@ var tests = [ checkPopup(popup, this.notifyObj); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { this.notification.remove(); this.box.remove(); }, @@ -272,7 +272,7 @@ var tests = [ let notification = popup.children[0]; EventUtils.synthesizeMouseAtCenter(notification.closebutton, {}); }, - onHidden(popup) { + onHidden() { ok( this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered" @@ -302,7 +302,7 @@ var tests = [ ); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { ok( this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered" diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_3.js b/browser/base/content/test/popupNotifications/browser_popupNotification_3.js index 1b7626c660..1d8b6b473b 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_3.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_3.js @@ -27,7 +27,7 @@ var tests = [ checkPopup(popup, this.notifyObj); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { ok( !this.notifyObj.dismissalCallbackTriggered, "dismissal callback wasn't triggered" @@ -70,7 +70,7 @@ var tests = [ dismissNotification(popup); }, - onHidden(popup) { + onHidden() { this.notification1.remove(); ok( this.notifyObj1.removedCallbackTriggered, @@ -127,7 +127,7 @@ var tests = [ dismissNotification(popup); }, - onHidden(popup) { + onHidden() { this.notificationNew.remove(); gBrowser.removeTab(gBrowser.selectedTab); @@ -156,7 +156,7 @@ var tests = [ dismissNotification(popup); }); }, - onHidden(popup) { + onHidden() { ok( !this.notifyObj.mainActionClicked, "mainAction was not clicked because it was too soon" @@ -188,7 +188,7 @@ var tests = [ triggerMainCommand(popup); }, 500); }, - onHidden(popup) { + onHidden() { ok( this.notifyObj.mainActionClicked, "mainAction was clicked after the delay" @@ -308,7 +308,7 @@ var tests = [ }; showNotification(this.notifyObj); }, - async onShown(popup) { + async onShown() { info("Adding observer and performing navigation"); await Promise.all([ diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_4.js b/browser/base/content/test/popupNotifications/browser_popupNotification_4.js index b0e8f016ef..3ea0e943a3 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_4.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_4.js @@ -23,7 +23,7 @@ var tests = [ checkPopup(popup, this.testNotif); triggerMainCommand(popup); }, - onHidden(popup) { + onHidden() { ok(this.testNotif.mainActionClicked, "main action has been triggered"); }, }, @@ -38,7 +38,7 @@ var tests = [ checkPopup(popup, this.testNotif); triggerSecondaryCommand(popup, 0); }, - onHidden(popup) { + onHidden() { ok( this.testNotif.secondaryActionClicked, "secondary action has been triggered" @@ -83,7 +83,7 @@ var tests = [ dismissNotification(popup); }, - onHidden(popup) { + onHidden() { this.notification1.remove(); this.notification2.remove(); }, @@ -213,7 +213,7 @@ var tests = [ checkPopup(popup, this.notifyObj); triggerMainCommand(popup); }, - onHidden(popup) { + onHidden() { ok( this.notifyObj.dismissalCallbackTriggered, "dismissal callback was triggered" @@ -237,7 +237,7 @@ var tests = [ checkPopup(popup, this.notifyObj); triggerSecondaryCommand(popup, 0); }, - onHidden(popup) { + onHidden() { ok( this.notifyObj.dismissalCallbackTriggered, "dismissal callback was triggered" diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_5.js b/browser/base/content/test/popupNotifications/browser_popupNotification_5.js index 0ec5de0c3a..48640b9b00 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_5.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_5.js @@ -62,7 +62,7 @@ var tests = [ this.notification1.remove(); this.notification2.remove(); }, - onHidden(popup) {}, + onHidden() {}, }, // The anchor icon should be shown for notifications in background windows. { @@ -116,7 +116,7 @@ var tests = [ this.complete = true; triggerSecondaryCommand(popup, 0); }, - onHidden(popup) { + onHidden() { ok( !this.complete, "Should have hidden the notification after navigation" @@ -155,7 +155,7 @@ var tests = [ this.complete = true; triggerSecondaryCommand(popup, 0); }, - onHidden(popup) { + onHidden() { ok( this.complete, "Should have hidden the notification after clicking Not Now" @@ -174,7 +174,7 @@ var tests = [ this.notifyObj.options.persistent = true; gNotification = showNotification(this.notifyObj); }, - async onShown(popup) { + async onShown() { this.oldSelectedTab = gBrowser.selectedTab; await BrowserTestUtils.openNewForegroundTab( gBrowser, @@ -182,7 +182,7 @@ var tests = [ "http://example.com/" ); }, - onHidden(popup) { + onHidden() { ok(true, "Should have hidden the notification after tab switch"); gBrowser.removeTab(gBrowser.selectedTab); gBrowser.selectedTab = this.oldSelectedTab; @@ -318,7 +318,7 @@ var tests = [ this.notification1.remove(); this.notification2.remove(); }, - onHidden(popup) {}, + onHidden() {}, }, // Test that persistent notifications are shown stacked by anchor on update { @@ -363,7 +363,7 @@ var tests = [ this.notification2.remove(); this.notification3.remove(); }, - onHidden(popup) {}, + onHidden() {}, }, // Test that on closebutton click, only the persistent notification // that contained the closebutton loses its persistent status. diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_accesskey.js b/browser/base/content/test/popupNotifications/browser_popupNotification_accesskey.js index 4a68105e27..7e8e3f0269 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_accesskey.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_accesskey.js @@ -36,7 +36,7 @@ var tests = [ // process of being hidden right now. isnot(popup.state, "hiding", "popup is not hiding"); }, - onHidden(popup) { + onHidden() { window.removeEventListener("command", commandTriggered, true); ok(buttonPressed, "button pressed"); }, diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js b/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js index 5c20751c3f..bd6fd38d3f 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_keyboard.js @@ -46,7 +46,7 @@ var tests = [ checkPopup(popup, this.notifyObj); EventUtils.synthesizeKey("KEY_Escape"); }, - onHidden(popup) { + onHidden() { ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked"); ok(this.notifyObj.secondaryActionClicked, "secondaryAction was clicked"); ok( @@ -77,7 +77,7 @@ var tests = [ checkPopup(popup, this.notifyObj); EventUtils.synthesizeKey("KEY_Escape"); }, - onHidden(popup) { + onHidden() { ok(!this.notifyObj.mainActionClicked, "mainAction was not clicked"); ok( !this.notifyObj.secondaryActionClicked, @@ -123,7 +123,7 @@ var tests = [ is(document.activeElement, popup.children[0].closebutton); this.notification.remove(); }, - onHidden(popup) {}, + onHidden() {}, }, // Test that you can switch between active notifications with the space key // and that the notification is focused on selection. diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_no_anchors.js b/browser/base/content/test/popupNotifications/browser_popupNotification_no_anchors.js index a73e1f5948..68e782cea6 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_no_anchors.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_no_anchors.js @@ -43,7 +43,7 @@ var tests = [ ); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { this.notification.remove(); gBrowser.removeTab(gBrowser.selectedTab); gBrowser.selectedTab = this.oldSelectedTab; @@ -85,7 +85,7 @@ var tests = [ ); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { this.notification.remove(); gBrowser.removeTab(gBrowser.selectedTab); gBrowser.selectedTab = this.oldSelectedTab; @@ -135,7 +135,7 @@ var tests = [ checkPopup(popup, this.notifyObj); dismissNotification(popup); }, - onHidden(popup) { + onHidden() { this.notification.remove(); gBrowser.removeTab(gBrowser.selectedTab); gBrowser.selectedTab = this.oldSelectedTab; diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js b/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js index 3b027bc1ef..140c2be2fd 100644 --- a/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js +++ b/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js @@ -227,7 +227,7 @@ add_task(async function test_notificationReshowTabSwitch() { let panelShownPromise; info("Open a new tab which hides the notification panel."); - await BrowserTestUtils.withNewTab("https://example.com", async browser => { + await BrowserTestUtils.withNewTab("https://example.com", async () => { info("Wait for panel to be hidden by tab switch."); await panelHiddenPromise; info( diff --git a/browser/base/content/test/popups/browser_popup_close_main_window.js b/browser/base/content/test/popups/browser_popup_close_main_window.js index 148e937bca..abf6c43c3f 100644 --- a/browser/base/content/test/popups/browser_popup_close_main_window.js +++ b/browser/base/content/test/popups/browser_popup_close_main_window.js @@ -37,7 +37,7 @@ add_task(async function closing_last_window_equals_quitting() { Services.obs.addObserver(obs, "browser-lastwindow-close-requested"); let newWin = await BrowserTestUtils.openNewBrowserWindow(); let closedPromise = BrowserTestUtils.windowClosed(newWin); - newWin.BrowserTryToCloseWindow(); + newWin.BrowserCommands.tryToCloseWindow(); await closedPromise; is(observed, 1, "Got a notification for closing the normal window."); Services.obs.removeObserver(obs, "browser-lastwindow-close-requested"); @@ -68,12 +68,12 @@ add_task(async function closing_last_window_equals_quitting() { }); let popupWin = await popupPromise; let closedPromise = BrowserTestUtils.windowClosed(newWin); - newWin.BrowserTryToCloseWindow(); + newWin.BrowserCommands.tryToCloseWindow(); await closedPromise; is(observed, 0, "Got no notification for closing the normal window."); closedPromise = BrowserTestUtils.windowClosed(popupWin); - popupWin.BrowserTryToCloseWindow(); + popupWin.BrowserCommands.tryToCloseWindow(); await closedPromise; is( observed, diff --git a/browser/base/content/test/protectionsUI/browser_protectionsUI.js b/browser/base/content/test/protectionsUI/browser_protectionsUI.js index 5dc6acebf7..e512f7a415 100644 --- a/browser/base/content/test/protectionsUI/browser_protectionsUI.js +++ b/browser/base/content/test/protectionsUI/browser_protectionsUI.js @@ -500,7 +500,7 @@ add_task(async function testNumberOfBlockedTrackers() { // attribute will only be set if the previous counter is zero. Instead, we // wait for the change of the text content of the counter. let updateCounterPromise = new Promise(resolve => { - let mut = new MutationObserver(mutations => { + let mut = new MutationObserver(() => { resolve(); mut.disconnect(); }); diff --git a/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js b/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js index 00281ac415..1346fb94c1 100644 --- a/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js +++ b/browser/base/content/test/protectionsUI/browser_protectionsUI_cookies_subview.js @@ -397,7 +397,7 @@ add_task(async function testCookiesSubViewAllowedHeuristic() { let popup; let windowCreated = TestUtils.topicObserved( "chrome-document-global-created", - (subject, data) => { + subject => { popup = subject; return true; } diff --git a/browser/base/content/test/protectionsUI/browser_protectionsUI_fetch.js b/browser/base/content/test/protectionsUI/browser_protectionsUI_fetch.js index 26b131d4eb..02aa21474d 100644 --- a/browser/base/content/test/protectionsUI/browser_protectionsUI_fetch.js +++ b/browser/base/content/test/protectionsUI/browser_protectionsUI_fetch.js @@ -15,7 +15,7 @@ add_task(async function test_fetch() { await SpecialPowers.spawn(newTabBrowser, [], async function () { await content.wrappedJSObject .test_fetch() - .then(response => Assert.ok(false, "should have denied the request")) + .then(() => Assert.ok(false, "should have denied the request")) .catch(e => Assert.ok(true, `Caught exception: ${e}`)); }); await contentBlockingEvent; diff --git a/browser/base/content/test/protectionsUI/browser_protectionsUI_info_message.js b/browser/base/content/test/protectionsUI/browser_protectionsUI_info_message.js index fadfaaab98..1e07db2689 100644 --- a/browser/base/content/test/protectionsUI/browser_protectionsUI_info_message.js +++ b/browser/base/content/test/protectionsUI/browser_protectionsUI_info_message.js @@ -51,10 +51,10 @@ add_task(async function testPanelInfoMessage() { }); // Test that the info message is displayed when the panel opens - let container = document.getElementById("messaging-system-message-container"); + let container = document.getElementById("info-message-container"); let message = document.getElementById("protections-popup-message"); let learnMoreLink = document.querySelector( - "#messaging-system-message-container .text-link" + "#info-message-container .text-link" ); // Check the visibility of the info message. diff --git a/browser/base/content/test/referrer/head.js b/browser/base/content/test/referrer/head.js index c812d73e80..34a5f2a58e 100644 --- a/browser/base/content/test/referrer/head.js +++ b/browser/base/content/test/referrer/head.js @@ -165,7 +165,7 @@ function delayedStartupFinished(aWindow) { * @return {Promise} * @resolves With the tab once it's loaded. */ -function someTabLoaded(aWindow) { +function someTabLoaded() { return BrowserTestUtils.waitForNewTab(gTestWindow.gBrowser, null, true); } diff --git a/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js b/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js index ada8286437..ff6badb535 100644 --- a/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js +++ b/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js @@ -15,10 +15,10 @@ function checkDataForAboutURL() { {} ); let request = indexedDB.openForPrincipal(principal, "TestDatabase", 1); - request.onupgradeneeded = function (e) { + request.onupgradeneeded = function () { data = false; }; - request.onsuccess = function (e) { + request.onsuccess = function () { resolve(data); }; }); diff --git a/browser/base/content/test/sanitize/browser_sanitize-timespans.js b/browser/base/content/test/sanitize/browser_sanitize-timespans.js index f9be12775b..28b528d71f 100644 --- a/browser/base/content/test/sanitize/browser_sanitize-timespans.js +++ b/browser/base/content/test/sanitize/browser_sanitize-timespans.js @@ -20,7 +20,7 @@ function promiseFormHistoryRemoved() { function promiseDownloadRemoved(list) { return new Promise(resolve => { let view = { - onDownloadRemoved(download) { + onDownloadRemoved() { list.removeView(view); resolve(); }, diff --git a/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js b/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js index c732262a1a..067a651890 100644 --- a/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js +++ b/browser/base/content/test/sanitize/browser_sanitize-timespans_v2.js @@ -23,7 +23,7 @@ function promiseFormHistoryRemoved() { function promiseDownloadRemoved(list) { return new Promise(resolve => { let view = { - onDownloadRemoved(download) { + onDownloadRemoved() { list.removeView(view); resolve(); }, diff --git a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js index 8ae0263c82..ecdc5490d4 100644 --- a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js +++ b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2.js @@ -844,14 +844,14 @@ add_task(async function testLoadtimeTelemetry() { let loadTimeDistribution = Glean.privacySanitize.loadTime.testGetValue(); let expectedNumberOfCounts = Object.entries(EXPECTED_CONTEXT_COUNTS).reduce( - (acc, [key, value]) => acc + value, + (acc, [, value]) => acc + value, 0 ); // No guarantees from timers means no guarantees on buckets. // But we can guarantee it's only two samples. is( Object.entries(loadTimeDistribution.values).reduce( - (acc, [bucket, count]) => acc + count, + (acc, [, count]) => acc + count, 0 ), expectedNumberOfCounts, diff --git a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js index ccb3c7d519..736df32e81 100644 --- a/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js +++ b/browser/base/content/test/sanitize/browser_sanitizeDialog_v2_dataSizes.js @@ -10,6 +10,14 @@ ChromeUtils.defineESModuleGetters(this, { Sanitizer: "resource:///modules/Sanitizer.sys.mjs", }); +const LARGE_USAGE_NUM = 100000000000000000000000000000000000000000000000000; + +function isIframeOverflowing(win) { + return ( + win.scrollWidth > win.clientWidth || win.scrollHeight > win.clientHeight + ); +} + add_setup(async function () { await blankSlate(); registerCleanupFunction(async function () { @@ -275,7 +283,7 @@ add_task(async function testClearingBeforeDataSizesLoad() { info("stub called"); info("This promise should never resolve"); - await new Promise(resolve => {}); + await new Promise(() => {}); }); dh.onload = async function () { // we don't need to initiate a event listener to wait for the resolver to be assigned for this @@ -308,3 +316,58 @@ add_task(async function testClearingBeforeDataSizesLoad() { // Restore the sandbox after the test is complete sandbox.restore(); }); + +// tests the dialog resizing upon wrapping of text +// so that the clear buttons do not get cut out of the dialog. +add_task(async function testPossibleWrappingOfDialog() { + await blankSlate(); + + let dh = new ClearHistoryDialogHelper({ + checkingDataSizes: true, + }); + // Create a sandbox for isolated stubbing within the test + let sandbox = sinon.createSandbox(); + sandbox + .stub(SiteDataManager, "getQuotaUsageForTimeRanges") + .callsFake(async () => { + info("stubbed getQuotaUsageForTimeRanges called"); + + return { + TIMESPAN_HOUR: 0, + TIMESPAN_2HOURS: 0, + TIMESPAN_4HOURS: LARGE_USAGE_NUM, + TIMESPAN_TODAY: 0, + TIMESPAN_EVERYTHING: 0, + }; + }); + + dh.onload = async function () { + let windowObj = + window.browsingContext.topChromeWindow.gDialogBox._dialog._frame + .contentWindow; + let promise = new Promise(resolve => { + windowObj.addEventListener("resize", resolve); + }); + this.selectDuration(Sanitizer.TIMESPAN_4HOURS); + + await promise; + ok( + !isIframeOverflowing(windowObj.document.getElementById("SanitizeDialog")), + "There should be no overflow on wrapping in the dialog" + ); + + this.selectDuration(Sanitizer.TIMESPAN_2HOURS); + await promise; + ok( + !isIframeOverflowing(windowObj.document.getElementById("SanitizeDialog")), + "There should be no overflow on wrapping in the dialog" + ); + + this.cancelDialog(); + }; + dh.open(); + await dh.promiseClosed; + + // Restore the sandbox after the test is complete + sandbox.restore(); +}); diff --git a/browser/base/content/test/sanitize/head.js b/browser/base/content/test/sanitize/head.js index 30d96c69f6..1b41226fd1 100644 --- a/browser/base/content/test/sanitize/head.js +++ b/browser/base/content/test/sanitize/head.js @@ -49,10 +49,10 @@ function checkIndexedDB(host, originAttributes) { originAttributes ); let request = indexedDB.openForPrincipal(principal, "TestDatabase", 1); - request.onupgradeneeded = function (e) { + request.onupgradeneeded = function () { data = false; }; - request.onsuccess = function (e) { + request.onsuccess = function () { resolve(data); }; }); diff --git a/browser/base/content/test/sidebar/browser_sidebar_move.js b/browser/base/content/test/sidebar/browser_sidebar_move.js index 3de26b7966..d434b3bbd8 100644 --- a/browser/base/content/test/sidebar/browser_sidebar_move.js +++ b/browser/base/content/test/sidebar/browser_sidebar_move.js @@ -4,15 +4,17 @@ registerCleanupFunction(() => { }); const EXPECTED_START_ORDINALS = [ - ["sidebar-box", 1], - ["sidebar-splitter", 2], - ["appcontent", 3], + ["sidebar-launcher", 1], + ["sidebar-box", 2], + ["sidebar-splitter", 3], + ["appcontent", 4], ]; const EXPECTED_END_ORDINALS = [ - ["sidebar-box", 3], - ["sidebar-splitter", 2], - ["appcontent", 1], + ["sidebar-launcher", 5], + ["sidebar-box", 4], + ["sidebar-splitter", 3], + ["appcontent", 2], ]; function getBrowserChildrenWithOrdinals() { diff --git a/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js b/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js index 858cd3d632..79b6d216c5 100644 --- a/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js +++ b/browser/base/content/test/siteIdentity/browser_identityBlock_focus.js @@ -98,7 +98,7 @@ add_task(async function testWithNotifications() { // Checks that with invalid pageproxystate the identity block is ignored. add_task(async function testInvalidPageProxyState() { await SpecialPowers.pushPrefEnv({ set: [["accessibility.tabfocus", 7]] }); - await BrowserTestUtils.withNewTab("about:blank", async function (browser) { + await BrowserTestUtils.withNewTab("about:blank", async function () { // Loading about:blank will automatically focus the urlbar, which, however, can // race with the test code. So we only send the shortcut if the urlbar isn't focused yet. if (document.activeElement != gURLBar.inputField) { diff --git a/browser/base/content/test/siteIdentity/browser_identityPopup_clearSiteData.js b/browser/base/content/test/siteIdentity/browser_identityPopup_clearSiteData.js index 0107814b98..ff77b42ed8 100644 --- a/browser/base/content/test/siteIdentity/browser_identityPopup_clearSiteData.js +++ b/browser/base/content/test/siteIdentity/browser_identityPopup_clearSiteData.js @@ -67,7 +67,7 @@ async function testClearing( }); } - await BrowserTestUtils.withNewTab(testURI, async function (browser) { + await BrowserTestUtils.withNewTab(testURI, async function () { // Verify we have added quota storage. if (testQuota) { let usage = await SiteDataTestUtils.getQuotaUsage(originA); diff --git a/browser/base/content/test/siteIdentity/browser_navigation_failures.js b/browser/base/content/test/siteIdentity/browser_navigation_failures.js index ac3fcc4067..f71552cdcf 100644 --- a/browser/base/content/test/siteIdentity/browser_navigation_failures.js +++ b/browser/base/content/test/siteIdentity/browser_navigation_failures.js @@ -85,10 +85,10 @@ function startServer(cert) { output = transport.openOutputStream(0, 0, 0); }, - onHandshakeDone(socket, status) { + onHandshakeDone() { input.asyncWait( { - onInputStreamReady(readyInput) { + onInputStreamReady() { try { input.close(); output.close(); diff --git a/browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js b/browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js index 9dce76266a..bd004bae1b 100644 --- a/browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js +++ b/browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js @@ -19,7 +19,7 @@ const NOT_SECURE_LABEL = Services.prefs.getBoolPref( * @param {string} uri - URI of the page to test with. */ async function testPageInfoNotEncrypted(uri) { - let pageInfo = BrowserPageInfo(uri, "securityTab"); + let pageInfo = BrowserCommands.pageInfo(uri, "securityTab"); await BrowserTestUtils.waitForEvent(pageInfo, "load"); let pageInfoDoc = pageInfo.document; let securityTab = pageInfoDoc.getElementById("securityTab"); @@ -87,7 +87,7 @@ function startServer(cert) { output = transport.openOutputStream(0, 0, 0); }, - onHandshakeDone(socket, status) { + onHandshakeDone() { input.asyncWait( { onInputStreamReady(readyInput) { @@ -152,7 +152,7 @@ add_task(async function () { QueryInterface: ChromeUtils.generateQI(["nsISystemProxySettings"]), mainThreadOnly: true, PACURI: null, - getProxyForURI: (aSpec, aScheme, aHost, aPort) => { + getProxyForURI: () => { return `HTTPS localhost:${server.port}`; }, }; @@ -181,7 +181,7 @@ add_task(async function () { // secure, in a real situation the connection from the proxy to // http://example.com won't be secure, so we treat it as not secure. // eslint-disable-next-line @microsoft/sdl/no-insecure-url - await BrowserTestUtils.withNewTab("http://example.com/", async browser => { + await BrowserTestUtils.withNewTab("http://example.com/", async () => { let identityMode = window.document.getElementById("identity-box").className; is( identityMode, diff --git a/browser/base/content/test/siteIdentity/head.js b/browser/base/content/test/siteIdentity/head.js index 733796ffb7..9936a8bf6f 100644 --- a/browser/base/content/test/siteIdentity/head.js +++ b/browser/base/content/test/siteIdentity/head.js @@ -244,12 +244,12 @@ async function assertMixedContentBlockingState(tabbrowser, states = {}) { ); gIdentityHandler._identityIconBox.click(); await promisePanelOpen; - let popupAttr = doc - .getElementById("identity-popup") - .getAttribute("mixedcontent"); - let bodyAttr = doc - .getElementById("identity-popup-securityView-extended-info") - .getAttribute("mixedcontent"); + let popupAttr = + doc.getElementById("identity-popup").getAttribute("mixedcontent") || ""; + let bodyAttr = + doc + .getElementById("identity-popup-securityView-extended-info") + .getAttribute("mixedcontent") || ""; is( popupAttr.includes("active-loaded"), diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 5e83443ec7..d73c3fe8de 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -81,6 +81,9 @@ var gExceptionPaths = [ // CSS files are referenced inside JS in an html template "chrome://browser/content/aboutlogins/components/", + + // Strip on Share parameter lists + "chrome://global/content/antitracking/", ]; // These are not part of the omni.ja file, so we find them only when running @@ -99,13 +102,6 @@ if (AppConstants.MOZ_BACKGROUNDTASKS) { gExceptionPaths.push("resource://app/modules/backgroundtasks/"); } -if (AppConstants.NIGHTLY_BUILD) { - // This is nightly-only debug tool. - gExceptionPaths.push( - "chrome://browser/content/places/interactionsViewer.html" - ); -} - // Each allowlist entry should have a comment indicating which file is // referencing the listed file in a way that the test can't detect, or a // bug number to remove or use the file if it is indeed currently unreferenced. @@ -283,6 +279,9 @@ var allowlist = [ // Bug 1875361 { file: "chrome://global/content/ml/SummarizerModel.sys.mjs" }, + // Bug 1886130 + { file: "chrome://global/content/ml/ModelHub.sys.mjs" }, + // toolkit/xre/MacRunFromDmgUtils.mm { file: "resource://gre/localization/en-US/toolkit/global/run-from-dmg.ftl" }, @@ -293,6 +292,19 @@ var allowlist = [ { file: "chrome://browser/content/screenshots/download-white.svg" }, ]; +if (AppConstants.NIGHTLY_BUILD) { + allowlist.push( + ...[ + // This is nightly-only debug tool. + { file: "chrome://browser/content/places/interactionsViewer.html" }, + + // A debug tool that is only available in Nightly builds, and is accessed + // directly by developers via the chrome URI (bug 1888491) + { file: "chrome://browser/content/backup/debug.html" }, + ] + ); +} + if (AppConstants.platform != "win") { // toolkit/mozapps/defaultagent/Notification.cpp // toolkit/mozapps/defaultagent/ScheduledTask.cpp diff --git a/browser/base/content/test/static/browser_parsable_css.js b/browser/base/content/test/static/browser_parsable_css.js index 602cc5a7e2..fb91da578a 100644 --- a/browser/base/content/test/static/browser_parsable_css.js +++ b/browser/base/content/test/static/browser_parsable_css.js @@ -14,12 +14,6 @@ let ignoreList = [ { sourceName: /codemirror\.css$/i, isFromDevTools: true }, // UA-only media features. { - sourceName: /\b(autocomplete-item)\.css$/, - errorMessage: /Expected media feature name but found \u2018-moz.*/i, - isFromDevTools: false, - platforms: ["windows"], - }, - { sourceName: /\b(contenteditable|EditorOverride|svg|forms|html|mathml|ua)\.css$/i, errorMessage: /Unknown pseudo-class.*-moz-/i, @@ -27,7 +21,7 @@ let ignoreList = [ }, { sourceName: - /\b(scrollbars|xul|html|mathml|ua|forms|svg|manageDialog|autocomplete-item-shared|formautofill)\.css$/i, + /\b(scrollbars|xul|html|mathml|ua|forms|svg|manageDialog|formautofill)\.css$/i, errorMessage: /Unknown property.*-moz-/i, isFromDevTools: false, }, @@ -123,6 +117,8 @@ let propNameAllowlist = [ isFromDevTools: false, }, { propName: "--browser-stack-z-index-rdm-toolbar", isFromDevTools: false }, + // about:profiling is in devtools even though it uses non-devtools styles. + { propName: "--in-content-border-hover", isFromDevTools: false }, // These variables are specified from devtools but read from non-devtools // styles, which confuses the test. @@ -434,13 +430,13 @@ add_task(async function checkAllTheCSS() { let loadCSS = chromeUri => new Promise(resolve => { let linkEl, onLoad, onError; - onLoad = e => { + onLoad = () => { processCSSRules(linkEl.sheet); resolve(); linkEl.removeEventListener("load", onLoad); linkEl.removeEventListener("error", onError); }; - onError = e => { + onError = () => { ok( false, "Loading " + linkEl.getAttribute("href") + " threw an error!" diff --git a/browser/base/content/test/static/browser_parsable_script.js b/browser/base/content/test/static/browser_parsable_script.js index d4dcbd87fe..3d8fbc1535 100644 --- a/browser/base/content/test/static/browser_parsable_script.js +++ b/browser/base/content/test/static/browser_parsable_script.js @@ -22,9 +22,9 @@ const kESModuleList = new Set([ /chrome\/pdfjs\/content\/web\/.*\.js$/, ]); -// Normally we would use reflect.jsm to get Reflect.parse. However, if -// we do that, then all the AST data is allocated in reflect.jsm's -// zone. That exposes a bug in our GC. The GC collects reflect.jsm's +// Normally we would use reflect.sys.mjs to get Reflect.parse. However, if +// we do that, then all the AST data is allocated in reflect.sys.mjs's +// zone. That exposes a bug in our GC. The GC collects reflect.sys.mjs's // zone but not the zone in which our test code lives (since no new // data is being allocated in it). The cross-compartment wrappers in // our zone that point to the AST data never get collected, and so the @@ -69,7 +69,7 @@ function uriIsESModule(uri) { } function parsePromise(uri, parseTarget) { - let promise = new Promise((resolve, reject) => { + let promise = new Promise(resolve => { let xhr = new XMLHttpRequest(); xhr.open("GET", uri, true); xhr.onreadystatechange = function () { diff --git a/browser/base/content/test/static/head.js b/browser/base/content/test/static/head.js index d9b978e853..317ad430af 100644 --- a/browser/base/content/test/static/head.js +++ b/browser/base/content/test/static/head.js @@ -135,7 +135,7 @@ function* generateEntriesFromJarFile(jarFile, extension) { } function fetchFile(uri) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let xhr = new XMLHttpRequest(); xhr.responseType = "text"; xhr.open("GET", uri, true); diff --git a/browser/base/content/test/sync/browser_contextmenu_sendtab.js b/browser/base/content/test/sync/browser_contextmenu_sendtab.js index 4922869c1d..bc49680e37 100644 --- a/browser/base/content/test/sync/browser_contextmenu_sendtab.js +++ b/browser/base/content/test/sync/browser_contextmenu_sendtab.js @@ -323,7 +323,7 @@ async function openTabContextMenu(openSubmenuId = null) { function promiseObserver(topic) { return new Promise(resolve => { - let obs = (aSubject, aTopic, aData) => { + let obs = (aSubject, aTopic) => { Services.obs.removeObserver(obs, aTopic); resolve(aSubject); }; diff --git a/browser/base/content/test/sync/browser_fxa_web_channel.js b/browser/base/content/test/sync/browser_fxa_web_channel.js index c232f26f26..23c5510422 100644 --- a/browser/base/content/test/sync/browser_fxa_web_channel.js +++ b/browser/base/content/test/sync/browser_fxa_web_channel.js @@ -27,7 +27,7 @@ var gTests = [ content_uri: TEST_HTTP_PATH, channel_id: TEST_CHANNEL_ID, }); - let promiseObserver = new Promise((resolve, reject) => { + let promiseObserver = new Promise(resolve => { makeObserver( ON_PROFILE_CHANGE_NOTIFICATION, function (subject, topic, data) { @@ -52,7 +52,7 @@ var gTests = [ { desc: "fxa web channel - login messages should notify the fxAccounts object", async run() { - let promiseLogin = new Promise((resolve, reject) => { + let promiseLogin = new Promise(resolve => { let login = accountData => { Assert.equal(typeof accountData.authAt, "number"); Assert.equal(accountData.email, "testuser@testuser.com"); @@ -91,7 +91,7 @@ var gTests = [ async run() { let properUrl = TEST_BASE_URL + "?can_link_account"; - let promiseEcho = new Promise((resolve, reject) => { + let promiseEcho = new Promise(resolve => { let webChannelOrigin = Services.io.newURI(properUrl); // responses sent to content are echoed back over the // `fxaccounts_webchannel_response_echo` channel. Ensure the @@ -100,7 +100,7 @@ var gTests = [ "fxaccounts_webchannel_response_echo", webChannelOrigin ); - echoWebChannel.listen((webChannelId, message, target) => { + echoWebChannel.listen((webChannelId, message) => { Assert.equal(message.command, "fxaccounts:can_link_account"); Assert.equal(message.messageId, 2); Assert.equal(message.data.ok, true); @@ -136,7 +136,7 @@ var gTests = [ { desc: "fxa web channel - logout messages should notify the fxAccounts object", async run() { - let promiseLogout = new Promise((resolve, reject) => { + let promiseLogout = new Promise(resolve => { let logout = uid => { Assert.equal(uid, "uid"); @@ -167,7 +167,7 @@ var gTests = [ { desc: "fxa web channel - delete messages should notify the fxAccounts object", async run() { - let promiseDelete = new Promise((resolve, reject) => { + let promiseDelete = new Promise(resolve => { let logout = uid => { Assert.equal(uid, "uid"); @@ -199,8 +199,8 @@ var gTests = [ desc: "fxa web channel - firefox_view messages should call the openFirefoxView helper", async run() { let wasCalled = false; - let promiseMessageHandled = new Promise((resolve, reject) => { - let openFirefoxView = (browser, entryPoint) => { + let promiseMessageHandled = new Promise(resolve => { + let openFirefoxView = browser => { wasCalled = true; Assert.ok( !!browser.ownerGlobal, diff --git a/browser/base/content/test/sync/browser_sync.js b/browser/base/content/test/sync/browser_sync.js index 168c6f22b0..8f687842a4 100644 --- a/browser/base/content/test/sync/browser_sync.js +++ b/browser/base/content/test/sync/browser_sync.js @@ -772,7 +772,7 @@ function checkSyncNowButtons(syncing, tooltip = null) { for (const syncButton of syncButtons) { is( syncButton.getAttribute("syncstatus"), - syncing ? "active" : "", + syncing ? "active" : null, "button active has the right value" ); if (tooltip) { @@ -894,7 +894,7 @@ function checkItemsVisibilities(itemsIds, expectedShownItemId) { function promiseObserver(topic) { return new Promise(resolve => { - let obs = (aSubject, aTopic, aData) => { + let obs = (aSubject, aTopic) => { Services.obs.removeObserver(obs, aTopic); resolve(aSubject); }; diff --git a/browser/base/content/test/tabPrompts/browser_abort_when_in_modal_state.js b/browser/base/content/test/tabPrompts/browser_abort_when_in_modal_state.js index cb3a1f72d6..d6d2434017 100644 --- a/browser/base/content/test/tabPrompts/browser_abort_when_in_modal_state.js +++ b/browser/base/content/test/tabPrompts/browser_abort_when_in_modal_state.js @@ -8,14 +8,10 @@ const { PromiseTestUtils } = ChromeUtils.importESModule( ); /** - * Check that if we're using a window-modal prompt, - * the next synchronous window-internal modal prompt aborts rather than - * leaving us in a deadlock about how to enter modal state. + * Check that the next synchronous window-internal modal prompt aborts rather + * than leaving us in a deadlock about how to enter modal state. */ add_task(async function test_check_multiple_prompts() { - await SpecialPowers.pushPrefEnv({ - set: [["prompts.windowPromptSubDialog", true]], - }); let container = document.getElementById("window-modal-dialog"); let dialogPromise = BrowserTestUtils.promiseAlertDialogOpen(); diff --git a/browser/base/content/test/tabPrompts/browser_auth_spoofing_protection.js b/browser/base/content/test/tabPrompts/browser_auth_spoofing_protection.js index 86d7c992c5..1211694973 100644 --- a/browser/base/content/test/tabPrompts/browser_auth_spoofing_protection.js +++ b/browser/base/content/test/tabPrompts/browser_auth_spoofing_protection.js @@ -119,7 +119,7 @@ async function waitForDialog(doConfirmPrompt, crossDomain, prefEnabled) { } else { Assert.equal( dialog._overlay.getAttribute("hideContent"), - "", + null, "Dialog overlay does not hide the current sites content" ); Assert.equal( @@ -137,7 +137,7 @@ async function waitForDialog(doConfirmPrompt, crossDomain, prefEnabled) { } else { Assert.equal( dialog._overlay.getAttribute("hideContent"), - "", + null, "Dialog overlay does not hide the current sites content" ); Assert.equal( diff --git a/browser/base/content/test/tabPrompts/browser_contentOrigins.js b/browser/base/content/test/tabPrompts/browser_contentOrigins.js index 2bf4ba6039..0c40763a99 100644 --- a/browser/base/content/test/tabPrompts/browser_contentOrigins.js +++ b/browser/base/content/test/tabPrompts/browser_contentOrigins.js @@ -127,12 +127,6 @@ async function checkDialog( }); } -add_setup(async function () { - await SpecialPowers.pushPrefEnv({ - set: [["prompts.modalType.httpAuth", Ci.nsIPrompt.MODAL_TYPE_TAB]], - }); -}); - add_task(async function test_check_prompt_origin_display() { await checkAlert("https://example.com/", { value: "example.com" }); // eslint-disable-next-line @microsoft/sdl/no-insecure-url diff --git a/browser/base/content/test/tabPrompts/browser_windowPrompt.js b/browser/base/content/test/tabPrompts/browser_windowPrompt.js index 535142f485..0aca489b50 100644 --- a/browser/base/content/test/tabPrompts/browser_windowPrompt.js +++ b/browser/base/content/test/tabPrompts/browser_windowPrompt.js @@ -7,9 +7,6 @@ * Check that the in-window modal dialogs work correctly. */ add_task(async function test_check_window_modal_prompt_service() { - await SpecialPowers.pushPrefEnv({ - set: [["prompts.windowPromptSubDialog", true]], - }); let dialogPromise = BrowserTestUtils.promiseAlertDialogOpen(); // Avoid blocking the test on the (sync) alert by sticking it in a timeout: setTimeout( @@ -69,9 +66,6 @@ add_task(async function test_check_window_modal_prompt_service() { * Check that the dialog's own closing methods being invoked don't break things. */ add_task(async function test_check_window_modal_prompt_service() { - await SpecialPowers.pushPrefEnv({ - set: [["prompts.windowPromptSubDialog", true]], - }); let dialogPromise = BrowserTestUtils.promiseAlertDialogOpen(); // Avoid blocking the test on the (sync) alert by sticking it in a timeout: setTimeout( @@ -105,9 +99,6 @@ add_task(async function test_check_window_modal_prompt_service() { }); add_task(async function test_check_multiple_prompts() { - await SpecialPowers.pushPrefEnv({ - set: [["prompts.windowPromptSubDialog", true]], - }); let container = document.getElementById("window-modal-dialog"); let dialogPromise = BrowserTestUtils.promiseAlertDialogOpen(); @@ -173,9 +164,6 @@ add_task(async function test_check_minimize_response() { if (AppConstants.platform == "linux") { return; } - await SpecialPowers.pushPrefEnv({ - set: [["prompts.windowPromptSubDialog", true]], - }); let promiseSizeModeChange = BrowserTestUtils.waitForEvent( window, @@ -235,10 +223,6 @@ add_task(async function test_check_minimize_response() { * underlying SubDialog has fully opened. */ add_task(async function test_closed_callback() { - await SpecialPowers.pushPrefEnv({ - set: [["prompts.windowPromptSubDialog", true]], - }); - let promptClosedPromise = Services.prompt.asyncAlert( window.browsingContext, Services.prompt.MODAL_TYPE_INTERNAL_WINDOW, diff --git a/browser/base/content/test/tabcrashed/browser_aboutRestartRequired.toml b/browser/base/content/test/tabcrashed/browser_aboutRestartRequired.toml index 88988434fb..8f8648d810 100644 --- a/browser/base/content/test/tabcrashed/browser_aboutRestartRequired.toml +++ b/browser/base/content/test/tabcrashed/browser_aboutRestartRequired.toml @@ -14,8 +14,10 @@ prefs = [ #["browser_aboutRestartRequired_buildid_false-positive.js"] #skip-if = ["win11_2009 && msix && debug"] # bug 1823581 -["browser_aboutRestartRequired_buildid_mismatch.js"] -skip-if = ["win11_2009 && msix && debug"] # bug 1823581 +# Bug 1888355: re-enable once bug 1877361 is fixed +#["browser_aboutRestartRequired_buildid_mismatch.js"] +#skip-if = ["win11_2009 && msix && debug"] # bug 1823581 -["browser_aboutRestartRequired_buildid_no-platform-ini.js"] -skip-if = ["win11_2009 && msix && debug"] # bug 1823581 +# Bug 1888355: re-enable once bug 1877361 is fixed +#["browser_aboutRestartRequired_buildid_no-platform-ini.js"] +#skip-if = ["win11_2009 && msix && debug"] # bug 1823581 diff --git a/browser/base/content/test/tabcrashed/browser_aboutRestartRequired_noForkServer.toml b/browser/base/content/test/tabcrashed/browser_aboutRestartRequired_noForkServer.toml index ec045ddf79..ddb49a0e26 100644 --- a/browser/base/content/test/tabcrashed/browser_aboutRestartRequired_noForkServer.toml +++ b/browser/base/content/test/tabcrashed/browser_aboutRestartRequired_noForkServer.toml @@ -12,3 +12,11 @@ prefs = [ # Bug 1876056: remove once bug 1877361 is fixed ["browser_aboutRestartRequired_buildid_false-positive.js"] skip-if = ["win11_2009 && msix && debug"] # bug 1823581 + +# Bug 1888355: re-enable once bug 1877361 is fixed +["browser_aboutRestartRequired_buildid_mismatch.js"] +skip-if = ["win11_2009 && msix && debug"] # bug 1823581 + +# Bug 1888355: re-enable once bug 1877361 is fixed +["browser_aboutRestartRequired_buildid_no-platform-ini.js"] +skip-if = ["win11_2009 && msix && debug"] # bug 1823581 diff --git a/browser/base/content/test/tabcrashed/head.js b/browser/base/content/test/tabcrashed/head.js index bb57c85d6d..b4e9137012 100644 --- a/browser/base/content/test/tabcrashed/head.js +++ b/browser/base/content/test/tabcrashed/head.js @@ -117,7 +117,7 @@ async function setupLocalCrashReportServer() { // reports. This test needs them enabled. The test also needs a mock // report server, and fortunately one is already set up by toolkit/ // crashreporter/test/Makefile.in. Assign its URL to MOZ_CRASHREPORTER_URL, - // which CrashSubmit.jsm uses as a server override. + // which CrashSubmit.sys.mjs uses as a server override. let noReport = Services.env.get("MOZ_CRASHREPORTER_NO_REPORT"); let serverUrl = Services.env.get("MOZ_CRASHREPORTER_URL"); Services.env.set("MOZ_CRASHREPORTER_NO_REPORT", ""); @@ -135,7 +135,7 @@ async function setupLocalCrashReportServer() { */ function prepareNoDump() { let originalGetDumpID = TabCrashHandler.getDumpID; - TabCrashHandler.getDumpID = function (browser) { + TabCrashHandler.getDumpID = function () { return null; }; registerCleanupFunction(() => { @@ -156,11 +156,11 @@ function unsetBuildidMatchDontSendEnv() { } function getEventPromise(eventName, eventKind) { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { info("Installing event listener (" + eventKind + ")"); window.addEventListener( eventName, - event => { + () => { ok(true, "Received " + eventName + " (" + eventKind + ") event"); info("Call resolve() for " + eventKind + " event"); resolve(); diff --git a/browser/base/content/test/tabs/browser.toml b/browser/base/content/test/tabs/browser.toml index 1b4a6900bf..fa77a8b1a4 100644 --- a/browser/base/content/test/tabs/browser.toml +++ b/browser/base/content/test/tabs/browser.toml @@ -76,6 +76,8 @@ support-files = ["tab_that_closes.html"] ["browser_hiddentab_contextmenu.js"] +["browser_lastSeenActive.js"] + ["browser_lazy_tab_browser_events.js"] ["browser_link_in_tab_title_and_url_prefilled_blank_page.js"] diff --git a/browser/base/content/test/tabs/browser_allow_process_switches_despite_related_browser.js b/browser/base/content/test/tabs/browser_allow_process_switches_despite_related_browser.js index b782c3aada..fea1de8fe0 100644 --- a/browser/base/content/test/tabs/browser_allow_process_switches_despite_related_browser.js +++ b/browser/base/content/test/tabs/browser_allow_process_switches_despite_related_browser.js @@ -13,7 +13,7 @@ add_task(async function () { }); let promiseTab = BrowserTestUtils.waitForNewTab(gBrowser, DATA_URI_SOURCE); - BrowserViewSource(tab.linkedBrowser); + BrowserCommands.viewSource(tab.linkedBrowser); let viewSourceTab = await promiseTab; registerCleanupFunction(async function () { BrowserTestUtils.removeTab(viewSourceTab); diff --git a/browser/base/content/test/tabs/browser_audioTabIcon.js b/browser/base/content/test/tabs/browser_audioTabIcon.js index 53b5140abb..c065e2b173 100644 --- a/browser/base/content/test/tabs/browser_audioTabIcon.js +++ b/browser/base/content/test/tabs/browser_audioTabIcon.js @@ -396,7 +396,7 @@ async function test_swapped_browser_while_not_playing(oldTab, newBrowser) { ); let AudioPlaybackPromise = new Promise(resolve => { - let observer = (subject, topic, data) => { + let observer = () => { ok(false, "Should not see an audio-playback notification"); }; Services.obs.addObserver(observer, "audio-playback"); @@ -443,7 +443,7 @@ async function test_swapped_browser_while_not_playing(oldTab, newBrowser) { await test_tooltip(newTab.overlayIcon, "Unmute tab", true, newTab); } -async function test_browser_swapping(tab, browser) { +async function test_browser_swapping(tab) { // First, test swapping with a playing but muted tab. await play(tab); diff --git a/browser/base/content/test/tabs/browser_e10s_about_page_triggeringprincipal.js b/browser/base/content/test/tabs/browser_e10s_about_page_triggeringprincipal.js index 4610551977..8fbee64db4 100644 --- a/browser/base/content/test/tabs/browser_e10s_about_page_triggeringprincipal.js +++ b/browser/base/content/test/tabs/browser_e10s_about_page_triggeringprincipal.js @@ -86,7 +86,7 @@ add_task(async function test_principal_ctrl_click() { await BrowserTestUtils.withNewTab( "about:test-about-principal-parent", - async function (browser) { + async function () { let loadPromise = BrowserTestUtils.waitForNewTab( gBrowser, "about:test-about-principal-child", @@ -149,7 +149,7 @@ add_task(async function test_principal_right_click_open_link_in_new_tab() { await BrowserTestUtils.withNewTab( "about:test-about-principal-parent", - async function (browser) { + async function () { let loadPromise = BrowserTestUtils.waitForNewTab( gBrowser, "about:test-about-principal-child", diff --git a/browser/base/content/test/tabs/browser_e10s_about_process.js b/browser/base/content/test/tabs/browser_e10s_about_process.js index f73e8e659c..504dfe0265 100644 --- a/browser/base/content/test/tabs/browser_e10s_about_process.js +++ b/browser/base/content/test/tabs/browser_e10s_about_process.js @@ -37,7 +37,7 @@ const TEST_MODULES = [ function AboutModule() {} AboutModule.prototype = { - newChannel(aURI, aLoadInfo) { + newChannel() { throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED); }, @@ -52,7 +52,7 @@ AboutModule.prototype = { return 0; }, - getIndexedDBOriginPostfix(aURI) { + getIndexedDBOriginPostfix() { return null; }, diff --git a/browser/base/content/test/tabs/browser_lastSeenActive.js b/browser/base/content/test/tabs/browser_lastSeenActive.js new file mode 100644 index 0000000000..d6bba57d93 --- /dev/null +++ b/browser/base/content/test/tabs/browser_lastSeenActive.js @@ -0,0 +1,260 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +const { SessionStoreTestUtils } = ChromeUtils.importESModule( + "resource://testing-common/SessionStoreTestUtils.sys.mjs" +); + +const triggeringPrincipal_base64 = E10SUtils.SERIALIZED_SYSTEMPRINCIPAL; + +SessionStoreTestUtils.init(this, window); +// take a state snapshot we can restore to after each test +const ORIG_STATE = SessionStore.getBrowserState(); + +const SECOND_MS = 1000; +const DAY_MS = 24 * 60 * 60 * 1000; +const today = new Date().getTime(); +const yesterday = new Date(Date.now() - DAY_MS).getTime(); + +function tabEntry(url, lastAccessed) { + return { + entries: [{ url, triggeringPrincipal_base64 }], + lastAccessed, + }; +} + +/** + * Make the given window focused and active + */ +async function switchToWindow(win) { + info("switchToWindow, waiting for promiseFocus"); + await SimpleTest.promiseFocus(win); + info("switchToWindow, waiting for correct Services.focus.activeWindow"); + await BrowserTestUtils.waitForCondition( + () => Services.focus.activeWindow == win + ); +} + +async function changeSizeMode(win, mode) { + let promise = BrowserTestUtils.waitForEvent(win, "sizemodechange"); + win[mode](); + await promise; +} + +async function cleanup() { + await switchToWindow(window); + await SessionStoreTestUtils.promiseBrowserState(ORIG_STATE); + is( + BrowserWindowTracker.orderedWindows.length, + 1, + "One window at the end of test cleanup" + ); + info("cleanup, browser state restored"); +} + +function deltaTime(time, expectedTime) { + return Math.abs(expectedTime - time); +} + +function getWindowUrl(win) { + return win.gBrowser.selectedBrowser?.currentURI?.spec; +} + +function getWindowByTabUrl(url) { + return BrowserWindowTracker.orderedWindows.find( + win => getWindowUrl(win) == url + ); +} + +add_task(async function restoredTabs() { + const now = Date.now(); + await SessionStoreTestUtils.promiseBrowserState({ + windows: [ + { + tabs: [ + tabEntry("data:,Window0-Tab0", yesterday), + tabEntry("data:,Window0-Tab1", yesterday), + ], + selected: 2, + }, + ], + }); + is( + gBrowser.visibleTabs[1], + gBrowser.selectedTab, + "The selected tab is the 2nd visible tab" + ); + is( + getWindowUrl(window), + "data:,Window0-Tab1", + "The expected tab is selected" + ); + Assert.greaterOrEqual( + gBrowser.selectedTab.lastSeenActive, + now, + "The selected tab's lastSeenActive is now" + ); + Assert.greaterOrEqual( + gBrowser.selectedTab.lastAccessed, + now, + "The selected tab's lastAccessed is now" + ); + + // tab restored from session but never seen or active + is( + gBrowser.visibleTabs[0].lastSeenActive, + yesterday, + "The restored tab's lastSeenActive is yesterday" + ); + await cleanup(); +}); + +add_task(async function switchingTabs() { + let now = Date.now(); + let initialTab = gBrowser.selectedTab; + let applicationStart = Services.startup.getStartupInfo().start.getTime(); + let openedTab = BrowserTestUtils.addTab(gBrowser, "data:,Tab1"); + await BrowserTestUtils.browserLoaded(openedTab.linkedBrowser); + + ok(!openedTab.selected, "The background tab we opened isn't selected"); + Assert.greaterOrEqual( + initialTab.selected && initialTab.lastSeenActive, + now, + "The initial tab is selected and last seen now" + ); + + is( + openedTab.lastSeenActive, + applicationStart, + `Background tab got default lastSeenActive value, delta: ${deltaTime( + openedTab.lastSeenActive, + applicationStart + )}` + ); + + now = Date.now(); + await BrowserTestUtils.switchTab(gBrowser, openedTab); + Assert.greaterOrEqual( + openedTab.lastSeenActive, + now, + "The tab we switched to is last seen now" + ); + + await cleanup(); +}); + +add_task(async function switchingWindows() { + info("Restoring to the test browser state"); + await SessionStoreTestUtils.promiseBrowserState({ + windows: [ + { + tabs: [tabEntry("data:,Window1-Tab0", yesterday)], + selected: 1, + sizemodeBeforeMinimized: "normal", + sizemode: "maximized", + zIndex: 1, // this will be the selected window + }, + { + tabs: [tabEntry("data:,Window2-Tab0", yesterday)], + selected: 1, + sizemodeBeforeMinimized: "normal", + sizemode: "maximized", + zIndex: 2, + }, + ], + }); + info("promiseBrowserState resolved"); + info( + `BrowserWindowTracker.pendingWindows: ${BrowserWindowTracker.pendingWindows.size}` + ); + await Promise.all( + Array.from(BrowserWindowTracker.pendingWindows.values()).map( + win => win.deferred.promise + ) + ); + info("All the pending windows are resolved"); + info("Waiting for the firstBrowserLoaded in each of the windows"); + await Promise.all( + BrowserWindowTracker.orderedWindows.map(win => { + const selectedUrl = getWindowUrl(win); + if (selectedUrl && selectedUrl !== "about:blank") { + return Promise.resolve(); + } + return BrowserTestUtils.firstBrowserLoaded(win, false); + }) + ); + let expectedTabURLs = ["data:,Window1-Tab0", "data:,Window2-Tab0"]; + let [win1, win2] = expectedTabURLs.map(url => getWindowByTabUrl(url)); + if (BrowserWindowTracker.getTopWindow() !== win1) { + info("Switch to win1 which isn't active/top after restoring session"); + // In theory the zIndex values in the session state should make win1 active + // But in practice that isn't always true. To ensure we're testing from a known state, + // ensure the first window is active before proceeding with the test + await switchToWindow(win1); + [win1, win2] = expectedTabURLs.map(url => getWindowByTabUrl(url)); + } + + let actualTabURLs = Array.from(BrowserWindowTracker.orderedWindows).map(win => + getWindowUrl(win) + ); + Assert.deepEqual( + actualTabURLs, + expectedTabURLs, + "Both windows are open with selected tab URLs in the expected order" + ); + + let lastSeenTimes = [win1, win2].map( + win => win.gBrowser.selectedTab.lastSeenActive + ); + + info("Focusing the other window"); + await switchToWindow(win2); + // wait a little so the timestamps will differ and then check again + // eslint-disable-next-line mozilla/no-arbitrary-setTimeout + await new Promise(res => setTimeout(res, 100)); + Assert.greater( + win2.gBrowser.selectedTab.lastSeenActive, + lastSeenTimes[1], + "The foreground window selected tab is last seen more recently than it was before being focused" + ); + Assert.greater( + win2.gBrowser.selectedTab.lastSeenActive, + win1.gBrowser.selectedTab.lastSeenActive, + "The foreground window selected tab is last seen more recently than the backgrounded one" + ); + + lastSeenTimes = [win1, win2].map( + win => win.gBrowser.selectedTab.lastSeenActive + ); + // minimize the foreground window and focus the other + let promiseSizeModeChange = BrowserTestUtils.waitForEvent( + win2, + "sizemodechange" + ); + win2.minimize(); + info("Waiting for the sizemodechange on minimized window"); + await promiseSizeModeChange; + await switchToWindow(win1); + + ok( + !win2.gBrowser.selectedTab.linkedBrowser.docShellIsActive, + "Docshell should be Inactive" + ); + ok(win2.document.hidden, "Minimized windows's document should be hidden"); + + // wait a little so the timestamps will differ and then check again + // eslint-disable-next-line mozilla/no-arbitrary-setTimeout + await new Promise(res => setTimeout(res, 100)); + Assert.greater( + win1.gBrowser.selectedTab.lastSeenActive, + win2.gBrowser.selectedTab.lastSeenActive, + "The foreground window selected tab is last seen more recently than the minimized one" + ); + Assert.greater( + win1.gBrowser.selectedTab.lastSeenActive, + lastSeenTimes[0], + "The foreground window selected tab is last seen more recently than it was before being focused" + ); + + await cleanup(); +}); diff --git a/browser/base/content/test/tabs/browser_lazy_tab_browser_events.js b/browser/base/content/test/tabs/browser_lazy_tab_browser_events.js index 665bdb7f69..5e09225cde 100644 --- a/browser/base/content/test/tabs/browser_lazy_tab_browser_events.js +++ b/browser/base/content/test/tabs/browser_lazy_tab_browser_events.js @@ -93,10 +93,10 @@ add_task(async function test_hidden_muted_lazy_tabs_and_swapping() { mutedTab.toggleMuteAudio(); gBrowser.hideTab(hiddenTab); - is(lazyTab.linkedPanel, "", "lazyTab is lazy"); - is(hiddenTab.linkedPanel, "", "hiddenTab is lazy"); - is(mutedTab.linkedPanel, "", "mutedTab is lazy"); - is(normalTab.linkedPanel, "", "normalTab is lazy"); + is(lazyTab.linkedPanel, null, "lazyTab is lazy"); + is(hiddenTab.linkedPanel, null, "hiddenTab is lazy"); + is(mutedTab.linkedPanel, null, "mutedTab is lazy"); + is(normalTab.linkedPanel, null, "normalTab is lazy"); ok(mutedTab.linkedBrowser.audioMuted, "mutedTab is muted"); ok(hiddenTab.hidden, "hiddenTab is hidden"); @@ -117,7 +117,7 @@ add_task(async function test_hidden_muted_lazy_tabs_and_swapping() { }); gBrowser.swapBrowsersAndCloseOther(lazyTab, mutedTab); tabEventTracker.checkExpectations(); - is(lazyTab.linkedPanel, "", "muted lazyTab is still lazy"); + is(lazyTab.linkedPanel, null, "muted lazyTab is still lazy"); ok(lazyTab.linkedBrowser.audioMuted, "muted lazyTab is now muted"); ok(!lazyTab.hidden, "muted lazyTab is not hidden"); @@ -133,7 +133,7 @@ add_task(async function test_hidden_muted_lazy_tabs_and_swapping() { }); gBrowser.swapBrowsersAndCloseOther(lazyTab, hiddenTab); tabEventTracker.checkExpectations(); - is(lazyTab.linkedPanel, "", "hidden lazyTab is still lazy"); + is(lazyTab.linkedPanel, null, "hidden lazyTab is still lazy"); ok(!lazyTab.linkedBrowser.audioMuted, "hidden lazyTab is not muted any more"); ok(lazyTab.hidden, "hidden lazyTab has been hidden"); @@ -149,7 +149,7 @@ add_task(async function test_hidden_muted_lazy_tabs_and_swapping() { }); gBrowser.swapBrowsersAndCloseOther(lazyTab, normalTab); tabEventTracker.checkExpectations(); - is(lazyTab.linkedPanel, "", "normal lazyTab is still lazy"); + is(lazyTab.linkedPanel, null, "normal lazyTab is still lazy"); ok(!lazyTab.linkedBrowser.audioMuted, "normal lazyTab is not muted any more"); ok(!lazyTab.hidden, "normal lazyTab is not hidden any more"); diff --git a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_blank_target.js b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_blank_target.js index f8773e3720..9212667a35 100644 --- a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_blank_target.js +++ b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_blank_target.js @@ -66,7 +66,7 @@ add_task(async function normal_page__foreground__abort() { tab: WAIT_A_BIT_LOADING_TITLE, urlbar: UrlbarTestUtils.trimURL(WAIT_A_BIT_URL), }, - async actionWhileLoading(onTabLoaded) { + async actionWhileLoading() { info("Abort loading"); document.getElementById("stop-button").click(); }, @@ -160,7 +160,7 @@ add_task(async function normal_page__background__abort() { tab: WAIT_A_BIT_LOADING_TITLE, urlbar: UrlbarTestUtils.trimURL(HOME_URL), }, - async actionWhileLoading(onTabLoaded) { + async actionWhileLoading() { info("Abort loading"); document.getElementById("stop-button").click(); }, diff --git a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_by_script.js b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_by_script.js index 07cf7a8ea2..57e28ca834 100644 --- a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_by_script.js +++ b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_by_script.js @@ -44,7 +44,7 @@ add_task(async function normal_page__by_script__abort() { tab: BLANK_TITLE, urlbar: UrlbarTestUtils.trimURL(BLANK_URL), }, - async actionWhileLoading(onTabLoaded) { + async actionWhileLoading() { info("Abort loading"); document.getElementById("stop-button").click(); }, diff --git a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_no_target.js b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_no_target.js index ab18d7c7e0..464a7c43de 100644 --- a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_no_target.js +++ b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_no_target.js @@ -47,7 +47,7 @@ add_task(async function normal_page__no_target__abort() { tab: HOME_TITLE, urlbar: UrlbarTestUtils.trimURL(HOME_URL), }, - async actionWhileLoading(onTabLoaded) { + async actionWhileLoading() { info("Abort loading"); document.getElementById("stop-button").click(); }, diff --git a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_other_target.js b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_other_target.js index 7dc0e8fa45..53242ca359 100644 --- a/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_other_target.js +++ b/browser/base/content/test/tabs/browser_link_in_tab_title_and_url_prefilled_normal_page_other_target.js @@ -45,7 +45,7 @@ add_task(async function normal_page__other_target__foreground__abort() { tab: BLANK_TITLE, urlbar: UrlbarTestUtils.trimURL(BLANK_URL), }, - async actionWhileLoading(onTabLoaded) { + async actionWhileLoading() { info("Abort loading"); document.getElementById("stop-button").click(); }, @@ -117,7 +117,7 @@ add_task(async function normal_page__other_target__background__abort() { tab: WAIT_A_BIT_LOADING_TITLE, urlbar: UrlbarTestUtils.trimURL(HOME_URL), }, - async actionWhileLoading(onTabLoaded) { + async actionWhileLoading() { info("Abort loading"); document.getElementById("stop-button").click(); }, diff --git a/browser/base/content/test/tabs/browser_long_data_url_label_truncation.js b/browser/base/content/test/tabs/browser_long_data_url_label_truncation.js index db0571a2c0..89952b6c4d 100644 --- a/browser/base/content/test/tabs/browser_long_data_url_label_truncation.js +++ b/browser/base/content/test/tabs/browser_long_data_url_label_truncation.js @@ -33,7 +33,7 @@ add_task(async function test_ensure_truncation() { let fileReader = new FileReader(); const DATA_URL = await new Promise(resolve => { - fileReader.addEventListener("load", e => resolve(fileReader.result)); + fileReader.addEventListener("load", () => resolve(fileReader.result)); fileReader.readAsDataURL(new Blob([MOBY], { type: "text/html" })); }); // Substring the full URL to avoid log clutter because Assert will print diff --git a/browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js b/browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js index d668d21df8..f294769898 100644 --- a/browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js +++ b/browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js @@ -61,9 +61,9 @@ add_task(async function testLazyTabs() { await triggerClickOn(oldTabs[i], { ctrlKey: true }); } - isnot(oldTabs[0].linkedPanel, "", `Old tab 0 shouldn't be lazy`); + isnot(oldTabs[0].linkedPanel, null, `Old tab 0 shouldn't be lazy`); for (let i = 1; i < numTabs; ++i) { - is(oldTabs[i].linkedPanel, "", `Old tab ${i} should be lazy`); + is(oldTabs[i].linkedPanel, null, `Old tab ${i} should be lazy`); } is(gBrowser.multiSelectedTabsCount, numTabs, `${numTabs} multiselected tabs`); @@ -79,11 +79,11 @@ add_task(async function testLazyTabs() { if (i == 0) { isnot( oldTab.linkedPanel, - "", + null, `Old tab ${i} should continue not being lazy` ); } else if (i > 0) { - is(oldTab.linkedPanel, "", `Old tab ${i} should continue being lazy`); + is(oldTab.linkedPanel, null, `Old tab ${i} should continue being lazy`); } else { return; } @@ -101,9 +101,13 @@ add_task(async function testLazyTabs() { await tabsMoved; let newTabs = newWindow.gBrowser.tabs; - isnot(newTabs[0].linkedPanel, "", `New tab 0 should continue not being lazy`); + isnot( + newTabs[0].linkedPanel, + null, + `New tab 0 should continue not being lazy` + ); for (let i = 1; i < numTabs; ++i) { - is(newTabs[i].linkedPanel, "", `New tab ${i} should continue being lazy`); + is(newTabs[i].linkedPanel, null, `New tab ${i} should continue being lazy`); } is( diff --git a/browser/base/content/test/tabs/browser_new_tab_bookmarks_toolbar_height.js b/browser/base/content/test/tabs/browser_new_tab_bookmarks_toolbar_height.js index 66258659fd..157254142d 100644 --- a/browser/base/content/test/tabs/browser_new_tab_bookmarks_toolbar_height.js +++ b/browser/base/content/test/tabs/browser_new_tab_bookmarks_toolbar_height.js @@ -12,7 +12,7 @@ async function expectHeightChanges(tab, expectedNewHeightChanges, msg) { let contentObservedHeightChanges = await ContentTask.spawn( tab.linkedBrowser, null, - async args => { + async () => { await new Promise(resolve => content.requestAnimationFrame(resolve)); return content.document.body.innerText; } @@ -109,7 +109,7 @@ add_task(async function () { info("Opening a new tab, making the previous tab non-selected"); await expectBmToolbarVisibilityChange( () => { - BrowserOpenTab(); + BrowserCommands.openTab(); ok( !tab.selected, "non-new tab is in the background (not the selected tab)" diff --git a/browser/base/content/test/tabs/browser_new_tab_in_privilegedabout_process_pref.js b/browser/base/content/test/tabs/browser_new_tab_in_privilegedabout_process_pref.js index ec11951cb0..568510b20a 100644 --- a/browser/base/content/test/tabs/browser_new_tab_in_privilegedabout_process_pref.js +++ b/browser/base/content/test/tabs/browser_new_tab_in_privilegedabout_process_pref.js @@ -159,7 +159,7 @@ add_task(async function process_switching_through_navigation_features() { assertIsPrivilegedProcess(browser, "new tab opened from about:newtab"); // Check that reload does not break the privileged about: content process affinity. - BrowserReload(); + BrowserCommands.reload(); await BrowserTestUtils.browserLoaded(browser, false, ABOUT_NEWTAB); assertIsPrivilegedProcess(browser, "about:newtab after reload"); diff --git a/browser/base/content/test/tabs/browser_new_tab_url.js b/browser/base/content/test/tabs/browser_new_tab_url.js index 233cb4e59e..ab00560929 100644 --- a/browser/base/content/test/tabs/browser_new_tab_url.js +++ b/browser/base/content/test/tabs/browser_new_tab_url.js @@ -3,7 +3,7 @@ "use strict"; add_task(async function test_browser_open_newtab_default_url() { - BrowserOpenTab(); + BrowserCommands.openTab(); const tab = gBrowser.selectedTab; if (tab.linkedBrowser.currentURI.spec !== window.BROWSER_NEW_TAB_URL) { @@ -19,7 +19,7 @@ add_task(async function test_browser_open_newtab_default_url() { add_task(async function test_browser_open_newtab_specific_url() { const url = "https://example.com"; - BrowserOpenTab({ url }); + BrowserCommands.openTab({ url }); const tab = gBrowser.selectedTab; await BrowserTestUtils.browserLoaded(tab.linkedBrowser); diff --git a/browser/base/content/test/tabs/browser_open_newtab_start_observer_notification.js b/browser/base/content/test/tabs/browser_open_newtab_start_observer_notification.js index cb9fc3c6d7..2bc26cf667 100644 --- a/browser/base/content/test/tabs/browser_open_newtab_start_observer_notification.js +++ b/browser/base/content/test/tabs/browser_open_newtab_start_observer_notification.js @@ -9,10 +9,10 @@ add_task(async function test_browser_open_newtab_start_observer_notification() { Services.obs.addObserver(observe, "browser-open-newtab-start"); }); - // We're calling BrowserOpenTab() (rather the using BrowserTestUtils + // We're calling BrowserCommands.openTab() (rather the using BrowserTestUtils // because we want to be sure that it triggers the event to fire, since // it's very close to where various user-actions are triggered. - BrowserOpenTab(); + BrowserCommands.openTab(); const newTabCreatedPromise = await observerFiredPromise; const browser = await newTabCreatedPromise; const tab = gBrowser.selectedTab; diff --git a/browser/base/content/test/tabs/browser_pinnedTabs_closeByKeyboard.js b/browser/base/content/test/tabs/browser_pinnedTabs_closeByKeyboard.js index fbcd0bb492..4631afba42 100644 --- a/browser/base/content/test/tabs/browser_pinnedTabs_closeByKeyboard.js +++ b/browser/base/content/test/tabs/browser_pinnedTabs_closeByKeyboard.js @@ -5,14 +5,14 @@ function test() { waitForExplicitFinish(); - function testState(aPinned) { + function testState() { function elemAttr(id, attr) { return document.getElementById(id).getAttribute(attr); } is( elemAttr("key_close", "disabled"), - "", + null, "key_closed should always be enabled" ); is( diff --git a/browser/base/content/test/tabs/browser_privilegedmozilla_process_pref.js b/browser/base/content/test/tabs/browser_privilegedmozilla_process_pref.js index 9e1c1ff5cd..922f94b07c 100644 --- a/browser/base/content/test/tabs/browser_privilegedmozilla_process_pref.js +++ b/browser/base/content/test/tabs/browser_privilegedmozilla_process_pref.js @@ -140,7 +140,7 @@ add_task(async function process_switching_through_navigation_features() { ); // Check that reload does not break the privileged mozilla content process affinity. - BrowserReload(); + BrowserCommands.reload(); await BrowserTestUtils.browserLoaded(browser, false, TEST_HIGH1); is( browser.frameLoader.remoteTab.osPid, diff --git a/browser/base/content/test/tabs/browser_removeTabs_order.js b/browser/base/content/test/tabs/browser_removeTabs_order.js index 071cc03716..a993415653 100644 --- a/browser/base/content/test/tabs/browser_removeTabs_order.js +++ b/browser/base/content/test/tabs/browser_removeTabs_order.js @@ -16,7 +16,7 @@ add_task(async function () { // Add a beforeunload event listener in one of the tabs; it should be called // before closing any of the tabs. await ContentTask.spawn(tab2.linkedBrowser, null, async function () { - content.window.addEventListener("beforeunload", function (event) {}, true); + content.window.addEventListener("beforeunload", function () {}, true); }); let permitUnloadSpy = sinon.spy(tab2.linkedBrowser, "asyncPermitUnload"); diff --git a/browser/base/content/test/tabs/browser_tab_label_picture_in_picture.js b/browser/base/content/test/tabs/browser_tab_label_picture_in_picture.js index dae4ffc444..59cfd37c0d 100644 --- a/browser/base/content/test/tabs/browser_tab_label_picture_in_picture.js +++ b/browser/base/content/test/tabs/browser_tab_label_picture_in_picture.js @@ -11,7 +11,7 @@ add_task(async function test_pip_label_changes_tab() { let pipLabel = pipTab.querySelector(".tab-icon-sound-pip-label"); - await BrowserTestUtils.withNewTab("about:blank", async browser => { + await BrowserTestUtils.withNewTab("about:blank", async () => { let selectedTab = newWin.document.querySelector( ".tabbrowser-tab[selected]" ); diff --git a/browser/base/content/test/tabs/browser_tab_manager_visibility.js b/browser/base/content/test/tabs/browser_tab_manager_visibility.js index b7de777512..df6e75cd66 100644 --- a/browser/base/content/test/tabs/browser_tab_manager_visibility.js +++ b/browser/base/content/test/tabs/browser_tab_manager_visibility.js @@ -17,7 +17,7 @@ add_task(async function tab_manager_visibility_preference_on() { gBrowser: newWindow.gBrowser, url: TEST_HOSTNAME + DUMMY_PAGE_PATH, }, - async function (browser) { + async function () { await Assert.ok( BrowserTestUtils.isVisible( newWindow.document.getElementById("alltabs-button") @@ -39,7 +39,7 @@ add_task(async function tab_manager_visibility_preference_off() { gBrowser: newWindow.gBrowser, url: TEST_HOSTNAME + DUMMY_PAGE_PATH, }, - async function (browser) { + async function () { await Assert.ok( BrowserTestUtils.isHidden( newWindow.document.getElementById("alltabs-button") diff --git a/browser/base/content/test/tabs/browser_tab_preview.js b/browser/base/content/test/tabs/browser_tab_preview.js index 718afbb940..0f83b1e28c 100644 --- a/browser/base/content/test/tabs/browser_tab_preview.js +++ b/browser/base/content/test/tabs/browser_tab_preview.js @@ -4,14 +4,14 @@ "use strict"; +const { sinon } = ChromeUtils.importESModule( + "resource://testing-common/Sinon.sys.mjs" +); + async function openPreview(tab) { - const previewShown = BrowserTestUtils.waitForEvent( - document.getElementById("tabbrowser-tab-preview"), - "previewshown", - false, - e => { - return e.detail.tab === tab; - } + const previewShown = BrowserTestUtils.waitForPopupEvent( + document.getElementById("tab-preview-panel"), + "shown" ); EventUtils.synthesizeMouseAtCenter(tab, { type: "mouseover" }); return previewShown; @@ -19,9 +19,9 @@ async function openPreview(tab) { async function closePreviews() { const tabs = document.getElementById("tabbrowser-tabs"); - const previewHidden = BrowserTestUtils.waitForEvent( - document.getElementById("tabbrowser-tab-preview"), - "previewhidden" + const previewHidden = BrowserTestUtils.waitForPopupEvent( + document.getElementById("tab-preview-panel"), + "hidden" ); EventUtils.synthesizeMouse(tabs, 0, tabs.outerHeight + 1, { type: "mouseout", @@ -53,35 +53,24 @@ add_task(async function hoverTests() { const tabUrl2 = "data:text/html,<html><head><title>Second New Tab</title></head><body>Hello</body></html>"; const tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl2); - const previewContainer = document.getElementById("tabbrowser-tab-preview"); + const previewContainer = document.getElementById("tab-preview-panel"); await openPreview(tab1); - Assert.ok( - ["open", "showing"].includes(previewContainer.panel.state), - "tab1 preview shown" - ); Assert.equal( - previewContainer.renderRoot.querySelector(".tab-preview-title").innerText, + previewContainer.querySelector(".tab-preview-title").innerText, "First New Tab", "Preview of tab1 shows correct title" ); + await closePreviews(); await openPreview(tab2); - Assert.ok( - ["open", "showing"].includes(previewContainer.panel.state), - "tab2 preview shown" - ); Assert.equal( - previewContainer.renderRoot.querySelector(".tab-preview-title").innerText, + previewContainer.querySelector(".tab-preview-title").innerText, "Second New Tab", "Preview of tab2 shows correct title" ); await closePreviews(); - Assert.ok( - ["closed", "hiding"].includes(previewContainer.panel.state), - "preview container is now hidden" - ); BrowserTestUtils.removeTab(tab1); BrowserTestUtils.removeTab(tab2); @@ -105,29 +94,41 @@ add_task(async function thumbnailTests() { const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1); const tabUrl2 = "about:blank"; const tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl2); - const previewContainer = document.getElementById("tabbrowser-tab-preview"); + const previewPanel = document.getElementById("tab-preview-panel"); - const thumbnailUpdated = BrowserTestUtils.waitForEvent( - previewContainer, - "previewThumbnailUpdated" + let thumbnailUpdated = BrowserTestUtils.waitForEvent( + previewPanel, + "previewThumbnailUpdated", + false, + evt => evt.detail.thumbnail ); await openPreview(tab1); await thumbnailUpdated; Assert.ok( - previewContainer.renderRoot.querySelectorAll("img,canvas").length, + previewPanel.querySelectorAll( + ".tab-preview-thumbnail-container img, .tab-preview-thumbnail-container canvas" + ).length, "Tab1 preview contains thumbnail" ); + await closePreviews(); + thumbnailUpdated = BrowserTestUtils.waitForEvent( + previewPanel, + "previewThumbnailUpdated" + ); await openPreview(tab2); + await thumbnailUpdated; Assert.equal( - previewContainer.renderRoot.querySelectorAll("img,canvas").length, + previewPanel.querySelectorAll( + ".tab-preview-thumbnail-container img, .tab-preview-thumbnail-container canvas" + ).length, 0, "Tab2 (selected) does not contain thumbnail" ); - const previewHidden = BrowserTestUtils.waitForEvent( - document.getElementById("tabbrowser-tab-preview"), - "previewhidden" + const previewHidden = BrowserTestUtils.waitForPopupEvent( + previewPanel, + "hidden" ); BrowserTestUtils.removeTab(tab1); @@ -144,6 +145,102 @@ add_task(async function thumbnailTests() { }); /** + * make sure delay is applied when mouse leaves tabstrip + * but not when moving between tabs on the tabstrip + */ +add_task(async function delayTests() { + const tabUrl1 = + "data:text/html,<html><head><title>First New Tab</title></head><body>Hello</body></html>"; + const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1); + const tabUrl2 = + "data:text/html,<html><head><title>Second New Tab</title></head><body>Hello</body></html>"; + const tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl2); + const previewComponent = gBrowser.tabContainer.previewPanel; + const previewElement = document.getElementById("tab-preview-panel"); + + sinon.spy(previewComponent, "deactivate"); + + await openPreview(tab1); + + // I can't fake this like in hoverTests, need to send an updated-tab signal + //await openPreview(tab2); + + const previewHidden = BrowserTestUtils.waitForPopupEvent( + previewElement, + "hidden" + ); + Assert.ok( + !previewComponent.deactivate.called, + "Delay is not reset when moving between tabs" + ); + + EventUtils.synthesizeMouseAtCenter(document.getElementById("reload-button"), { + type: "mousemove", + }); + + await previewHidden; + + Assert.ok( + previewComponent.deactivate.called, + "Delay is reset when cursor leaves tabstrip" + ); + + BrowserTestUtils.removeTab(tab1); + BrowserTestUtils.removeTab(tab2); + sinon.restore(); +}); + +/** + * Dragging a tab should deactivate the preview + */ +add_task(async function dragTests() { + await SpecialPowers.pushPrefEnv({ + set: [["ui.tooltip.delay_ms", 1000]], + }); + const tabUrl1 = + "data:text/html,<html><head><title>First New Tab</title></head><body>Hello</body></html>"; + const tab1 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl1); + const tabUrl2 = + "data:text/html,<html><head><title>Second New Tab</title></head><body>Hello</body></html>"; + const tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl2); + const previewComponent = gBrowser.tabContainer.previewPanel; + const previewElement = document.getElementById("tab-preview-panel"); + + sinon.spy(previewComponent, "deactivate"); + + await openPreview(tab1); + const previewHidden = BrowserTestUtils.waitForPopupEvent( + previewElement, + "hidden" + ); + let dragend = BrowserTestUtils.waitForEvent(tab1, "dragend"); + EventUtils.synthesizePlainDragAndDrop({ + srcElement: tab1, + destElement: tab2, + }); + + await previewHidden; + + Assert.ok( + previewComponent.deactivate.called, + "delay is reset after drag started" + ); + + await dragend; + + BrowserTestUtils.removeTab(tab1); + BrowserTestUtils.removeTab(tab2); + sinon.restore(); + + // Move the mouse outside of the tab strip. + EventUtils.synthesizeMouseAtCenter(document.documentElement, { + type: "mouseover", + }); + + await SpecialPowers.popPrefEnv(); +}); + +/** * Wheel events at the document-level of the window should hide the preview. */ add_task(async function wheelTests() { @@ -155,9 +252,9 @@ add_task(async function wheelTests() { await openPreview(tab1); const tabs = document.getElementById("tabbrowser-tabs"); - const previewHidden = BrowserTestUtils.waitForEvent( - document.getElementById("tabbrowser-tab-preview"), - "previewhidden" + const previewHidden = BrowserTestUtils.waitForPopupEvent( + document.getElementById("tab-preview-panel"), + "hidden" ); // Copied from apz_test_native_event_utils.js diff --git a/browser/base/content/test/tabs/browser_tab_tooltips.js b/browser/base/content/test/tabs/browser_tab_tooltips.js index ee82816bce..79be4d0a36 100644 --- a/browser/base/content/test/tabs/browser_tab_tooltips.js +++ b/browser/base/content/test/tabs/browser_tab_tooltips.js @@ -57,7 +57,7 @@ add_task(async function () { ); is( tooltip.getAttribute("position"), - "", + null, "tooltip position attribute for tab" ); diff --git a/browser/base/content/test/tabs/browser_tabswitch_select.js b/browser/base/content/test/tabs/browser_tabswitch_select.js index 3868764bed..b22a75c79c 100644 --- a/browser/base/content/test/tabs/browser_tabswitch_select.js +++ b/browser/base/content/test/tabs/browser_tabswitch_select.js @@ -35,7 +35,7 @@ add_task(async function () { let fullScreenEntered = TestUtils.waitForCondition( () => document.documentElement.getAttribute("sizemode") == "fullscreen" ); - BrowserFullScreen(); + BrowserCommands.fullScreen(); await fullScreenEntered; tab2.linkedBrowser.focus(); @@ -54,7 +54,7 @@ add_task(async function () { let fullScreenExited = TestUtils.waitForCondition( () => document.documentElement.getAttribute("sizemode") != "fullscreen" ); - BrowserFullScreen(); + BrowserCommands.fullScreen(); await fullScreenExited; BrowserTestUtils.removeTab(gBrowser.selectedTab); diff --git a/browser/base/content/test/tabs/browser_tabswitch_updatecommands.js b/browser/base/content/test/tabs/browser_tabswitch_updatecommands.js index b5d2762eec..82f9eb871b 100644 --- a/browser/base/content/test/tabs/browser_tabswitch_updatecommands.js +++ b/browser/base/content/test/tabs/browser_tabswitch_updatecommands.js @@ -8,7 +8,7 @@ add_task(async function () { let tab2 = await BrowserTestUtils.openNewForegroundTab(gBrowser, uri); let updates = []; - function countUpdates(event) { + function countUpdates() { updates.push(new Error().stack); } let updater = document.getElementById("editMenuCommandSetAll"); diff --git a/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js b/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js index b5ae94ce84..2c301a400d 100644 --- a/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js +++ b/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js @@ -33,7 +33,7 @@ add_task(async function () { // Make sure we can view-source on the data URI page. let promiseTab = BrowserTestUtils.waitForNewTab(gBrowser, DATA_URI_SOURCE); - BrowserViewSource(fileBrowser); + BrowserCommands.viewSource(fileBrowser); let viewSourceTab = await promiseTab; registerCleanupFunction(async function () { BrowserTestUtils.removeTab(viewSourceTab); diff --git a/browser/base/content/test/tabs/browser_window_open_modifiers.js b/browser/base/content/test/tabs/browser_window_open_modifiers.js index b4376d6824..2ef951efef 100644 --- a/browser/base/content/test/tabs/browser_window_open_modifiers.js +++ b/browser/base/content/test/tabs/browser_window_open_modifiers.js @@ -97,7 +97,7 @@ add_task(async function () { BrowserTestUtils.synthesizeMouseAtCenter(id, { ...event }, browser); } else { // Make sure the keyboard activates a simple button on the page. - await ContentTask.spawn(browser, id, elementId => { + await ContentTask.spawn(browser, id, () => { content.document.querySelector("#focus-result").value = ""; content.document.querySelector("#focus-check").focus(); }); diff --git a/browser/base/content/test/tabs/common_link_in_tab_title_and_url_prefilled.js b/browser/base/content/test/tabs/common_link_in_tab_title_and_url_prefilled.js index a06b982615..bff14e5ced 100644 --- a/browser/base/content/test/tabs/common_link_in_tab_title_and_url_prefilled.js +++ b/browser/base/content/test/tabs/common_link_in_tab_title_and_url_prefilled.js @@ -244,7 +244,7 @@ async function synthesizeMouse(browser, link, event) { async function waitForNewTabWithLoadRequest() { return new Promise(resolve => gBrowser.addTabsProgressListener({ - onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags) { if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) { gBrowser.removeTabsProgressListener(this); resolve(gBrowser.getTabForBrowser(aBrowser)); diff --git a/browser/base/content/test/webextensions/browser_extension_update_background.js b/browser/base/content/test/webextensions/browser_extension_update_background.js index 490544b2ec..5619bacb4d 100644 --- a/browser/base/content/test/webextensions/browser_extension_update_background.js +++ b/browser/base/content/test/webextensions/browser_extension_update_background.js @@ -87,7 +87,7 @@ async function backgroundUpdateTest(url, id, checkIconFn) { let addonId = addon.id; ok(addon, "Addon was installed"); - is(getBadgeStatus(), "", "Should not start out with an addon alert badge"); + is(getBadgeStatus(), null, "Should not start out with an addon alert badge"); // Trigger an update check and wait for the update for this addon // to be downloaded. @@ -156,7 +156,7 @@ async function backgroundUpdateTest(url, id, checkIconFn) { BrowserTestUtils.removeTab(tab); // Alert badge and hamburger menu items should be gone - is(getBadgeStatus(), "", "Addon alert badge should be gone"); + is(getBadgeStatus(), null, "Addon alert badge should be gone"); await gCUITestUtils.openMainMenu(); addons = PanelUI.addonNotificationContainer; @@ -205,7 +205,7 @@ async function backgroundUpdateTest(url, id, checkIconFn) { BrowserTestUtils.removeTab(tab); - is(getBadgeStatus(), "", "Addon alert badge should be gone"); + is(getBadgeStatus(), null, "Addon alert badge should be gone"); await addon.uninstall(); await SpecialPowers.popPrefEnv(); diff --git a/browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js b/browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js index a0b10c82e2..204e7fb44a 100644 --- a/browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js +++ b/browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js @@ -81,7 +81,7 @@ async function testNoPrompt(origUrl, id) { await updatePromise; // There should be no notifications about the update - is(getBadgeStatus(), "", "Should not have addon alert badge"); + is(getBadgeStatus(), null, "Should not have addon alert badge"); await gCUITestUtils.openMainMenu(); let addons = PanelUI.addonNotificationContainer; diff --git a/browser/base/content/test/webextensions/browser_legacy_webext.xpi b/browser/base/content/test/webextensions/browser_legacy_webext.xpi Binary files differindex a3bdf6f832..afd0a8bcee 100644 --- a/browser/base/content/test/webextensions/browser_legacy_webext.xpi +++ b/browser/base/content/test/webextensions/browser_legacy_webext.xpi diff --git a/browser/base/content/test/webextensions/browser_permissions_installTrigger.js b/browser/base/content/test/webextensions/browser_permissions_installTrigger.js index a227518ebb..36b4efff8b 100644 --- a/browser/base/content/test/webextensions/browser_permissions_installTrigger.js +++ b/browser/base/content/test/webextensions/browser_permissions_installTrigger.js @@ -9,6 +9,12 @@ async function installTrigger(filename) { ["extensions.InstallTriggerImpl.enabled", true], // Relax the user input requirements while running this test. ["xpinstall.userActivation.required", false], + // This test asserts that the extension icon is in the install dialog + // and so it requires the signature checks to be enabled (otherwise the + // extension icon is expected to be replaced by a warning icon) and the + // two test extension used by this test (browser_webext_nopermissions.xpi + // and browser_webext_permissions.xpi) are signed using AMO stage signatures. + ["xpinstall.signatures.dev-root", true], ], }); BrowserTestUtils.startLoadingURIString( diff --git a/browser/base/content/test/webextensions/browser_permissions_local_file.js b/browser/base/content/test/webextensions/browser_permissions_local_file.js index 7f8f256e14..22dff8cb38 100644 --- a/browser/base/content/test/webextensions/browser_permissions_local_file.js +++ b/browser/base/content/test/webextensions/browser_permissions_local_file.js @@ -32,9 +32,22 @@ add_task(async function test_install_extension_from_local_file() { }, }); + await SpecialPowers.pushPrefEnv({ + set: [ + // This test asserts that the extension icon is in the install dialog + // and so it requires the signature checks to be enabled (otherwise the + // extension icon is expected to be replaced by a warning icon) and the + // two test extension used by this test (browser_webext_nopermissions.xpi + // and browser_webext_permissions.xpi) are signed using AMO stage signatures. + ["xpinstall.signatures.dev-root", true], + ], + }); + // Install the add-ons. await testInstallMethod(installFile, "installLocal"); + await SpecialPowers.popPrefEnv(); + // Check we got an installId. ok( firstInstallId != null && !isNaN(firstInstallId), diff --git a/browser/base/content/test/webextensions/browser_permissions_mozAddonManager.js b/browser/base/content/test/webextensions/browser_permissions_mozAddonManager.js index 55a578221d..d54038bffe 100644 --- a/browser/base/content/test/webextensions/browser_permissions_mozAddonManager.js +++ b/browser/base/content/test/webextensions/browser_permissions_mozAddonManager.js @@ -9,6 +9,17 @@ async function installMozAM(filename) { ); await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); + await SpecialPowers.pushPrefEnv({ + set: [ + // This test asserts that the extension icon is in the install dialog + // and so it requires the signature checks to be enabled (otherwise the + // extension icon is expected to be replaced by a warning icon) and the + // two test extension used by this test (browser_webext_nopermissions.xpi + // and browser_webext_permissions.xpi) are signed using AMO stage signatures. + ["xpinstall.signatures.dev-root", true], + ], + }); + await SpecialPowers.spawn( gBrowser.selectedBrowser, [`${BASE}/${filename}`], @@ -16,6 +27,8 @@ async function installMozAM(filename) { await content.wrappedJSObject.installMozAM(url); } ); + + await SpecialPowers.popPrefEnv(); } add_task(() => testInstallMethod(installMozAM, "installAmo")); diff --git a/browser/base/content/test/webextensions/browser_permissions_pointerevent.js b/browser/base/content/test/webextensions/browser_permissions_pointerevent.js index 188aa8e3bf..2809ffe9b4 100644 --- a/browser/base/content/test/webextensions/browser_permissions_pointerevent.js +++ b/browser/base/content/test/webextensions/browser_permissions_pointerevent.js @@ -9,15 +9,15 @@ add_task(async function test_pointerevent() { e.preventDefault(); }); - document.addEventListener("mousedown", e => { + document.addEventListener("mousedown", () => { browser.test.assertTrue(true, "Should receive mousedown"); }); - document.addEventListener("mouseup", e => { + document.addEventListener("mouseup", () => { browser.test.assertTrue(true, "Should receive mouseup"); }); - document.addEventListener("pointerup", e => { + document.addEventListener("pointerup", () => { browser.test.assertTrue(true, "Should receive pointerup"); browser.test.sendMessage("done"); }); diff --git a/browser/base/content/test/webextensions/browser_update_checkForUpdates.js b/browser/base/content/test/webextensions/browser_update_checkForUpdates.js index b902527cae..c9e59556e1 100644 --- a/browser/base/content/test/webextensions/browser_update_checkForUpdates.js +++ b/browser/base/content/test/webextensions/browser_update_checkForUpdates.js @@ -3,7 +3,7 @@ function checkAll(win) { triggerPageOptionsAction(win, "check-for-updates"); return new Promise(resolve => { let observer = { - observe(subject, topic, data) { + observe() { Services.obs.removeObserver(observer, "EM-update-check-finished"); resolve(); }, diff --git a/browser/base/content/test/webextensions/browser_webext_nopermissions.xpi b/browser/base/content/test/webextensions/browser_webext_nopermissions.xpi Binary files differindex ab97d96a11..87500ceb38 100644 --- a/browser/base/content/test/webextensions/browser_webext_nopermissions.xpi +++ b/browser/base/content/test/webextensions/browser_webext_nopermissions.xpi diff --git a/browser/base/content/test/webextensions/browser_webext_permissions.xpi b/browser/base/content/test/webextensions/browser_webext_permissions.xpi Binary files differindex a8c8c38ef8..8149ce7b6b 100644 --- a/browser/base/content/test/webextensions/browser_webext_permissions.xpi +++ b/browser/base/content/test/webextensions/browser_webext_permissions.xpi diff --git a/browser/base/content/test/webextensions/browser_webext_update1.xpi b/browser/base/content/test/webextensions/browser_webext_update1.xpi Binary files differindex 086b3839b9..66ad3e1b31 100644 --- a/browser/base/content/test/webextensions/browser_webext_update1.xpi +++ b/browser/base/content/test/webextensions/browser_webext_update1.xpi diff --git a/browser/base/content/test/webextensions/browser_webext_update2.xpi b/browser/base/content/test/webextensions/browser_webext_update2.xpi Binary files differindex 19967c39c0..a120a64c6d 100644 --- a/browser/base/content/test/webextensions/browser_webext_update2.xpi +++ b/browser/base/content/test/webextensions/browser_webext_update2.xpi diff --git a/browser/base/content/test/webextensions/browser_webext_update_icon1.xpi b/browser/base/content/test/webextensions/browser_webext_update_icon1.xpi Binary files differindex 24cb7616d2..040f8f8c97 100644 --- a/browser/base/content/test/webextensions/browser_webext_update_icon1.xpi +++ b/browser/base/content/test/webextensions/browser_webext_update_icon1.xpi diff --git a/browser/base/content/test/webextensions/browser_webext_update_icon2.xpi b/browser/base/content/test/webextensions/browser_webext_update_icon2.xpi Binary files differindex fd9cf7eb0e..0b13e7c7dd 100644 --- a/browser/base/content/test/webextensions/browser_webext_update_icon2.xpi +++ b/browser/base/content/test/webextensions/browser_webext_update_icon2.xpi diff --git a/browser/base/content/test/webextensions/browser_webext_update_perms1.xpi b/browser/base/content/test/webextensions/browser_webext_update_perms1.xpi Binary files differindex f4942f9082..60b6643a12 100644 --- a/browser/base/content/test/webextensions/browser_webext_update_perms1.xpi +++ b/browser/base/content/test/webextensions/browser_webext_update_perms1.xpi diff --git a/browser/base/content/test/webextensions/browser_webext_update_perms2.xpi b/browser/base/content/test/webextensions/browser_webext_update_perms2.xpi Binary files differindex 2c023edc9d..64c2afb473 100644 --- a/browser/base/content/test/webextensions/browser_webext_update_perms2.xpi +++ b/browser/base/content/test/webextensions/browser_webext_update_perms2.xpi diff --git a/browser/base/content/test/webextensions/head.js b/browser/base/content/test/webextensions/head.js index 84f7cd02d7..f1183c61b8 100644 --- a/browser/base/content/test/webextensions/head.js +++ b/browser/base/content/test/webextensions/head.js @@ -302,7 +302,7 @@ function checkNotification(panel, checkIcon, permissions, sideloaded) { * * @returns {Promise} */ -async function testInstallMethod(installFn, telemetryBase) { +async function testInstallMethod(installFn) { const PERMS_XPI = "browser_webext_permissions.xpi"; const NO_PERMS_XPI = "browser_webext_nopermissions.xpi"; const ID = "permissions@test.mozilla.org"; diff --git a/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js b/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js index dd20a672c3..f1052565b8 100644 --- a/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js +++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js @@ -58,7 +58,7 @@ var gTests = [ ); is( gBrowser.selectedTab.getAttribute("sharing"), - "", + null, "the new tab doesn't have the 'sharing' attribute" ); is( @@ -89,7 +89,7 @@ var gTests = [ await TestUtils.waitForCondition(() => !tab.getAttribute("sharing")); is( tab.getAttribute("sharing"), - "", + null, "the tab no longer has the 'sharing' attribute after closing the stream" ); } diff --git a/browser/base/content/test/webrtc/browser_devices_get_user_media_by_device_id.js b/browser/base/content/test/webrtc/browser_devices_get_user_media_by_device_id.js index 3e5ca0668a..9598bb565c 100644 --- a/browser/base/content/test/webrtc/browser_devices_get_user_media_by_device_id.js +++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_by_device_id.js @@ -49,7 +49,7 @@ add_task(async function test_get_user_media_by_device_id() { .filter(d => d.kind == "videoinput") .map(d => d.deviceId)[0]; - await BrowserTestUtils.withNewTab(TEST_PAGE, async browser => { + await BrowserTestUtils.withNewTab(TEST_PAGE, async () => { let promise = promisePopupNotificationShown("webRTC-shareDevices"); let observerPromise = expectObserverCalled("getUserMedia:request"); await promiseRequestDevice({ deviceId: { exact: audioId } }); diff --git a/browser/base/content/test/webrtc/browser_devices_get_user_media_grace.js b/browser/base/content/test/webrtc/browser_devices_get_user_media_grace.js index 0df69bb9da..624bc07ce0 100644 --- a/browser/base/content/test/webrtc/browser_devices_get_user_media_grace.js +++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_grace.js @@ -171,7 +171,7 @@ var gTests = [ { desc: "getUserMedia camera+mic survives page reload but not past grace", - run: async function checkAudioVideoGracePastReload(browser) { + run: async function checkAudioVideoGracePastReload() { await prompt(true, true); await allow(true, true); await closeStream(); @@ -240,7 +240,7 @@ var gTests = [ info("Open same page in a new tab"); await disableObserverVerification(); - await BrowserTestUtils.withNewTab(SAME_ORIGIN + PATH, async browser => { + await BrowserTestUtils.withNewTab(SAME_ORIGIN + PATH, async () => { info("In new tab, gUM(camera+mic) causes a prompt."); await prompt(true, true); }); @@ -329,7 +329,7 @@ var gTests = [ { desc: "getUserMedia camera+mic grace period cleared on permission block", - run: async function checkAudioVideoGraceEndsNewTab(browser) { + run: async function checkAudioVideoGraceEndsNewTab() { await SpecialPowers.pushPrefEnv({ set: [["privacy.webrtc.deviceGracePeriodTimeoutMs", 10000]], }); diff --git a/browser/base/content/test/webrtc/browser_devices_select_audio_output.js b/browser/base/content/test/webrtc/browser_devices_select_audio_output.js index fbced1f5cc..df75f39a1a 100644 --- a/browser/base/content/test/webrtc/browser_devices_select_audio_output.js +++ b/browser/base/content/test/webrtc/browser_devices_select_audio_output.js @@ -220,7 +220,7 @@ var gTests = [ gBrowser.selectedBrowser.browsingContext, "getUserMedia:response:allow", 1, - (aSubject, aTopic, aData) => { + aSubject => { const device = aSubject .QueryInterface(Ci.nsIArrayExtensions) .GetElementAt(0).wrappedJSObject; diff --git a/browser/base/content/test/webrtc/browser_webrtc_hooks.js b/browser/base/content/test/webrtc/browser_webrtc_hooks.js index e980b15286..3fb2fc9f8d 100644 --- a/browser/base/content/test/webrtc/browser_webrtc_hooks.js +++ b/browser/base/content/test/webrtc/browser_webrtc_hooks.js @@ -122,7 +122,7 @@ var gTests = [ run: async function testDeferredBlocker(browser) { Events.on(); - let blocker = params => Promise.resolve("allow"); + let blocker = () => Promise.resolve("allow"); webrtcUI.addPeerConnectionBlocker(blocker); await tryPeerConnection(browser); @@ -138,7 +138,7 @@ var gTests = [ run: async function testBlockerDeny(browser) { Events.on(); - let blocker = params => "deny"; + let blocker = () => "deny"; webrtcUI.addPeerConnectionBlocker(blocker); await tryPeerConnection(browser, "NotAllowedError"); @@ -156,14 +156,14 @@ var gTests = [ Events.on(); let blocker1Called = false, - blocker1 = params => { + blocker1 = () => { blocker1Called = true; return "allow"; }; webrtcUI.addPeerConnectionBlocker(blocker1); let blocker2Called = false, - blocker2 = params => { + blocker2 = () => { blocker2Called = true; return "allow"; }; @@ -187,14 +187,14 @@ var gTests = [ Events.on(); let blocker1Called = false, - blocker1 = params => { + blocker1 = () => { blocker1Called = true; return "allow"; }; webrtcUI.addPeerConnectionBlocker(blocker1); let blocker2Called = false, - blocker2 = params => { + blocker2 = () => { blocker2Called = true; return "deny"; }; @@ -218,14 +218,14 @@ var gTests = [ Events.on(); let blocker1Called = false, - blocker1 = params => { + blocker1 = () => { blocker1Called = true; return "deny"; }; webrtcUI.addPeerConnectionBlocker(blocker1); let blocker2Called = false, - blocker2 = params => { + blocker2 = () => { blocker2Called = true; return "allow"; }; @@ -252,14 +252,14 @@ var gTests = [ Events.on(); let blocker1Called = false, - blocker1 = params => { + blocker1 = () => { blocker1Called = true; return "allow"; }; webrtcUI.addPeerConnectionBlocker(blocker1); let blocker2Called = false, - blocker2 = params => { + blocker2 = () => { blocker2Called = true; return "allow"; }; @@ -283,14 +283,14 @@ var gTests = [ run: async function testBlockerThrows(browser) { Events.on(); let blocker1Called = false, - blocker1 = params => { + blocker1 = () => { blocker1Called = true; throw new Error("kaboom"); }; webrtcUI.addPeerConnectionBlocker(blocker1); let blocker2Called = false, - blocker2 = params => { + blocker2 = () => { blocker2Called = true; return "allow"; }; @@ -313,10 +313,10 @@ var gTests = [ run: async function testBlockerCancel(browser) { let blocker, blockerPromise = new Promise(resolve => { - blocker = params => { + blocker = () => { resolve(); // defer indefinitely - return new Promise(innerResolve => {}); + return new Promise(() => {}); }; }); webrtcUI.addPeerConnectionBlocker(blocker); diff --git a/browser/base/content/test/webrtc/head.js b/browser/base/content/test/webrtc/head.js index 639ae2e51a..694875bd21 100644 --- a/browser/base/content/test/webrtc/head.js +++ b/browser/base/content/test/webrtc/head.js @@ -146,7 +146,7 @@ async function assertWebRTCIndicatorStatus(expected) { if (!expected) { let win = Services.wm.getMostRecentWindow("Browser:WebRTCGlobalIndicator"); if (win) { - await new Promise((resolve, reject) => { + await new Promise(resolve => { win.addEventListener("unload", function listener(e) { if (e.target == win.document) { win.removeEventListener("unload", listener); @@ -308,7 +308,7 @@ function expectObserverCalledOnClose( { topic: aTopic, count: 1, - filterFunctionSource: ((subject, topic, data) => { + filterFunctionSource: ((subject, topic) => { Services.cpmm.sendAsyncMessage("WebRTCTest:ObserverCalled", { topic, }); @@ -1061,7 +1061,7 @@ async function promiseReloadFrame(aFrameId, aBrowsingContext) { let loadedPromise = BrowserTestUtils.browserLoaded( gBrowser.selectedBrowser, true, - arg => { + () => { return true; } ); diff --git a/browser/base/content/test/zoom/browser.toml b/browser/base/content/test/zoom/browser.toml index 281fb9329c..e2aa0c077a 100644 --- a/browser/base/content/test/zoom/browser.toml +++ b/browser/base/content/test/zoom/browser.toml @@ -34,7 +34,7 @@ https_first_disabled = true ["browser_sitespecific_video_zoom.js"] https_first_disabled = true -support-files = ["../general/video.ogg"] +support-files = ["../general/video.webm"] skip-if = [ "os == 'win' && debug", # Bug 1315042 "verify && debug && os == 'linux'", # Bug 1315042 diff --git a/browser/base/content/test/zoom/browser_sitespecific_video_zoom.js b/browser/base/content/test/zoom/browser_sitespecific_video_zoom.js index 589e3d09cf..94fd0dee56 100644 --- a/browser/base/content/test/zoom/browser_sitespecific_video_zoom.js +++ b/browser/base/content/test/zoom/browser_sitespecific_video_zoom.js @@ -8,7 +8,7 @@ const TEST_PAGE = "http://example.org/browser/browser/base/content/test/zoom/zoom_test.html"; const TEST_VIDEO = // eslint-disable-next-line @microsoft/sdl/no-insecure-url - "http://example.org/browser/browser/base/content/test/general/video.ogg"; + "http://example.org/browser/browser/base/content/test/general/video.webm"; var gTab1, gTab2, gLevel1; diff --git a/browser/base/content/test/zoom/browser_zoom_commands.js b/browser/base/content/test/zoom/browser_zoom_commands.js index 88b6f42059..ef49a5794e 100644 --- a/browser/base/content/test/zoom/browser_zoom_commands.js +++ b/browser/base/content/test/zoom/browser_zoom_commands.js @@ -65,7 +65,7 @@ function assertTextZoomCommandCheckedState(isChecked) { * zoom levels and/or preferences on an individual browser. */ add_task(async function test_update_browser_zoom() { - await BrowserTestUtils.withNewTab(TEST_PAGE_URL, async browser => { + await BrowserTestUtils.withNewTab(TEST_PAGE_URL, async () => { let currentZoom = await FullZoomHelper.getGlobalValue(); Assert.equal( currentZoom, @@ -136,7 +136,7 @@ add_task(async function test_update_browser_zoom() { * zoom levels when the default zoom is not at 1.0. */ add_task(async function test_update_browser_zoom() { - await BrowserTestUtils.withNewTab(TEST_PAGE_URL, async browser => { + await BrowserTestUtils.withNewTab(TEST_PAGE_URL, async () => { let currentZoom = await FullZoomHelper.getGlobalValue(); Assert.equal( currentZoom, diff --git a/browser/base/content/test/zoom/head.js b/browser/base/content/test/zoom/head.js index 4a42aed98f..272303de95 100644 --- a/browser/base/content/test/zoom/head.js +++ b/browser/base/content/test/zoom/head.js @@ -34,7 +34,7 @@ var FullZoomHelper = { parsedZoomValue, nonPrivateLoadContext, { - handleCompletion(reason) { + handleCompletion() { resolve(); }, } @@ -72,7 +72,7 @@ var FullZoomHelper = { value = parseFloat(pref.value); } }, - handleCompletion(reason) { + handleCompletion() { resolve(value); }, handleError(error) { @@ -84,7 +84,7 @@ var FullZoomHelper = { waitForLocationChange: function waitForLocationChange() { return new Promise(resolve => { - Services.obs.addObserver(function obs(subj, topic, data) { + Services.obs.addObserver(function obs(subj, topic) { Services.obs.removeObserver(obs, topic); resolve(); }, "browser-fullZoom:location-change"); @@ -124,7 +124,7 @@ var FullZoomHelper = { let didLoad = false; let didZoom = false; - promiseTabLoadEvent(tab, url).then(event => { + promiseTabLoadEvent(tab, url).then(() => { didLoad = true; if (didZoom) { resolve(); |