diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /dom/tests | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/tests')
33 files changed, 177 insertions, 270 deletions
diff --git a/dom/tests/browser/browser_ConsoleStorageAPITests.js b/dom/tests/browser/browser_ConsoleStorageAPITests.js index f28db48a91..ee3e9e3f52 100644 --- a/dom/tests/browser/browser_ConsoleStorageAPITests.js +++ b/dom/tests/browser/browser_ConsoleStorageAPITests.js @@ -28,14 +28,14 @@ add_task(async function () { var tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URI); var browser = gBrowser.selectedBrowser; - const windowId = await ContentTask.spawn(browser, null, async function (opt) { + const windowId = await ContentTask.spawn(browser, null, async function () { let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService( Ci.nsIConsoleAPIStorage ); let observerPromise = new Promise(resolve => { let apiCallCount = 0; - function observe(aSubject) { + function observe() { apiCallCount++; info(`Received ${apiCallCount} console log events`); if (apiCallCount == 4) { diff --git a/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js index 38f85ef5b1..623e509702 100644 --- a/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js +++ b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js @@ -33,7 +33,7 @@ function test() { function doTest(aIsPrivateMode, aWindow, aCallback) { BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser).then( () => { - function observe(aSubject) { + function observe() { afterEvents = ConsoleAPIStorage.getEvents(innerID); is( beforeEvents.length == afterEvents.length - 1, diff --git a/dom/tests/browser/browser_bug1004814.js b/dom/tests/browser/browser_bug1004814.js index 789709a8d7..eb2272285f 100644 --- a/dom/tests/browser/browser_bug1004814.js +++ b/dom/tests/browser/browser_bug1004814.js @@ -8,7 +8,7 @@ add_task(async function () { "http://example.com/browser/dom/tests/browser/test_bug1004814.html"; await BrowserTestUtils.withNewTab(TEST_URI, async aBrowser => { - let duration = await SpecialPowers.spawn(aBrowser, [], function (opts) { + let duration = await SpecialPowers.spawn(aBrowser, [], function () { const ConsoleAPIStorage = Cc[ "@mozilla.org/consoleAPI-storage;1" ].getService(Ci.nsIConsoleAPIStorage); diff --git a/dom/tests/browser/browser_bug1236512.js b/dom/tests/browser/browser_bug1236512.js index 66d58ab132..c7d9f14a66 100644 --- a/dom/tests/browser/browser_bug1236512.js +++ b/dom/tests/browser/browser_bug1236512.js @@ -42,7 +42,7 @@ async function waitContentVisibilityChange(aIsHidden, aBrowser) { content.document, "visibilitychange", true /* capture */, - aEvent => { + () => { info( `visibilitychange: ${content.document.hidden} ${content.document.visibilityState}` ); @@ -71,7 +71,7 @@ add_task(async function () { winTest, "resize", false, - e => { + () => { return winTest.innerHeight <= 500 && winTest.innerWidth <= 500; } ); diff --git a/dom/tests/browser/browser_bug1238427.js b/dom/tests/browser/browser_bug1238427.js index 60cb383e03..6e599b7b56 100644 --- a/dom/tests/browser/browser_bug1238427.js +++ b/dom/tests/browser/browser_bug1238427.js @@ -31,7 +31,7 @@ add_task(async function () { gBrowser, url: TEST_URI, }, - function (browser) { + function () { /* ... */ } ); diff --git a/dom/tests/browser/browser_bug1563629.js b/dom/tests/browser/browser_bug1563629.js index afbf5970d0..b5637ac84d 100644 --- a/dom/tests/browser/browser_bug1563629.js +++ b/dom/tests/browser/browser_bug1563629.js @@ -10,7 +10,7 @@ const URL1 = `https://example.com/${PATH}`; const URL2 = `https://example.org/${PATH}`; function listenForCrash(win) { - function listener(event) { + function listener() { ok(false, "a crash occurred"); } diff --git a/dom/tests/browser/browser_form_associated_custom_elements_validity.js b/dom/tests/browser/browser_form_associated_custom_elements_validity.js index 3765405735..da7c1ed263 100644 --- a/dom/tests/browser/browser_form_associated_custom_elements_validity.js +++ b/dom/tests/browser/browser_form_associated_custom_elements_validity.js @@ -109,3 +109,50 @@ add_task(async function form_report_validity() { } ); }); + +add_task(async function no_validation_anchor() { + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: `data:text/html,<my-control tabindex=0>custom elements</my-control>`, + }, + async function (aBrowser) { + let promisePopupShown = BrowserTestUtils.waitForEvent( + window, + "popupshown" + ); + + let message = "valueMissing message"; + await SpecialPowers.spawn(aBrowser, [message], function (aMessage) { + class MyControl extends content.HTMLElement { + static get formAssociated() { + return true; + } + constructor() { + super(); + let internals = this.attachInternals(); + internals.setValidity({ valueMissing: true }, aMessage); + internals.reportValidity(); + } + } + content.customElements.define("my-control", MyControl); + + let myControl = content.document.querySelector("my-control"); + content.customElements.upgrade(myControl); + }); + await promisePopupShown; + + let invalidFormPopup = + window.document.getElementById("invalid-form-popup"); + is(invalidFormPopup.state, "open", "invalid-form-popup should be opened"); + is(invalidFormPopup.firstChild.textContent, message, "check message"); + + let promisePopupHidden = BrowserTestUtils.waitForEvent( + invalidFormPopup, + "popuphidden" + ); + invalidFormPopup.hidePopup(); + await promisePopupHidden; + } + ); +}); diff --git a/dom/tests/browser/browser_localStorage_privatestorageevent.js b/dom/tests/browser/browser_localStorage_privatestorageevent.js index 7c81fadf2d..22b948a73d 100644 --- a/dom/tests/browser/browser_localStorage_privatestorageevent.js +++ b/dom/tests/browser/browser_localStorage_privatestorageevent.js @@ -37,43 +37,43 @@ add_task(async function () { var pubBrowser = gBrowser.getBrowserForTab(pubTab); // Check if pubWin can see privWin's storage events - await SpecialPowers.spawn(pubBrowser, [], function (opts) { + await SpecialPowers.spawn(pubBrowser, [], function () { content.window.gotStorageEvent = false; - content.window.addEventListener("storage", ev => { + content.window.addEventListener("storage", () => { content.window.gotStorageEvent = true; }); }); - await SpecialPowers.spawn(privBrowser, [], function (opts) { + await SpecialPowers.spawn(privBrowser, [], function () { content.window.localStorage.key = "ablooabloo"; }); - let pubSaw = await SpecialPowers.spawn(pubBrowser, [], function (opts) { + let pubSaw = await SpecialPowers.spawn(pubBrowser, [], function () { return content.window.gotStorageEvent; }); ok(!pubSaw, "pubWin shouldn't be able to see privWin's storage events"); - await SpecialPowers.spawn(privBrowser, [], function (opts) { + await SpecialPowers.spawn(privBrowser, [], function () { content.window.gotStorageEvent = false; - content.window.addEventListener("storage", ev => { + content.window.addEventListener("storage", () => { content.window.gotStorageEvent = true; }); }); // Check if privWin can see pubWin's storage events - await SpecialPowers.spawn(privBrowser, [], function (opts) { + await SpecialPowers.spawn(privBrowser, [], function () { content.window.gotStorageEvent = false; - content.window.addEventListener("storage", ev => { + content.window.addEventListener("storage", () => { content.window.gotStorageEvent = true; }); }); - await SpecialPowers.spawn(pubBrowser, [], function (opts) { + await SpecialPowers.spawn(pubBrowser, [], function () { content.window.localStorage.key = "ablooabloo"; }); - let privSaw = await SpecialPowers.spawn(privBrowser, [], function (opts) { + let privSaw = await SpecialPowers.spawn(privBrowser, [], function () { return content.window.gotStorageEvent; }); diff --git a/dom/tests/browser/browser_persist_cookies.js b/dom/tests/browser/browser_persist_cookies.js index 282ad22060..60a70d6e88 100644 --- a/dom/tests/browser/browser_persist_cookies.js +++ b/dom/tests/browser/browser_persist_cookies.js @@ -13,7 +13,7 @@ const TEST_PATH2 = getRootDirectory(gTestPath).replace( ); var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); registerCleanupFunction(async function () { info("Running the cleanup code"); diff --git a/dom/tests/browser/browser_persist_cross_origin_iframe.js b/dom/tests/browser/browser_persist_cross_origin_iframe.js index 94a9a74af7..46457b6051 100644 --- a/dom/tests/browser/browser_persist_cross_origin_iframe.js +++ b/dom/tests/browser/browser_persist_cross_origin_iframe.js @@ -13,7 +13,7 @@ const TEST_PATH2 = getRootDirectory(gTestPath).replace( ); var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); registerCleanupFunction(async function () { info("Running the cleanup code"); @@ -120,7 +120,7 @@ add_task(async function () { gTestDir = createTemporarySaveDirectory(); MockFilePicker.displayDirectory = gTestDir; - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { let destFile = gTestDir.clone(); destFile.append("first.html"); MockFilePicker.setFiles([destFile]); @@ -154,7 +154,7 @@ add_task(async function () { "second_files/image_data/dummy.png", ]); - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { let destFile = gTestDir.clone(); destFile.append("second.html"); MockFilePicker.setFiles([destFile]); @@ -176,7 +176,7 @@ add_task(async function () { "third_files/dummy.png", ]); - MockFilePicker.showCallback = function (fp) { + MockFilePicker.showCallback = function () { let destFile = gTestDir.clone(); destFile.append("third.html"); MockFilePicker.setFiles([destFile]); diff --git a/dom/tests/browser/browser_persist_image_accept.js b/dom/tests/browser/browser_persist_image_accept.js index b4648a51ec..21a2096b9d 100644 --- a/dom/tests/browser/browser_persist_image_accept.js +++ b/dom/tests/browser/browser_persist_image_accept.js @@ -9,7 +9,7 @@ const TEST_PATH = getRootDirectory(gTestPath).replace( ); var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); registerCleanupFunction(async function () { info("Running the cleanup code"); @@ -100,7 +100,7 @@ add_task(async function test_image_download() { }); let httpOnModifyPromise = TestUtils.topicObserved( "http-on-modify-request", - (s, t, d) => { + s => { let channel = s.QueryInterface(Ci.nsIChannel); let uri = channel.URI && channel.URI.spec; if (!uri.endsWith("dummy.png")) { diff --git a/dom/tests/browser/browser_persist_mixed_content_image.js b/dom/tests/browser/browser_persist_mixed_content_image.js index d84934376d..6612e61ef1 100644 --- a/dom/tests/browser/browser_persist_mixed_content_image.js +++ b/dom/tests/browser/browser_persist_mixed_content_image.js @@ -9,7 +9,7 @@ const TEST_PATH = getRootDirectory(gTestPath).replace( ); var MockFilePicker = SpecialPowers.MockFilePicker; -MockFilePicker.init(window); +MockFilePicker.init(window.browsingContext); registerCleanupFunction(async function () { info("Running the cleanup code"); diff --git a/dom/tests/browser/browser_sessionStorage_navigation.js b/dom/tests/browser/browser_sessionStorage_navigation.js index 8598969dc8..ffe75b13fe 100644 --- a/dom/tests/browser/browser_sessionStorage_navigation.js +++ b/dom/tests/browser/browser_sessionStorage_navigation.js @@ -66,7 +66,7 @@ add_task(async function () { await SpecialPowers.spawn( browser, [ORIGIN2, key, value], - async (ORIGIN, key, value) => { + async (ORIGIN, key) => { is(content.window.origin, ORIGIN, `Navigate to ${ORIGIN} as expected`); let value1 = content.window.sessionStorage.getItem(key); diff --git a/dom/tests/browser/browser_test_focus_after_modal_state.js b/dom/tests/browser/browser_test_focus_after_modal_state.js index 2193d8fdc4..9b3d989078 100644 --- a/dom/tests/browser/browser_test_focus_after_modal_state.js +++ b/dom/tests/browser/browser_test_focus_after_modal_state.js @@ -33,14 +33,14 @@ add_task(async function () { return new Promise(resolve => { let doc = content.document.getElementById("edit").contentDocument; - doc.addEventListener("focus", function (event) { + doc.addEventListener("focus", function () { focusOccurred = true; if (blurOccurred) { resolve(true); } }); - doc.addEventListener("blur", function (event) { + doc.addEventListener("blur", function () { blurOccurred = true; if (focusOccurred) { resolve(false); diff --git a/dom/tests/browser/browser_windowProxy_transplant.js b/dom/tests/browser/browser_windowProxy_transplant.js index 6b9e316968..8e6e0f8413 100644 --- a/dom/tests/browser/browser_windowProxy_transplant.js +++ b/dom/tests/browser/browser_windowProxy_transplant.js @@ -59,7 +59,7 @@ add_task(async function () { return new Promise(resolve => { iframe.addEventListener( "load", - event => { + () => { info("Got an iframe load event!"); resolve(); }, diff --git a/dom/tests/browser/create_webrtc_peer_connection.html b/dom/tests/browser/create_webrtc_peer_connection.html index ee993d4892..51ca043073 100644 --- a/dom/tests/browser/create_webrtc_peer_connection.html +++ b/dom/tests/browser/create_webrtc_peer_connection.html @@ -19,7 +19,7 @@ window.addEventListener("message", event => { } }); -window.addEventListener("DOMContentLoaded", function(ev) { +window.addEventListener("DOMContentLoaded", function() { document.getElementById("msg").innerText = location.host; }); </script> diff --git a/dom/tests/browser/file_postMessage_parent.html b/dom/tests/browser/file_postMessage_parent.html index f9aa63a8c7..e9cb8a1d34 100644 --- a/dom/tests/browser/file_postMessage_parent.html +++ b/dom/tests/browser/file_postMessage_parent.html @@ -5,7 +5,7 @@ var winID = SpecialPowers.wrap(this).windowGlobalChild.innerWindowId; var observer = { - observe(subject, topic) { + observe(subject) { var currID = SpecialPowers.wrap(subject).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data; if (currID != winID) { return; diff --git a/dom/tests/browser/geo_leak_test.html b/dom/tests/browser/geo_leak_test.html index fb3fabac40..8273174581 100644 --- a/dom/tests/browser/geo_leak_test.html +++ b/dom/tests/browser/geo_leak_test.html @@ -4,7 +4,7 @@ <title>Geolocation incomplete position leak test</title> <script type="text/javascript"> -function successCallback(position) {} +function successCallback() {} function errorCallback() {} function init() { diff --git a/dom/tests/browser/test-console-api.html b/dom/tests/browser/test-console-api.html index e8da7c311e..f5afdf96b2 100644 --- a/dom/tests/browser/test-console-api.html +++ b/dom/tests/browser/test-console-api.html @@ -54,7 +54,7 @@ } function nativeCallback() { - new Promise(function(resolve, reject) { resolve(42); }).then(console.log); + new Promise(function(resolve) { resolve(42); }).then(console.log); } function timeStamp(val) { diff --git a/dom/tests/browser/worker_bug1004814.js b/dom/tests/browser/worker_bug1004814.js index 4fb54da692..fa6701329a 100644 --- a/dom/tests/browser/worker_bug1004814.js +++ b/dom/tests/browser/worker_bug1004814.js @@ -1,4 +1,4 @@ -onmessage = function (evt) { +onmessage = function () { console.time("bug1004814"); setTimeout(function () { console.timeEnd("bug1004814"); diff --git a/dom/tests/mochitest/chrome/child_focus_frame.html b/dom/tests/mochitest/chrome/child_focus_frame.html index d7f0ff63cd..89e9b8aae1 100644 --- a/dom/tests/mochitest/chrome/child_focus_frame.html +++ b/dom/tests/mochitest/chrome/child_focus_frame.html @@ -43,8 +43,8 @@ <fieldset style="float: right;"> <legend id="legend">Options</legend> <input id="t28" type="radio" name="options" value="optionone">One - <label id="ad" accesskey="d">Label:<input id="t29" type="radio" name="options" value="optiontwo">Two</label> </fieldset> +<label id="ad" accesskey="d">Label:<input id="t29" type="radio" name="options2" value="optiontwo">Two</label> <div id="t30" tabindex="0">abc</div> <input id="o18" accesskey="u" disabled size="3"/> <label id="ag" accesskey="g" for="n6">L</label> diff --git a/dom/tests/mochitest/chrome/file_bug800817.xhtml b/dom/tests/mochitest/chrome/file_bug800817.xhtml index bcd64b3ca7..ea646a74a1 100644 --- a/dom/tests/mochitest/chrome/file_bug800817.xhtml +++ b/dom/tests/mochitest/chrome/file_bug800817.xhtml @@ -30,16 +30,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800817 var b1 = document.getElementById("b1"); var b2 = document.getElementById("b2"); - var testMozBrowser = window.arguments[0].testMozBrowser; - if (testMozBrowser) { - b1.setAttribute("mozbrowser", "true"); - b2.setAttribute("mozbrowser", "true"); - } - - if (testMozBrowser) - window.arguments[0].info("Testing with mozbrowser=true"); - else - window.arguments[0].info("Testing without mozbrowser"); + window.arguments[0].info("Testing..."); b1.contentWindow.focus(); window.arguments[0].is(document.activeElement, b1, diff --git a/dom/tests/mochitest/chrome/test_bug800817.xhtml b/dom/tests/mochitest/chrome/test_bug800817.xhtml index fefaf2c155..76ea31a2fc 100644 --- a/dom/tests/mochitest/chrome/test_bug800817.xhtml +++ b/dom/tests/mochitest/chrome/test_bug800817.xhtml @@ -20,20 +20,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800817 <![CDATA[ /** Test for Bug 800817 **/ - var testMozBrowser = false; function runTests() { - // Run a first round of tests for non-mozbrowser iframes. window.openDialog("file_bug800817.xhtml", "_blank", "chrome,width=600,height=550,noopener", window); } function finishedTests() { - if (!testMozBrowser) { - testMozBrowser = true; - // Run a second round of tests for mozbrowser iframes. - window.openDialog("file_bug800817.xhtml", "_blank", "chrome,width=600,height=550,noopener", window); - } else { - SimpleTest.finish(); - } + SimpleTest.finish(); } SimpleTest.waitForExplicitFinish(); diff --git a/dom/tests/mochitest/chrome/window_focus.xhtml b/dom/tests/mochitest/chrome/window_focus.xhtml index e4cfeb6560..a1f9838450 100644 --- a/dom/tests/mochitest/chrome/window_focus.xhtml +++ b/dom/tests/mochitest/chrome/window_focus.xhtml @@ -46,6 +46,9 @@ var gChildWindow = null; var gOldExpectedWindow = null; var gNewExpectedWindow = null; +var gCanTabMoveFocusToRootElement = + !SpecialPowers.getBoolPref("dom.disable_tab_focus_to_root_element"); + function is(l, r, n) { window.arguments[0].SimpleTest.is(l,r,n); } function ok(v, n) { window.arguments[0].SimpleTest.ok(v,n); } @@ -398,8 +401,18 @@ function startTest() gLastFocusMethod = fm.FLAG_BYKEY; if (gPartialTabbing) { - var partialTabList = ["t3", "t5", "t9", "t10", "t11", "t12", "t13", "t14", "t15", - "t16", "t19", "t20", "t21", "t22", "t26", "t27", "t28", "t29", "t30"]; + var partialTabList; + if (gCanTabMoveFocusToRootElement) { + partialTabList = ["t3", "t5", "t9", "t10", "t11", "t12", "t13", "t14", "t15", + "t16", "t19", "t20", "t21", "t22", "t26", "t27", "t28", "t29", "t30"]; + } else { + // !gCanTabMoveFocusToRootElement + // t13 is the <html> element in child_focus_frame.html, + // and it's not getting the focus + // when gCanTabMoveFocusToRootElement is false. + partialTabList = ["t3", "t5", "t9", "t10", "t11", "t12", "t14", "t15", + "t16", "t19", "t20", "t21", "t22", "t26", "t27", "t28", "t29", "t30"]; + } for (var idx = 0; idx < partialTabList.length; idx++) { expectFocusShift(pressTab, null, getById(partialTabList[idx]), true, "partial tab key " + partialTabList[idx]); } @@ -415,6 +428,13 @@ function startTest() else { // TAB key for (var idx = 1; idx <= kTabbableSteps; idx++) { + if (!gCanTabMoveFocusToRootElement) { + if (idx == kChildDocumentRootIndex) + // t13 is the <html> element in child_focus_frame.html, + // and it's not getting the focus + // when gCanTabMoveFocusToRootElement is false. + continue; + } expectFocusShift(pressTab, null, getById("t" + idx), true, "tab key t" + idx); } @@ -427,6 +447,14 @@ function startTest() // Shift+TAB key setFocusTo("o5", window); for (idx = kTabbableSteps; idx > 0; idx--) { + if (!gCanTabMoveFocusToRootElement) { + if (idx == kChildDocumentRootIndex) { + // t13 is the <html> element in child_focus_frame.html, + // and it's not getting the focus + // when gCanTabMoveFocusToRootElement is false. + continue; + } + } expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}), null, getById("t" + idx), true, "shift tab key t" + idx); } @@ -1158,29 +1186,38 @@ function framesetWindowLoaded(framesetWindow) gOldExpectedWindow = getTopWindow(framesetWindow); gMoveToFocusFrame = true; - for (var idx = 1; idx <= 8; idx++) { - gNewExpectedWindow = framesetWindow.frames[(idx - 1) >> 1]; - if (idx % 2) + let steps = gCanTabMoveFocusToRootElement ? 8 : 4; + for (var idx = 1; idx <= steps; idx++) { + let frameIndex = gCanTabMoveFocusToRootElement ? (idx - 1) >> 1 : idx - 1; + gNewExpectedWindow = framesetWindow.frames[frameIndex]; + if (gCanTabMoveFocusToRootElement) { + if (idx % 2) { + initEvents(gNewExpectedWindow); + } + } else { initEvents(gNewExpectedWindow); + } expectFocusShift(() => synthesizeKey("KEY_Tab", {}, framesetWindow), - gNewExpectedWindow, getById("f" + idx), true, "frameset tab key f" + idx); + gNewExpectedWindow, getById("f" + (gCanTabMoveFocusToRootElement ? idx : idx * 2)), true, "frameset tab key f" + idx); gMoveToFocusFrame = false; gOldExpectedWindow = gNewExpectedWindow; } gNewExpectedWindow = framesetWindow.frames[0]; expectFocusShift(() => synthesizeKey("KEY_Tab", {}, framesetWindow), - gNewExpectedWindow, getById("f1"), true, "frameset tab key wrap to start"); + gNewExpectedWindow, gCanTabMoveFocusToRootElement ? getById("f1") : getById("f2"), true, "frameset tab key wrap to start"); gOldExpectedWindow = gNewExpectedWindow; gNewExpectedWindow = framesetWindow.frames[3]; expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}, framesetWindow), gNewExpectedWindow, getById("f8"), true, "frameset shift tab key wrap to end"); - for (idx = 7; idx >= 1; idx--) { + steps = gCanTabMoveFocusToRootElement ? 7 : 3; + for (idx = steps; idx >= 1; idx--) { gOldExpectedWindow = gNewExpectedWindow; - gNewExpectedWindow = framesetWindow.frames[(idx - 1) >> 1]; + let frameIndex = gCanTabMoveFocusToRootElement ? (idx - 1) >> 1 : idx - 1; + gNewExpectedWindow = framesetWindow.frames[frameIndex]; expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}, framesetWindow), - gNewExpectedWindow, getById("f" + idx), true, "frameset shift tab key f" + idx); + gNewExpectedWindow, getById("f" + (gCanTabMoveFocusToRootElement ? idx : idx * 2)), true, "frameset shift tab key f" + idx); } // document shifting diff --git a/dom/tests/mochitest/general/mochitest.toml b/dom/tests/mochitest/general/mochitest.toml index b8ec30f510..06137a8dd9 100644 --- a/dom/tests/mochitest/general/mochitest.toml +++ b/dom/tests/mochitest/general/mochitest.toml @@ -194,7 +194,7 @@ skip-if = [ ["test_resizeby.html"] skip-if = [ "os == 'android'", # Window sizes cannot be controled on android; Windows - "os == 'linux' && bits == 64",# Bug 1604152 + "os == 'linux' && os_version == '18.04' && bits == 64",# Bug 1604152 ] ["test_resource_timing.html"] @@ -261,8 +261,10 @@ skip-if = [ ["test_toggling_performance_navigation_timing.html"] skip-if = [ - "os == 'win' && bits == 64 && !debug", # Bug 1730152 - "os == 'mac' && bits == 64 && !debug", # Bug 1730152 + "win10_2009 && bits == 64 && !debug", # Bug 1730152 + "win11_2009 && bits == 64 && !debug", # Bug 1730152 + "apple_catalina && !debug", # Bug 1730152 + "apple_silicon && !debug", # Bug 1730152 ] ["test_vibrator.html"] diff --git a/dom/tests/mochitest/general/test_focus_scrollchildframe.html b/dom/tests/mochitest/general/test_focus_scrollchildframe.html index 4b12462c45..5bb13002b8 100644 --- a/dom/tests/mochitest/general/test_focus_scrollchildframe.html +++ b/dom/tests/mochitest/general/test_focus_scrollchildframe.html @@ -1,7 +1,7 @@ <!DOCTYPE HTML> <html> <head> - <title>Tests for for-of loops</title> + <title>Test for using TAB to move focus and scroll into view</title> <script src="/tests/SimpleTest/SimpleTest.js"></script> <script src="/tests/SimpleTest/EventUtils.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> @@ -11,10 +11,18 @@ <div id="content" style="display: none"></div> <script> function doTest() { + var canTabMoveFocusToRootElement = + !SpecialPowers.getBoolPref("dom.disable_tab_focus_to_root_element"); document.getElementById("button").focus(); + const iframe = document.querySelector("iframe"); is(window.scrollY, 0, "Scrolled position initially 0"); synthesizeKey("KEY_Tab"); - ok(window.scrollY > 200, "Scrolled child frame into view"); + is(document.activeElement, iframe, "Focus moved to the iframe"); + if (canTabMoveFocusToRootElement) { + ok(window.scrollY > 200, "Scrolled child frame into view"); + } else { + is(window.scrollY, 0, "Scrolled position remained the same"); + } SimpleTest.finish(); } SimpleTest.waitForExplicitFinish(); diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index 366a9203c7..fd15348532 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -182,6 +182,10 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "AudioContext", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "AudioData", insecureContext: true, nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "AudioDecoder", nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "AudioBufferSourceNode", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "AudioDestinationNode", insecureContext: true }, @@ -262,11 +266,7 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "ConstantSourceNode", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { - name: "ContentVisibilityAutoStateChangeEvent", - insecureContext: true, - nightly: true, - }, + { name: "ContentVisibilityAutoStateChangeEvent", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "ConvolverNode", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -390,8 +390,6 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "DOMRectReadOnly", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "DOMRequest", insecureContext: true, disabled: true }, - // IMPORTANT: Do not change this list without review from a DOM peer! { name: "DOMStringList", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "DOMStringMap", insecureContext: true }, @@ -406,6 +404,8 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "ElementInternals", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "EncodedAudioChunk", insecureContext: true, nightly: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "EncodedVideoChunk", insecureContext: true, nightly: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "ErrorEvent", insecureContext: true }, @@ -456,23 +456,23 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "GainNode", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "Gamepad", insecureContext: false }, + { name: "Gamepad", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadAxisMoveEvent", insecureContext: false }, + { name: "GamepadAxisMoveEvent", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadButtonEvent", insecureContext: false }, + { name: "GamepadButtonEvent", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadButton", insecureContext: false }, + { name: "GamepadButton", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadEvent", insecureContext: false }, + { name: "GamepadEvent", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadHapticActuator", insecureContext: false }, + { name: "GamepadHapticActuator", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadLightIndicator", insecureContext: false, disabled: true }, + { name: "GamepadLightIndicator", insecureContext: true, disabled: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadPose", insecureContext: false }, + { name: "GamepadPose", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "GamepadTouch", insecureContext: false, disabled: true }, + { name: "GamepadTouch", insecureContext: true, disabled: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "Geolocation", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -1074,6 +1074,8 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "RTCIceCandidate", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "RTCIceTransport", insecureContext: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "RTCPeerConnection", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "RTCPeerConnectionIceEvent", insecureContext: true }, @@ -1645,7 +1647,7 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "onbeforeprint", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! - { name: "onbeforetoggle", insecureContext: true, nightly: true }, + { name: "onbeforetoggle", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "onbeforeunload", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! @@ -1663,8 +1665,12 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "onclose", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "oncontextlost", insecureContext: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "oncontextmenu", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "oncontextrestored", insecureContext: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "oncopy", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "oncuechange", insecureContext: true }, diff --git a/dom/tests/mochitest/webcomponents/mochitest.toml b/dom/tests/mochitest/webcomponents/mochitest.toml index 8b9dad41d5..e43a4d1ccd 100644 --- a/dom/tests/mochitest/webcomponents/mochitest.toml +++ b/dom/tests/mochitest/webcomponents/mochitest.toml @@ -64,8 +64,6 @@ support-files = [ ["test_event_retarget.html"] -["test_event_stopping.html"] - ["test_link_prefetch.html"] ["test_shadowdom_active_pseudo_class.html"] diff --git a/dom/tests/mochitest/webcomponents/test_event_stopping.html b/dom/tests/mochitest/webcomponents/test_event_stopping.html deleted file mode 100644 index c90988d869..0000000000 --- a/dom/tests/mochitest/webcomponents/test_event_stopping.html +++ /dev/null @@ -1,174 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=887541 ---> -<head> - <title>Test for event model in web components</title> - <script type="text/javascript" src="head.js"></script> - <script src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=887541">Bug 887541</a> -<script> - -var els = SpecialPowers.Cc["@mozilla.org/eventlistenerservice;1"] - .getService(SpecialPowers.Ci.nsIEventListenerService); - -SimpleTest.waitForExplicitFinish(); -createIframe() - .then((aDocument) => { - function eventListener(e) { - eventChain.push(this); - } - - function isEventChain(actual, expected, msg) { - is(actual.length, expected.length, msg); - for (var i = 0; i < expected.length; i++) { - is(actual[i], expected[i], msg + " at " + i); - } - - if (actual.length) { - var chain = els.getEventTargetChainFor(actual[0], false); // Events should be dispatched on actual[0]. - ok(expected.length < chain.length, "There should be additional chrome event targets."); - } - } - - /* - * <div elemOne> ------ <shadow-root shadowOne> - * | - * <span elemTwo> - * | - * <span elemThree> - */ - - var elemOne = aDocument.createElement("div"); - var elemTwo = aDocument.createElement("span"); - var elemThree = aDocument.createElement("span"); - var shadowOne = elemOne.attachShadow({mode: "open"}); - - shadowOne.appendChild(elemTwo); - elemTwo.appendChild(elemThree); - - // Test stopping "abort" event. - - elemOne.addEventListener("abort", eventListener); - elemTwo.addEventListener("abort", eventListener); - elemThree.addEventListener("abort", eventListener); - shadowOne.addEventListener("abort", eventListener); - - var eventChain = []; - - var customEvent = new CustomEvent("abort", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that abort event is stopped at shadow root."); - - // Test stopping "error" event. - - elemOne.addEventListener("error", eventListener); - elemTwo.addEventListener("error", eventListener); - elemThree.addEventListener("error", eventListener); - shadowOne.addEventListener("error", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("error", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that error event is stopped at shadow root."); - - // Test stopping "select" event. - - elemOne.addEventListener("select", eventListener); - elemTwo.addEventListener("select", eventListener); - elemThree.addEventListener("select", eventListener); - shadowOne.addEventListener("select", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("select", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that select event is stopped at shadow root."); - - // Test stopping "change" event. - - elemOne.addEventListener("change", eventListener); - elemTwo.addEventListener("change", eventListener); - elemThree.addEventListener("change", eventListener); - shadowOne.addEventListener("change", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("change", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - - // Test stopping "reset" event. - - elemOne.addEventListener("reset", eventListener); - elemTwo.addEventListener("reset", eventListener); - elemThree.addEventListener("reset", eventListener); - shadowOne.addEventListener("reset", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("reset", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that reset event is stopped at shadow root."); - - // Test stopping "load" event. - - elemOne.addEventListener("load", eventListener); - elemTwo.addEventListener("load", eventListener); - elemThree.addEventListener("load", eventListener); - shadowOne.addEventListener("load", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("load", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that load event is stopped at shadow root."); - - // Test stopping "resize" event. - - elemOne.addEventListener("resize", eventListener); - elemTwo.addEventListener("resize", eventListener); - elemThree.addEventListener("resize", eventListener); - shadowOne.addEventListener("resize", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("resize", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that resize event is stopped at shadow root."); - - // Test stopping "scroll" event. - - elemOne.addEventListener("scroll", eventListener); - elemTwo.addEventListener("scroll", eventListener); - elemThree.addEventListener("scroll", eventListener); - shadowOne.addEventListener("scroll", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("scroll", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that scroll event is stopped at shadow root."); - - // Test stopping "selectstart" event. - - elemOne.addEventListener("selectstart", eventListener); - elemTwo.addEventListener("selectstart", eventListener); - elemThree.addEventListener("selectstart", eventListener); - shadowOne.addEventListener("selectstart", eventListener); - - eventChain = []; - - customEvent = new CustomEvent("selectstart", { "bubbles" : true }); - elemThree.dispatchEvent(customEvent); - isEventChain(eventChain, [elemThree, elemTwo, shadowOne], "Test that selectstart event is stopped at shadow root."); - - SimpleTest.finish(); - }); -</script> -</body> -</html> diff --git a/dom/tests/unit/test_Fetch.js b/dom/tests/unit/test_Fetch.js index 768cf671dd..1449a23854 100644 --- a/dom/tests/unit/test_Fetch.js +++ b/dom/tests/unit/test_Fetch.js @@ -216,7 +216,7 @@ add_test(function test_getTestFailedConnect() { do_test_pending(); // try a server that's not there fetch("http://localhost:4/should/fail") - .then(response => { + .then(() => { do_throw("Request should not succeed"); }) .catch(err => { @@ -230,7 +230,7 @@ add_test(function test_mozError() { do_test_pending(); // try a server that's not there fetch("http://localhost:4/should/fail", { mozErrors: true }) - .then(response => { + .then(() => { do_throw("Request should not succeed"); }) .catch(err => { @@ -245,7 +245,7 @@ add_test(function test_request_mozError() { // try a server that's not there const r = new Request("http://localhost:4/should/fail", { mozErrors: true }); fetch(r) - .then(response => { + .then(() => { do_throw("Request should not succeed"); }) .catch(err => { diff --git a/dom/tests/unit/test_PromiseDebugging.js b/dom/tests/unit/test_PromiseDebugging.js index 2262d60d61..6148b65c75 100644 --- a/dom/tests/unit/test_PromiseDebugging.js +++ b/dom/tests/unit/test_PromiseDebugging.js @@ -2,7 +2,7 @@ function run_test() { // Hack around Promise.jsm being stuck on my global Assert.equal(false, PromiseDebugging === undefined); var res; - var p = new Promise(function (resolve, reject) { + var p = new Promise(function (resolve) { res = resolve; }); var state = PromiseDebugging.getState(p); diff --git a/dom/tests/unit/test_geolocation_monitor.js b/dom/tests/unit/test_geolocation_monitor.js index f0fc1ad74b..7b47463882 100644 --- a/dom/tests/unit/test_geolocation_monitor.js +++ b/dom/tests/unit/test_geolocation_monitor.js @@ -56,7 +56,7 @@ function watchPosition() { let observer = { QueryInterface: ChromeUtils.generateQI(["nsIObserver"]), - observe(subject, topic, data) { + observe(subject, topic) { Assert.equal(topic, "geolocation-position-events"); observer._countEvents++; observer._lastData = toJSON(subject); diff --git a/dom/tests/unit/test_geolocation_provider.js b/dom/tests/unit/test_geolocation_provider.js index 8c58cd39f5..e08887bfce 100644 --- a/dom/tests/unit/test_geolocation_provider.js +++ b/dom/tests/unit/test_geolocation_provider.js @@ -12,10 +12,10 @@ function terminate(succ) { geolocation.clearWatch(watchID); } -function successCallback(pos) { +function successCallback() { terminate(true); } -function errorCallback(pos) { +function errorCallback() { terminate(false); } |