From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../browser/browser_ConsoleStorageAPITests.js | 4 +- .../browser_ConsoleStoragePBTest_perwindowpb.js | 2 +- dom/tests/browser/browser_bug1004814.js | 2 +- dom/tests/browser/browser_bug1236512.js | 4 +- dom/tests/browser/browser_bug1238427.js | 2 +- dom/tests/browser/browser_bug1563629.js | 2 +- ...ser_form_associated_custom_elements_validity.js | 47 ++++++++++++++++++++++ .../browser_localStorage_privatestorageevent.js | 20 ++++----- dom/tests/browser/browser_persist_cookies.js | 2 +- .../browser/browser_persist_cross_origin_iframe.js | 8 ++-- dom/tests/browser/browser_persist_image_accept.js | 4 +- .../browser/browser_persist_mixed_content_image.js | 2 +- .../browser/browser_sessionStorage_navigation.js | 2 +- .../browser_test_focus_after_modal_state.js | 4 +- .../browser/browser_windowProxy_transplant.js | 2 +- .../browser/create_webrtc_peer_connection.html | 2 +- dom/tests/browser/file_postMessage_parent.html | 2 +- dom/tests/browser/geo_leak_test.html | 2 +- dom/tests/browser/test-console-api.html | 2 +- dom/tests/browser/worker_bug1004814.js | 2 +- 20 files changed, 82 insertions(+), 35 deletions(-) (limited to 'dom/tests/browser') 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,custom elements`, + }, + 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; }); 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 @@ Geolocation incomplete position leak test