From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- dom/base/test/browser.toml | 2 +- .../test/browser_aboutnewtab_process_selection.js | 4 +- dom/base/test/file_window_close.html | 2 +- .../fullscreen/browser_fullscreen-bug-1798219.js | 4 +- .../browser_fullscreen-navigation-history-race.js | 4 +- .../browser_fullscreen-navigation-history.js | 4 +- .../browser_fullscreen-window-open-race.js | 2 +- .../test/fullscreen/file_MozDomFullscreen.html | 2 +- .../fullscreen/file_fullscreen-iframe-middle.html | 2 +- .../fullscreen/file_fullscreen-iframe-top.html | 2 +- dom/base/test/fullscreen/fullscreen_helpers.js | 7 +- .../fullscreen/test_MozDomFullscreen_event.xhtml | 2 +- dom/base/test/jsmodules/chrome.toml | 12 + dom/base/test/jsmodules/export_star_ambiguous.mjs | 1 + .../test/jsmodules/import_ambiguous_export.mjs | 1 + .../jsmodules/import_ambiguous_export_star.mjs | 1 + dom/base/test/jsmodules/import_circular.mjs | 1 + dom/base/test/jsmodules/import_circular_1.mjs | 1 + dom/base/test/jsmodules/import_no_export.mjs | 2 +- .../test/jsmodules/import_no_indirect_export.mjs | 2 +- .../test/jsmodules/importmaps/classic_script.js | 1 + dom/base/test/jsmodules/importmaps/mochitest.toml | 7 + .../test/jsmodules/importmaps/module_chain_1.mjs | 2 + .../test/jsmodules/importmaps/module_chain_2.mjs | 1 + .../module_importMap_with_nonexisting_module.mjs | 4 + .../test_dynamic_importMap_load_completes.html | 33 +++ ...est_dynamic_importMap_with_external_script.html | 81 ++++++ .../test_importMap_with_nonexisting_module.html | 25 ++ dom/base/test/jsmodules/module_a.mjs | 2 + dom/base/test/jsmodules/module_b.mjs | 2 + dom/base/test/jsmodules/module_c.mjs | 3 + dom/base/test/jsmodules/module_d.mjs | 1 + dom/base/test/jsmodules/module_e.mjs | 1 + .../test/jsmodules/test_import_errorMessage.html | 40 ++- .../test/jsmodules/test_import_errorMessage2.html | 35 +++ dom/base/test/mochitest.toml | 2 + dom/base/test/test_bug564863-2.xhtml | 6 +- .../test_content_iterator_subtree_shadow_tree.html | 290 +++++++++++++++++++++ dom/base/test/test_embed_xorigin_document.html | 5 - dom/base/test/test_range_bounds.html | 48 +++- dom/base/test/unit/test_xhr_standalone.js | 5 + 41 files changed, 596 insertions(+), 56 deletions(-) create mode 100644 dom/base/test/jsmodules/export_star_ambiguous.mjs create mode 100644 dom/base/test/jsmodules/import_ambiguous_export.mjs create mode 100644 dom/base/test/jsmodules/import_ambiguous_export_star.mjs create mode 100644 dom/base/test/jsmodules/import_circular.mjs create mode 100644 dom/base/test/jsmodules/import_circular_1.mjs create mode 100644 dom/base/test/jsmodules/importmaps/classic_script.js create mode 100644 dom/base/test/jsmodules/importmaps/module_chain_1.mjs create mode 100644 dom/base/test/jsmodules/importmaps/module_chain_2.mjs create mode 100644 dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs create mode 100644 dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html create mode 100644 dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html create mode 100644 dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html create mode 100644 dom/base/test/jsmodules/module_a.mjs create mode 100644 dom/base/test/jsmodules/module_b.mjs create mode 100644 dom/base/test/jsmodules/module_c.mjs create mode 100644 dom/base/test/jsmodules/module_d.mjs create mode 100644 dom/base/test/jsmodules/module_e.mjs create mode 100644 dom/base/test/jsmodules/test_import_errorMessage2.html create mode 100644 dom/base/test/test_content_iterator_subtree_shadow_tree.html (limited to 'dom/base/test') diff --git a/dom/base/test/browser.toml b/dom/base/test/browser.toml index a68bd2e873..04eca5d1aa 100644 --- a/dom/base/test/browser.toml +++ b/dom/base/test/browser.toml @@ -104,7 +104,7 @@ skip-if = ["fission"] # Fails with Fission, and we're unlikely to spend time to ["browser_multiple_popups.js"] skip-if = [ "os == 'win' && !debug", # Bug 1505235 - "os == 'mac' && !debug", # Bug 1661132 (osx) + "apple_catalina", # Bug 1661132 (osx), Bug 1866073 "socketprocess_networking", ] support-files = ["browser_multiple_popups.html"] diff --git a/dom/base/test/browser_aboutnewtab_process_selection.js b/dom/base/test/browser_aboutnewtab_process_selection.js index ad59077105..db0e80acdf 100644 --- a/dom/base/test/browser_aboutnewtab_process_selection.js +++ b/dom/base/test/browser_aboutnewtab_process_selection.js @@ -33,7 +33,7 @@ add_task(async function () { // Open 3 tabs using the preloaded browser. let tabs = []; for (let i = 0; i < 3; i++) { - BrowserOpenTab(); + BrowserCommands.openTab(); tabs.unshift(gBrowser.selectedTab); await BrowserTestUtils.maybeCreatePreloadedBrowser(gBrowser); @@ -114,7 +114,7 @@ add_task(async function preloaded_state_attribute() { "Sanity check that the first preloaded browser has the correct attribute" ); - BrowserOpenTab(); + BrowserCommands.openTab(); await BrowserTestUtils.maybeCreatePreloadedBrowser(gBrowser); // Now check that the tabs have the correct browser attributes set diff --git a/dom/base/test/file_window_close.html b/dom/base/test/file_window_close.html index 5adec04ec4..b3bb20d499 100644 --- a/dom/base/test/file_window_close.html +++ b/dom/base/test/file_window_close.html @@ -13,7 +13,7 @@ if (history.length == 4) { // We're coming back from history. function listener(m) { - if (m.message.includes("Scripts may not close windows that were not opened by script.")) { + if (m.message.includes("Scripts may only close windows that were opened by a script.")) { SpecialPowers.postConsoleSentinel(); SpecialPowers.pushPrefEnv({ set: [["dom.allow_scripts_to_close_windows", true]]}).then( function() { diff --git a/dom/base/test/fullscreen/browser_fullscreen-bug-1798219.js b/dom/base/test/fullscreen/browser_fullscreen-bug-1798219.js index 2aef23b042..6764ff2009 100644 --- a/dom/base/test/fullscreen/browser_fullscreen-bug-1798219.js +++ b/dom/base/test/fullscreen/browser_fullscreen-bug-1798219.js @@ -52,7 +52,7 @@ async function waitAndCheckFullscreenState(aWindow) { add_task(async () => { const URL = - "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html"; + "https://example.com/browser/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html"; // We need this dummy tab which load the same URL as test tab to keep the // original content process alive after test page navigates away. let dummyTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL); @@ -90,7 +90,7 @@ add_task(async () => { await BrowserTestUtils.withNewTab( { gBrowser, - url: "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html", + url: "https://example.com/browser/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html", }, async function (browser) { // Open a new window to run the tests, the original window will keep the diff --git a/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js b/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js index 49a48c3177..ab1651fd74 100644 --- a/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js +++ b/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js @@ -54,7 +54,7 @@ function preventBFCache(aBrowsingContext, aPrevent) { await BrowserTestUtils.withNewTab( { gBrowser, - url: "http://mochi.test:8888/browser/dom/base/test/fullscreen/dummy_page.html", + url: "https://example.com/browser/dom/base/test/fullscreen/dummy_page.html", }, async function (browser) { // Maybe prevent BFCache on initial page. @@ -66,7 +66,7 @@ function preventBFCache(aBrowsingContext, aPrevent) { // Navigate to fullscreen page. const url = crossOrigin ? "https://example.org/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html" - : "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html"; + : "https://example.com/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html"; const loaded = BrowserTestUtils.browserLoaded(browser, false, url); BrowserTestUtils.startLoadingURIString(browser, url); await loaded; diff --git a/dom/base/test/fullscreen/browser_fullscreen-navigation-history.js b/dom/base/test/fullscreen/browser_fullscreen-navigation-history.js index c4feb7f641..1b344b7a2f 100644 --- a/dom/base/test/fullscreen/browser_fullscreen-navigation-history.js +++ b/dom/base/test/fullscreen/browser_fullscreen-navigation-history.js @@ -54,7 +54,7 @@ function preventBFCache(aBrowsingContext, aPrevent) { await BrowserTestUtils.withNewTab( { gBrowser, - url: "http://mochi.test:8888/browser/dom/base/test/fullscreen/dummy_page.html", + url: "https://example.com/browser/dom/base/test/fullscreen/dummy_page.html", }, async function (browser) { // Maybe prevent BFCache on initial page. @@ -66,7 +66,7 @@ function preventBFCache(aBrowsingContext, aPrevent) { // Navigate to fullscreen page. const url = crossOrigin ? "https://example.org/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html" - : "http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html"; + : "https://example.com/browser/dom/base/test/fullscreen/file_fullscreen-iframe-inner.html"; const loaded = BrowserTestUtils.browserLoaded(browser, false, url); BrowserTestUtils.startLoadingURIString(browser, url); await loaded; diff --git a/dom/base/test/fullscreen/browser_fullscreen-window-open-race.js b/dom/base/test/fullscreen/browser_fullscreen-window-open-race.js index 4cf8a3d8c7..95668db542 100644 --- a/dom/base/test/fullscreen/browser_fullscreen-window-open-race.js +++ b/dom/base/test/fullscreen/browser_fullscreen-window-open-race.js @@ -27,7 +27,7 @@ add_setup(async function () { add_task(async () => { const url = - "http://mochi.test:8888/browser/dom/base/test/fullscreen/dummy_page.html"; + "https://example.com/browser/dom/base/test/fullscreen/dummy_page.html"; const name = "foo"; await BrowserTestUtils.withNewTab( diff --git a/dom/base/test/fullscreen/file_MozDomFullscreen.html b/dom/base/test/fullscreen/file_MozDomFullscreen.html index f954892706..600d335501 100644 --- a/dom/base/test/fullscreen/file_MozDomFullscreen.html +++ b/dom/base/test/fullscreen/file_MozDomFullscreen.html @@ -3,6 +3,6 @@

Outer doc

- + diff --git a/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html b/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html index b60dea43bf..35b07cfa11 100644 --- a/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html +++ b/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html @@ -1,5 +1,5 @@

diff --git a/dom/base/test/fullscreen/file_fullscreen-iframe-top.html b/dom/base/test/fullscreen/file_fullscreen-iframe-top.html index dddf4930c2..b61cdc02c3 100644 --- a/dom/base/test/fullscreen/file_fullscreen-iframe-top.html +++ b/dom/base/test/fullscreen/file_fullscreen-iframe-top.html @@ -1,5 +1,5 @@

diff --git a/dom/base/test/fullscreen/fullscreen_helpers.js b/dom/base/test/fullscreen/fullscreen_helpers.js index f097ae316e..41548cf8aa 100644 --- a/dom/base/test/fullscreen/fullscreen_helpers.js +++ b/dom/base/test/fullscreen/fullscreen_helpers.js @@ -8,15 +8,14 @@ const TEST_URLS = [ `data:text/html,
+ src="https://example.com/browser/dom/base/test/fullscreen/file_fullscreen-iframe-middle.html">
`, // toplevel and inner most iframe are in same process, and middle iframe is // in a different process. - // eslint-disable-next-line @microsoft/sdl/no-insecure-url - `http://example.org/browser/dom/base/test/fullscreen/file_fullscreen-iframe-top.html`, + `https://example.org/browser/dom/base/test/fullscreen/file_fullscreen-iframe-top.html`, // toplevel and middle iframe are in same process, and inner most iframe is // in a different process. - `http://mochi.test:8888/browser/dom/base/test/fullscreen/file_fullscreen-iframe-top.html`, + `https://example.com/browser/dom/base/test/fullscreen/file_fullscreen-iframe-top.html`, ]; function waitRemoteFullscreenExitEvents(aBrowsingContexts) { diff --git a/dom/base/test/fullscreen/test_MozDomFullscreen_event.xhtml b/dom/base/test/fullscreen/test_MozDomFullscreen_event.xhtml index 3041d851ac..6b3d8fada2 100644 --- a/dom/base/test/fullscreen/test_MozDomFullscreen_event.xhtml +++ b/dom/base/test/fullscreen/test_MozDomFullscreen_event.xhtml @@ -17,7 +17,7 @@ var gPrevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requ var newwindow; // Ensure "fullscreen" permissions are not present on the test URI. -var uri = Services.io.newURI("http://mochi.test:8888"); +var uri = Services.io.newURI("https://example.com"); var principal = Services.scriptSecurityManager.createContentPrincipal(uri, {}); Services.perms.removeFromPrincipal(principal, "fullscreen"); diff --git a/dom/base/test/jsmodules/chrome.toml b/dom/base/test/jsmodules/chrome.toml index 82d02ad4df..8b8a614bfb 100644 --- a/dom/base/test/jsmodules/chrome.toml +++ b/dom/base/test/jsmodules/chrome.toml @@ -3,11 +3,21 @@ support-files = [ "ambiguous_export.mjs", "import_ambiguous.mjs", "import_ambiguous_indirect_export.mjs", + "import_ambiguous_export.mjs", + "import_ambiguous_export_star.mjs", + "import_circular.mjs", + "import_circular_1.mjs", "import_no_export.mjs", "import_no_indirect_export.mjs", "exportA1.mjs", "exportA2.mjs", "export_ambiguous.mjs", + "export_star_ambiguous.mjs", + "module_a.mjs", + "module_b.mjs", + "module_c.mjs", + "module_d.mjs", + "module_e.mjs", "module_setRan.mjs", "module_testSyntax.mjs", "module_badSyntax.mjs", @@ -47,6 +57,8 @@ support-files = [ ["test_import_errorMessage.html"] +["test_import_errorMessage2.html"] + ["test_import_meta_resolve.html"] ["test_importedModuleMemoization.html"] diff --git a/dom/base/test/jsmodules/export_star_ambiguous.mjs b/dom/base/test/jsmodules/export_star_ambiguous.mjs new file mode 100644 index 0000000000..35cc979dee --- /dev/null +++ b/dom/base/test/jsmodules/export_star_ambiguous.mjs @@ -0,0 +1 @@ +export * from "./ambiguous_export.mjs"; diff --git a/dom/base/test/jsmodules/import_ambiguous_export.mjs b/dom/base/test/jsmodules/import_ambiguous_export.mjs new file mode 100644 index 0000000000..f5c12ff086 --- /dev/null +++ b/dom/base/test/jsmodules/import_ambiguous_export.mjs @@ -0,0 +1 @@ +import { a } from "./ambiguous_export.mjs"; diff --git a/dom/base/test/jsmodules/import_ambiguous_export_star.mjs b/dom/base/test/jsmodules/import_ambiguous_export_star.mjs new file mode 100644 index 0000000000..1ee2a56d37 --- /dev/null +++ b/dom/base/test/jsmodules/import_ambiguous_export_star.mjs @@ -0,0 +1 @@ +import { a } from "./export_star_ambiguous.mjs"; diff --git a/dom/base/test/jsmodules/import_circular.mjs b/dom/base/test/jsmodules/import_circular.mjs new file mode 100644 index 0000000000..bb3a46bd5e --- /dev/null +++ b/dom/base/test/jsmodules/import_circular.mjs @@ -0,0 +1 @@ +export { a } from "./import_circular_1.mjs"; diff --git a/dom/base/test/jsmodules/import_circular_1.mjs b/dom/base/test/jsmodules/import_circular_1.mjs new file mode 100644 index 0000000000..eb7c038c77 --- /dev/null +++ b/dom/base/test/jsmodules/import_circular_1.mjs @@ -0,0 +1 @@ +export { a } from "./import_circular.mjs"; diff --git a/dom/base/test/jsmodules/import_no_export.mjs b/dom/base/test/jsmodules/import_no_export.mjs index 47cabac557..d989498c88 100644 --- a/dom/base/test/jsmodules/import_no_export.mjs +++ b/dom/base/test/jsmodules/import_no_export.mjs @@ -1 +1 @@ -import x from "./no_export.mjs"; +import { x } from "./no_export.mjs"; diff --git a/dom/base/test/jsmodules/import_no_indirect_export.mjs b/dom/base/test/jsmodules/import_no_indirect_export.mjs index dd1ca847fc..bfcdcedbc5 100644 --- a/dom/base/test/jsmodules/import_no_indirect_export.mjs +++ b/dom/base/test/jsmodules/import_no_indirect_export.mjs @@ -1,2 +1,2 @@ /* eslint-disable import/default */ -import x from "./no_indirect_export.mjs"; +import { a } from "./no_indirect_export.mjs"; diff --git a/dom/base/test/jsmodules/importmaps/classic_script.js b/dom/base/test/jsmodules/importmaps/classic_script.js new file mode 100644 index 0000000000..d7ae0be054 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/classic_script.js @@ -0,0 +1 @@ +// Empty script. diff --git a/dom/base/test/jsmodules/importmaps/mochitest.toml b/dom/base/test/jsmodules/importmaps/mochitest.toml index 4229455722..1f95b155ac 100644 --- a/dom/base/test/jsmodules/importmaps/mochitest.toml +++ b/dom/base/test/jsmodules/importmaps/mochitest.toml @@ -3,6 +3,9 @@ support-files = [ "bug_1865410_module_a.mjs", "bug_1865410_module_b.mjs", "bug_1873417.mjs", + "classic_script.js", + "module_chain_1.mjs", + "module_chain_2.mjs", "module_importMap_with_external_script_0.mjs", "module_importMap_with_external_script_1.mjs", "module_importMap_with_external_script_2.mjs", @@ -13,6 +16,7 @@ support-files = [ "module_importMap_with_external_script_6.mjs", "module_importMap_with_external_script_6.mjs^headers^", "module_importMap_with_external_script_7.mjs", + "module_importMap_with_nonexisting_module.mjs", "bad/module_2.mjs", "bad/module_3.mjs", "bad/module_4.mjs", @@ -31,3 +35,6 @@ support-files = [ ["test_bug_1873417.html"] ["test_importMap_with_external_script.html"] +["test_importMap_with_nonexisting_module.html"] +["test_dynamic_importMap_with_external_script.html"] +["test_dynamic_importMap_load_completes.html"] diff --git a/dom/base/test/jsmodules/importmaps/module_chain_1.mjs b/dom/base/test/jsmodules/importmaps/module_chain_1.mjs new file mode 100644 index 0000000000..d9515fab7f --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/module_chain_1.mjs @@ -0,0 +1,2 @@ +// eslint-disable-next-line import/no-unassigned-import +import {} from "./module_chain_2.mjs"; diff --git a/dom/base/test/jsmodules/importmaps/module_chain_2.mjs b/dom/base/test/jsmodules/importmaps/module_chain_2.mjs new file mode 100644 index 0000000000..ce12406a76 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/module_chain_2.mjs @@ -0,0 +1 @@ +loaded = true; diff --git a/dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs b/dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs new file mode 100644 index 0000000000..4f9981bbe3 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/module_importMap_with_nonexisting_module.mjs @@ -0,0 +1,4 @@ +/* eslint-disable import/no-unassigned-import, import/no-unresolved */ +// Bareword specifier should be mapped to ./good/module_0.mjs. +import {} from "bare"; +import * as test from "nonexistingmodule"; diff --git a/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html new file mode 100644 index 0000000000..da354c1ca0 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_load_completes.html @@ -0,0 +1,33 @@ + + + +Test script loading complets when there's a dynamicly inserted import map + + + + + + + + + + + + + + + + + diff --git a/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html new file mode 100644 index 0000000000..b78992fb87 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_dynamic_importMap_with_external_script.html @@ -0,0 +1,81 @@ + + + +Test speculative preload of external script doesn't conflict with import map + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html b/dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html new file mode 100644 index 0000000000..57cfd5e5a1 --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_importMap_with_nonexisting_module.html @@ -0,0 +1,25 @@ + + +Test an import map with an nonexisting module specifier + + + + + + + + diff --git a/dom/base/test/jsmodules/module_a.mjs b/dom/base/test/jsmodules/module_a.mjs new file mode 100644 index 0000000000..0b0c3304ff --- /dev/null +++ b/dom/base/test/jsmodules/module_a.mjs @@ -0,0 +1,2 @@ +export var a = 1; +export var b = 2; diff --git a/dom/base/test/jsmodules/module_b.mjs b/dom/base/test/jsmodules/module_b.mjs new file mode 100644 index 0000000000..79da84736d --- /dev/null +++ b/dom/base/test/jsmodules/module_b.mjs @@ -0,0 +1,2 @@ +export var b = 3; +export var c = 4; diff --git a/dom/base/test/jsmodules/module_c.mjs b/dom/base/test/jsmodules/module_c.mjs new file mode 100644 index 0000000000..5a2a7e3e09 --- /dev/null +++ b/dom/base/test/jsmodules/module_c.mjs @@ -0,0 +1,3 @@ +/* eslint-disable import/export */ +export * from "./module_a.mjs"; +export * from "./module_b.mjs"; diff --git a/dom/base/test/jsmodules/module_d.mjs b/dom/base/test/jsmodules/module_d.mjs new file mode 100644 index 0000000000..04dc02d27a --- /dev/null +++ b/dom/base/test/jsmodules/module_d.mjs @@ -0,0 +1 @@ +import { a } from "./module_c.mjs"; diff --git a/dom/base/test/jsmodules/module_e.mjs b/dom/base/test/jsmodules/module_e.mjs new file mode 100644 index 0000000000..544c424fcb --- /dev/null +++ b/dom/base/test/jsmodules/module_e.mjs @@ -0,0 +1 @@ +import { b } from "./module_c.mjs"; diff --git a/dom/base/test/jsmodules/test_import_errorMessage.html b/dom/base/test/jsmodules/test_import_errorMessage.html index 6ab0b1dd74..2330b46dd9 100644 --- a/dom/base/test/jsmodules/test_import_errorMessage.html +++ b/dom/base/test/jsmodules/test_import_errorMessage.html @@ -8,40 +8,38 @@ let count = 0; window.onerror = function (event, src, lineno, colno, error) { - info("window.onerror :" + error.message); + info("window.onerror: message: " + error.message); + info("window.onerror: src: " + src); ok(error instanceof SyntaxError, "Should be a SyntaxError."); - // import_no_indirect_export.mjs and import_ambiguous_indirect_export.mjs - // are related to indirect import/export. - if (count < 2) { - ok(error.message.match("indirect"), "Should contain 'indirect'"); - } - - // import_ambiguous_indirect_export.mjs and import_ambiguous.mjs both - // have ambiguous import/export. - if (count % 2 === 1) { - ok(error.message.match("ambiguous"), "Should contain 'ambiguous'"); - } - - if (count === 2) { - ok(!error.message.match("ambiguous") && !error.message.match("indirect"), - "Should NOT contain 'indirect' nor 'ambiguous'"); + if (src.match("no_indirect_export.mjs") || + src.match("import_no_export.mjs")) { + ok(error.message.match("doesn't provide an export named")); + } else if(src.match("export_ambiguous.mjs") || + src.match("import_ambiguous_export_star.mjs") || + src.match("import_ambiguous_export.mjs") || + src.match("import_ambiguous.mjs")) { + ok(error.message.match("contains ambiguous star export")); + } else if (src.match("import_circular_1.mjs")) { + ok(error.message.match("contains circular import")); + } else { + ok(false, "unknown src " + src); } count++; }; function testLoaded() { - ok(count === 4, "Should have 4 SynaxErrors thrown."); + ok(count === 7, "Should have 7 SynaxErrors thrown."); SimpleTest.finish(); } + - + + + diff --git a/dom/base/test/jsmodules/test_import_errorMessage2.html b/dom/base/test/jsmodules/test_import_errorMessage2.html new file mode 100644 index 0000000000..ed4227362e --- /dev/null +++ b/dom/base/test/jsmodules/test_import_errorMessage2.html @@ -0,0 +1,35 @@ + + +Test to get the filename of the requested module after it has been evaluated + + + + + + + + + diff --git a/dom/base/test/mochitest.toml b/dom/base/test/mochitest.toml index fb6724e497..a1e7b31a19 100644 --- a/dom/base/test/mochitest.toml +++ b/dom/base/test/mochitest.toml @@ -1170,6 +1170,8 @@ skip-if = [ ["test_content_iterator_subtree.html"] +["test_content_iterator_subtree_shadow_tree.html"] + ["test_copyimage.html"] skip-if = [ "os == 'android'", diff --git a/dom/base/test/test_bug564863-2.xhtml b/dom/base/test/test_bug564863-2.xhtml index 6f338f612d..c860a7f6d7 100644 --- a/dom/base/test/test_bug564863-2.xhtml +++ b/dom/base/test/test_bug564863-2.xhtml @@ -55,11 +55,11 @@ SimpleTest.waitForExplicitFinish(); // not when run as a Mochitest plain. //is(xul_cs.color, "rgb(0, 0, 0)", "xul color " + test); - attrValue = removed ? null : ""; + let attrValue = removed ? null : ""; is(xul.id, "", "xul id " + test); - is(xul.getAttribute("id"), "", "xul getAttribute " + test); + is(xul.getAttribute("id"), attrValue, "xul getAttribute " + test); is($("xul_id"), null, "xul getElementById " + test); } @@ -149,7 +149,7 @@ SimpleTest.waitForExplicitFinish(); await new Promise(SimpleTest.executeSoon); if (mutation) { is(mutation.target, xul, "target is xul"); - is(xul.getAttribute("id"), "", "xul no longer has id attr"); + is(xul.getAttribute("id"), null, "xul no longer has id attr"); is(xul.id, "", "xul no longer has id"); xul.id = "other_xul_id"; } else { diff --git a/dom/base/test/test_content_iterator_subtree_shadow_tree.html b/dom/base/test/test_content_iterator_subtree_shadow_tree.html new file mode 100644 index 0000000000..033aaf80a7 --- /dev/null +++ b/dom/base/test/test_content_iterator_subtree_shadow_tree.html @@ -0,0 +1,290 @@ + + + + + Test for content subtree iterator with ShadowDOM involved + + + + + + diff --git a/dom/base/test/test_embed_xorigin_document.html b/dom/base/test/test_embed_xorigin_document.html index 7d4c29aacf..4566d48534 100644 --- a/dom/base/test/test_embed_xorigin_document.html +++ b/dom/base/test/test_embed_xorigin_document.html @@ -12,11 +12,6 @@ const testPath = window.location.href.replace("http://mochi.test:8888", ""); const testDir = testPath.substring(0, testPath.lastIndexOf('/') + 1); add_task(async function() { - // FIXME: Remove when bug 1658342 is fixed - await SpecialPowers.pushPrefEnv({ - set: [["fission.remoteObjectEmbed", true]], - }); - info("Loading image in embed"); let embed = document.createElement("embed"); document.body.appendChild(embed); diff --git a/dom/base/test/test_range_bounds.html b/dom/base/test/test_range_bounds.html index 657d315198..dba687eead 100644 --- a/dom/base/test/test_range_bounds.html +++ b/dom/base/test/test_range_bounds.html @@ -38,6 +38,22 @@ function isEmptyRect(rect, name) { is(rect.height, 0, name+'empty rect should have height = 0'); } +function getTextBoundingClientRect(node) { + const quads = node.getBoxQuads()[0]; + return DOMRect.fromRect({ + x: quads.p1.x, + y: quads.p1.y, + width: quads.p2.x - quads.p1.x, + height: quads.p3.y - quads.p2.y + }); +} + +function sortRectList(rectlist) { + return Array.prototype.slice.call(rectlist, 0).sort(function(a, b) { + return a.top - b.top || a.left - b.left; + }); +} + function isEmptyRectList(rectlist, name) { name = annotateName(name); is(rectlist.length, 0, name + 'empty rectlist should have zero rects'); @@ -90,6 +106,9 @@ function runATest(obj) { //convert RectList to a real array obj.rectList=Array.prototype.slice.call(obj.rectList, 0); } + if (obj.mustSortBeforeComparing) { + rectlist = sortRectList(rectlist); + } obj.rectList.forEach(function(r,i) { is(_getRect(rectlist[i]),_getRect(r), annotateName(testname+": item at "+i)); @@ -109,11 +128,16 @@ function doTest(){ thirdDiv = root.childNodes[5]; var firstPRect = firstP.getBoundingClientRect(), spanInFirstPRect = spanInFirstP.getBoundingClientRect(), + textInFirstPRect = getTextBoundingClientRect(firstP.firstChild), + textInSpanInFirstPRect = getTextBoundingClientRect(spanInFirstP.firstChild), firstDivRect = firstDiv.getBoundingClientRect(), + textInFirstDivRect = getTextBoundingClientRect(firstDiv.firstChild), spanInFirstDivRect = spanInFirstDiv.getBoundingClientRect(), + textInSpanInFirstDivRect = getTextBoundingClientRect(spanInFirstDiv.firstChild), secondPRect = secondP.getBoundingClientRect(), secondDivRect = secondDiv.getBoundingClientRect(), spanInSecondPRect = spanInSecondP.getBoundingClientRect(), + textInSpanInSecondPRect = getTextBoundingClientRect(spanInSecondP.firstChild), spanInSecondDivRect = spanInSecondDiv.getBoundingClientRect(), spanInSecondDivRectList = spanInSecondDiv.getClientRects(); var widthPerchar = spanInSecondPRect.width / spanInSecondP.firstChild.length; @@ -132,12 +156,14 @@ function doTest(){ {name:'collapsedAtEndOfTextNode', range:[firstP.firstChild, 6], rect:[spanInFirstPRect.left, spanInFirstPRect.left, spanInFirstPRect.top, spanInFirstPRect.bottom, 0, spanInFirstPRect.height]}, - {name:'singleBlockNode', range:[root, 1, root, 2], rect:firstPRect}, + {name:'singleBlockNode', range:[root, 1, root, 2], rect:firstPRect, + rectList:[firstPRect, textInFirstPRect, spanInFirstPRect]}, {name:'twoBlockNodes', range:[root, 1, root, 3], rect:[firstPRect.left, firstPRect.right, firstPRect.top, firstDivRect.bottom, firstPRect.width, firstDivRect.bottom - firstPRect.top], - rectList:[firstPRect, firstDivRect]}, + rectList:[firstPRect, textInFirstPRect, textInSpanInFirstPRect, + firstDivRect, textInFirstDivRect, textInSpanInFirstDivRect]}, {name:'endOfTextNodeToEndOfAnotherTextNodeInAnotherBlock', range:[spanInFirstP.firstChild, 1, firstDiv.firstChild, 5], rect:[spanInFirstDivRect.left - 5*widthPerchar, spanInFirstDivRect.left, @@ -163,7 +189,7 @@ function doTest(){ rectList:[[spanInSecondPRect.left - 3*widthPerchar, spanInSecondPRect.left, spanInSecondPRect.top, spanInSecondPRect.bottom, 3 * widthPerchar, spanInSecondPRect.height], - spanInSecondPRect, + spanInSecondPRect, textInSpanInSecondPRect, [spanInSecondPRect.right, spanInSecondPRect.right + widthPerchar, spanInSecondPRect.top, spanInSecondPRect.bottom, widthPerchar, spanInSecondPRect.height]]} @@ -228,10 +254,17 @@ function doTest(){ } function testMixedDir(){ var root = document.getElementById('mixeddir'); + var bdo = document.getElementById('bdo'); var firstSpan = root.firstElementChild, firstSpanRect=firstSpan.getBoundingClientRect(), - firstSpanRectList = firstSpan.getClientRects(); + firstSpanWithInnerTextRectList = Array.from(firstSpan.getClientRects()); + firstSpanWithInnerTextRectList.push(...bdo.getClientRects()); + + // Depending on the font rendering, the order of the rects composing the bdo + // element may vary. We need to sort the list of rects before comparing it to + // the expected list. + firstSpanWithInnerTextRectList = sortRectList(firstSpanWithInnerTextRectList); runATest({name:'mixeddir',range:[firstSpan.firstChild,0,firstSpan.lastChild,firstSpan.lastChild.length], - rect: firstSpanRect, rectList:firstSpanRectList}); + rect: firstSpanRect, rectList:firstSpanWithInnerTextRectList, mustSortBeforeComparing: true}); root = document.getElementById('mixeddir2'); firstSpan = root.firstElementChild; @@ -271,7 +304,10 @@ function testShadowDOM() { isnot(rect.height, 0, "Div element inside shadow shouldn't have zero size."); } -function test(){ +async function test(){ + // We use getBoxQuads to get some text nodes bounding rects. + await SpecialPowers.pushPrefEnv({"set": [["layout.css.getBoxQuads.enabled", true]]}); + //test ltr doTest(); diff --git a/dom/base/test/unit/test_xhr_standalone.js b/dom/base/test/unit/test_xhr_standalone.js index 94f2d7d642..100027f38a 100644 --- a/dom/base/test/unit/test_xhr_standalone.js +++ b/dom/base/test/unit/test_xhr_standalone.js @@ -6,6 +6,10 @@ // in non-window non-Worker context function run_test() { + Services.prefs.setBoolPref( + "network.fetch.systemDefaultsToOmittingCredentials", + false + ); var xhr = new XMLHttpRequest(); xhr.open("GET", "data:,", false); var exceptionThrown = false; @@ -13,6 +17,7 @@ function run_test() { xhr.responseType = ""; xhr.withCredentials = false; } catch (e) { + console.error(e); exceptionThrown = true; } Assert.equal(false, exceptionThrown); -- cgit v1.2.3