summaryrefslogtreecommitdiffstats
path: root/dom/base/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /dom/base/test
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test')
-rw-r--r--dom/base/test/browser.toml10
-rw-r--r--dom/base/test/browser_object_attachment.js168
-rw-r--r--dom/base/test/chrome.toml3
-rw-r--r--dom/base/test/chrome/bug418986-1.js3
-rw-r--r--dom/base/test/chrome/chrome.toml4
-rw-r--r--dom/base/test/chrome/file_bug549682.xhtml10
-rw-r--r--dom/base/test/chrome/file_bug616841.xhtml2
-rw-r--r--dom/base/test/chrome/test_bug1339722.html4
-rw-r--r--dom/base/test/chrome/test_bug339494.xhtml2
-rw-r--r--dom/base/test/chrome/test_bug429785.xhtml2
-rw-r--r--dom/base/test/chrome/test_bug430050.xhtml2
-rw-r--r--dom/base/test/chrome/test_chromeOuterWindowID.xhtml2
-rw-r--r--dom/base/test/chrome/test_swapFrameLoaders.xhtml25
-rw-r--r--dom/base/test/chrome/title_window.xhtml4
-rw-r--r--dom/base/test/chrome/window_nsITextInputProcessor.xhtml4
-rw-r--r--dom/base/test/chrome/window_swapFrameLoaders.xhtml223
-rw-r--r--dom/base/test/common_postMessages.js2
-rw-r--r--dom/base/test/file_bug1008126_worker.js2
-rw-r--r--dom/base/test/file_bug945152_worker.js1
-rw-r--r--dom/base/test/file_focus_shadow_dom.html24
-rw-r--r--dom/base/test/file_img_attachment.jpgbin0 -> 2711 bytes
-rw-r--r--dom/base/test/file_img_attachment.jpg^headers^1
-rw-r--r--dom/base/test/file_img_object_attachment.html6
-rw-r--r--dom/base/test/file_pdf_attachment.pdfbin0 -> 1568 bytes
-rw-r--r--dom/base/test/file_pdf_attachment.pdf^headers^2
-rw-r--r--dom/base/test/file_pdf_object_attachment.html6
-rw-r--r--dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml2
-rw-r--r--dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js2
-rw-r--r--dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js2
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-api.html22
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html2
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-bug-1798219.html2
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-denied.html2
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html2
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-esc-exit.html4
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-shadowdom.html2
-rw-r--r--dom/base/test/fullscreen/file_fullscreen-svg-element.html2
-rw-r--r--dom/base/test/fullscreen/fullscreen.xhtml2
-rw-r--r--dom/base/test/fullscreen/fullscreen_helpers.js4
-rw-r--r--dom/base/test/fullscreen/test_fullscreen-api.html2
-rw-r--r--dom/base/test/fullscreen/test_fullscreen_modal.html11
-rw-r--r--dom/base/test/gtest/TestMimeType.cpp142
-rw-r--r--dom/base/test/meta_viewport/viewport_helpers.js1
-rw-r--r--dom/base/test/mochitest.toml5
-rw-r--r--dom/base/test/test_domrequest.html233
-rw-r--r--dom/base/test/test_domrequesthelper.xhtml549
-rw-r--r--dom/base/test/test_focus_radio.html90
-rw-r--r--dom/base/test/unit/test_error_codes.js2
-rw-r--r--dom/base/test/useractivation/file_clipboard_common.js8
-rw-r--r--dom/base/test/useractivation/test_popup_blocker_async_callback.html2
-rw-r--r--dom/base/test/useractivation/test_useractivation_scrollbar.html2
51 files changed, 439 insertions, 1170 deletions
diff --git a/dom/base/test/browser.toml b/dom/base/test/browser.toml
index 1deeb88d89..a68bd2e873 100644
--- a/dom/base/test/browser.toml
+++ b/dom/base/test/browser.toml
@@ -109,6 +109,16 @@ skip-if = [
]
support-files = ["browser_multiple_popups.html"]
+["browser_object_attachment.js"]
+support-files = [
+ "file_img_object_attachment.html",
+ "file_img_attachment.jpg",
+ "file_img_attachment.jpg^headers^",
+ "file_pdf_object_attachment.html",
+ "file_pdf_attachment.pdf",
+ "file_pdf_attachment.pdf^headers^",
+]
+
["browser_outline_refocus.js"]
["browser_page_load_event_telemetry.js"]
diff --git a/dom/base/test/browser_object_attachment.js b/dom/base/test/browser_object_attachment.js
new file mode 100644
index 0000000000..b4432862f0
--- /dev/null
+++ b/dom/base/test/browser_object_attachment.js
@@ -0,0 +1,168 @@
+ChromeUtils.defineESModuleGetters(this, {
+ Downloads: "resource://gre/modules/Downloads.sys.mjs",
+});
+
+const httpsTestRoot = getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.com"
+);
+
+add_task(async function test_pdf_object_attachment() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.navigation.object_embed.allow_retargeting", false]],
+ });
+
+ await BrowserTestUtils.withNewTab(
+ `${httpsTestRoot}/file_pdf_object_attachment.html`,
+ async browser => {
+ is(
+ browser.browsingContext.children.length,
+ 1,
+ "Should have a child frame"
+ );
+ await SpecialPowers.spawn(browser, [], async () => {
+ let obj = content.document.querySelector("object");
+ is(
+ obj.displayedType,
+ Ci.nsIObjectLoadingContent.TYPE_DOCUMENT,
+ "should be displaying TYPE_DOCUMENT"
+ );
+ });
+ }
+ );
+});
+
+add_task(async function test_img_object_attachment() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.navigation.object_embed.allow_retargeting", false]],
+ });
+
+ await BrowserTestUtils.withNewTab(
+ `${httpsTestRoot}/file_img_object_attachment.html`,
+ async browser => {
+ is(
+ browser.browsingContext.children.length,
+ 1,
+ "Should have a child frame"
+ );
+ await SpecialPowers.spawn(browser, [], async () => {
+ let obj = content.document.querySelector("object");
+ is(
+ obj.displayedType,
+ Ci.nsIObjectLoadingContent.TYPE_DOCUMENT,
+ "should be displaying TYPE_DOCUMENT"
+ );
+ });
+ }
+ );
+});
+
+async function waitForDownload() {
+ // Get the downloads list and add a view to listen for a download to be added.
+ let downloadList = await Downloads.getList(Downloads.ALL);
+
+ // Wait for a single download
+ let downloadView;
+ let finishedAllDownloads = new Promise(resolve => {
+ downloadView = {
+ onDownloadAdded(aDownload) {
+ info("download added");
+ resolve(aDownload);
+ },
+ };
+ });
+ await downloadList.addView(downloadView);
+ let download = await finishedAllDownloads;
+ await downloadList.removeView(downloadView);
+
+ // Clean up the download from the list.
+ await downloadList.remove(download);
+ await download.finalize(true);
+
+ // Return the download
+ return download;
+}
+
+add_task(async function test_pdf_object_attachment_download() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.navigation.object_embed.allow_retargeting", true]],
+ });
+
+ // Set the behaviour to save pdfs to disk and not handle internally, so we
+ // don't end up with extra tabs after the test.
+ var gMimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
+ var gHandlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"].getService(
+ Ci.nsIHandlerService
+ );
+ const mimeInfo = gMimeSvc.getFromTypeAndExtension("application/pdf", "pdf");
+ let previousAction = mimeInfo.preferredAction;
+ mimeInfo.preferredAction = Ci.nsIHandlerInfo.saveToDisk;
+ gHandlerSvc.store(mimeInfo);
+ registerCleanupFunction(() => {
+ mimeInfo.preferredAction = previousAction;
+ gHandlerSvc.store(mimeInfo);
+ });
+
+ // Start listening for the download before opening the new tab.
+ let downloadPromise = waitForDownload();
+ await BrowserTestUtils.withNewTab(
+ `${httpsTestRoot}/file_pdf_object_attachment.html`,
+ async browser => {
+ let download = await downloadPromise;
+ is(
+ download.source.url,
+ `${httpsTestRoot}/file_pdf_attachment.pdf`,
+ "download should be the pdf"
+ );
+
+ await SpecialPowers.spawn(browser, [], async () => {
+ let obj = content.document.querySelector("object");
+ is(
+ obj.displayedType,
+ Ci.nsIObjectLoadingContent.TYPE_FALLBACK,
+ "should be displaying TYPE_FALLBACK"
+ );
+ });
+ }
+ );
+});
+
+add_task(async function test_img_object_attachment_download() {
+ // NOTE: This is testing our current behaviour here as of bug 1868001 (which
+ // is to download an image with `Content-Disposition: attachment` embedded
+ // within an object or embed element).
+ //
+ // Other browsers ignore the `Content-Disposition: attachment` header when
+ // loading images within object or embed element as-of december 2023, as
+ // we did prior to the changes in bug 1595491.
+ //
+ // If this turns out to be a web-compat issue, we may want to introduce
+ // special handling to ignore content-disposition when loading images within
+ // an object or embed element.
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.navigation.object_embed.allow_retargeting", true]],
+ });
+
+ // Start listening for the download before opening the new tab.
+ let downloadPromise = waitForDownload();
+ await BrowserTestUtils.withNewTab(
+ `${httpsTestRoot}/file_img_object_attachment.html`,
+ async browser => {
+ let download = await downloadPromise;
+ is(
+ download.source.url,
+ `${httpsTestRoot}/file_img_attachment.jpg`,
+ "download should be the jpg"
+ );
+
+ await SpecialPowers.spawn(browser, [], async () => {
+ let obj = content.document.querySelector("object");
+ is(
+ obj.displayedType,
+ Ci.nsIObjectLoadingContent.TYPE_FALLBACK,
+ "should be displaying TYPE_FALLBACK"
+ );
+ });
+ }
+ );
+});
diff --git a/dom/base/test/chrome.toml b/dom/base/test/chrome.toml
index 687d778cac..ec736a086c 100644
--- a/dom/base/test/chrome.toml
+++ b/dom/base/test/chrome.toml
@@ -1,6 +1,5 @@
[DEFAULT]
skip-if = ["os == 'android'"]
-prefs = ["dom.domrequest.enabled=true"]
support-files = [
"file_empty.html",
"file_blocking_image.html",
@@ -38,8 +37,6 @@ support-files = [
["test_bug1120222.html"]
-["test_domrequesthelper.xhtml"]
-
["test_fragment_sanitization.xhtml"]
["test_getLastOverWindowPointerLocationInCSSPixels.html"]
diff --git a/dom/base/test/chrome/bug418986-1.js b/dom/base/test/chrome/bug418986-1.js
index 7c39df0c13..e7e3c63b5c 100644
--- a/dom/base/test/chrome/bug418986-1.js
+++ b/dom/base/test/chrome/bug418986-1.js
@@ -1,4 +1,7 @@
/* globals chromeWindow */
+
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
// The main test function.
var test = function (isContent) {
SimpleTest.waitForExplicitFinish();
diff --git a/dom/base/test/chrome/chrome.toml b/dom/base/test/chrome/chrome.toml
index b8439a2d2e..08265bcb97 100644
--- a/dom/base/test/chrome/chrome.toml
+++ b/dom/base/test/chrome/chrome.toml
@@ -18,7 +18,6 @@ support-files = [
"custom_element_ep.js",
"window_nsITextInputProcessor.xhtml",
"title_window.xhtml",
- "window_swapFrameLoaders.xhtml",
]
prefs = ["gfx.font_rendering.fallback.async=false"]
@@ -126,9 +125,6 @@ support-files = ["../dummy.html"]
["test_range_getClientRectsAndTexts.html"]
-["test_swapFrameLoaders.xhtml"]
-skip-if = ["os == 'mac'"] # bug 1674413
-
["test_title.xhtml"]
support-files = ["file_title.xhtml"]
diff --git a/dom/base/test/chrome/file_bug549682.xhtml b/dom/base/test/chrome/file_bug549682.xhtml
index 8ae05d38d8..0bb3080507 100644
--- a/dom/base/test/chrome/file_bug549682.xhtml
+++ b/dom/base/test/chrome/file_bug549682.xhtml
@@ -28,11 +28,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
}
var asyncPPML = false;
- function ppmASL(m) {
+ function ppmASL() {
asyncPPML = true;
}
var syncPPML = false;
- function ppmSL(m) {
+ function ppmSL() {
syncPPML = true;
}
ppm.addMessageListener("processmessageAsync", ppmASL);
@@ -42,7 +42,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
cpm.sendSyncMessage("processmessageSync", "");
var asyncCPML = false;
- function cpmASL(m) {
+ function cpmASL() {
asyncCPML = true;
}
cpm.addMessageListener("childprocessmessage", cpmASL);
@@ -93,7 +93,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
var weakListener = {
QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]),
- receiveMessage(msg) {
+ receiveMessage() {
if (weakMessageReceived) {
ok(false, 'Weak listener fired twice.');
return;
@@ -109,7 +109,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
var weakListener2 = {
QueryInterface: ChromeUtils.generateQI(["nsISupportsWeakReference"]),
- receiveMessage(msg) {
+ receiveMessage() {
ok(false, 'Should not have received a message.');
}
};
diff --git a/dom/base/test/chrome/file_bug616841.xhtml b/dom/base/test/chrome/file_bug616841.xhtml
index b0512d162c..3651a00226 100644
--- a/dom/base/test/chrome/file_bug616841.xhtml
+++ b/dom/base/test/chrome/file_bug616841.xhtml
@@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616841
[ "D", "\u010C" ] ];
var nCmps = 0;
- function recvContentReady(m) {
+ function recvContentReady() {
for (var i = 0; i < toCompare.length; ++i) {
var pair = toCompare[i];
messageManager.broadcastAsyncMessage("cmp",
diff --git a/dom/base/test/chrome/test_bug1339722.html b/dom/base/test/chrome/test_bug1339722.html
index d8d95f1faa..7655ff95fa 100644
--- a/dom/base/test/chrome/test_bug1339722.html
+++ b/dom/base/test/chrome/test_bug1339722.html
@@ -29,7 +29,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1339722
// behave similarly.
const TOPIC = "document-on-modify-request";
let win;
- const observe = (subject, topic, data) => {
+ const observe = (subject, topic) => {
info("Got " + topic);
Services.obs.removeObserver(observe, TOPIC);
@@ -58,7 +58,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1339722
// Remove the iframe to cause frameloader destroy.
iframe.remove();
- setTimeout($ => {
+ setTimeout(() => {
ok(!document.getElementById("testFrame"), "verify iframe removed");
SimpleTest.finish();
}, 0);
diff --git a/dom/base/test/chrome/test_bug339494.xhtml b/dom/base/test/chrome/test_bug339494.xhtml
index 203f6e644d..afab41b65c 100644
--- a/dom/base/test/chrome/test_bug339494.xhtml
+++ b/dom/base/test/chrome/test_bug339494.xhtml
@@ -55,7 +55,7 @@ SimpleTest.waitForExplicitFinish();
s.setAttribute("ggg", "testvalue");
await promiseFlushingMutationObserver();
- const observer = new MutationObserver((aMutationList, aObserver) => {
+ const observer = new MutationObserver(() => {
ok(s.hasAttribute("ggg"), "Value check 3. There should be a value");
isnot(s.getAttribute("ggg"), "testvalue", "Value check 4");
is(s.getAttribute("ggg"), "othervalue", "Value check 5");
diff --git a/dom/base/test/chrome/test_bug429785.xhtml b/dom/base/test/chrome/test_bug429785.xhtml
index fb51634fab..10c9977ccb 100644
--- a/dom/base/test/chrome/test_bug429785.xhtml
+++ b/dom/base/test/chrome/test_bug429785.xhtml
@@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429785
var errorLogged = false;
var listener = {
QueryInterface: ChromeUtils.generateQI(["nsIConsoleListener"]),
- observe(msg) { errorLogged = true; }
+ observe() { errorLogged = true; }
};
function step2() {
diff --git a/dom/base/test/chrome/test_bug430050.xhtml b/dom/base/test/chrome/test_bug430050.xhtml
index d7d6cf656c..dfe1e3c8ee 100644
--- a/dom/base/test/chrome/test_bug430050.xhtml
+++ b/dom/base/test/chrome/test_bug430050.xhtml
@@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=430050
}
function startTest() {
- const observer = new MutationObserver((aMutationList, aObserver) => {
+ const observer = new MutationObserver(() => {
document.getElementById('b').setAttribute("src",
"data:text/plain,failed");
const systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
diff --git a/dom/base/test/chrome/test_chromeOuterWindowID.xhtml b/dom/base/test/chrome/test_chromeOuterWindowID.xhtml
index 1feb7c7c74..3aa482b636 100644
--- a/dom/base/test/chrome/test_chromeOuterWindowID.xhtml
+++ b/dom/base/test/chrome/test_chromeOuterWindowID.xhtml
@@ -42,7 +42,7 @@ windows.
"Both browsers should belong to the same document.");
let winID = getOuterWindowID(browser1.ownerGlobal);
- let getChildRootOuterId = browser => {
+ let getChildRootOuterId = () => {
try {
return docShell.browserChild?.chromeOuterWindowID;
} catch(ex) { }
diff --git a/dom/base/test/chrome/test_swapFrameLoaders.xhtml b/dom/base/test/chrome/test_swapFrameLoaders.xhtml
deleted file mode 100644
index 4ea11a1a62..0000000000
--- a/dom/base/test/chrome/test_swapFrameLoaders.xhtml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1242644
-Test swapFrameLoaders with different frame types and remoteness
--->
-<window title="Mozilla Bug 1242644"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
- <!-- test results are displayed in the html:body -->
- <body xmlns="http://www.w3.org/1999/xhtml">
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1242644"
- target="_blank">Mozilla Bug 1242644</a>
- </body>
-
- <!-- test code goes here -->
- <script type="application/javascript"><![CDATA[
- SimpleTest.waitForExplicitFinish();
-
- window.openDialog("window_swapFrameLoaders.xhtml", "bug1242644",
- "chrome,width=600,height=600,noopener", window);
- ]]></script>
-</window>
diff --git a/dom/base/test/chrome/title_window.xhtml b/dom/base/test/chrome/title_window.xhtml
index f48cdaaaf1..5f9840c36c 100644
--- a/dom/base/test/chrome/title_window.xhtml
+++ b/dom/base/test/chrome/title_window.xhtml
@@ -63,10 +63,10 @@
}
}
- function listener2(ev) {
+ function listener2() {
inProgressDoc[description] = false;
}
- function listener3(ev) {
+ function listener3() {
inProgressWin[description] = false;
}
frame.addEventListener("DOMTitleChanged", listener);
diff --git a/dom/base/test/chrome/window_nsITextInputProcessor.xhtml b/dom/base/test/chrome/window_nsITextInputProcessor.xhtml
index c8ce6ee5e7..c62ba2ce47 100644
--- a/dom/base/test/chrome/window_nsITextInputProcessor.xhtml
+++ b/dom/base/test/chrome/window_nsITextInputProcessor.xhtml
@@ -4120,7 +4120,7 @@ function runUnloadTests1()
let oldSrc = iframe.src;
let parentWindow = window;
- iframe.addEventListener("load", function (aEvent) {
+ iframe.addEventListener("load", function () {
ok(true, description + "dummy page is loaded");
childWindow = iframe.contentWindow;
textareaInFrame = null;
@@ -4181,7 +4181,7 @@ function runUnloadTests2()
let oldSrc = iframe.src;
- iframe.addEventListener("load", function (aEvent) {
+ iframe.addEventListener("load", function () {
ok(true, description + "dummy page is loaded");
childWindow = iframe.contentWindow;
textareaInFrame = null;
diff --git a/dom/base/test/chrome/window_swapFrameLoaders.xhtml b/dom/base/test/chrome/window_swapFrameLoaders.xhtml
deleted file mode 100644
index 4a38bcc1fc..0000000000
--- a/dom/base/test/chrome/window_swapFrameLoaders.xhtml
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1242644
-Test swapFrameLoaders with different frame types and remoteness
--->
-<window title="Mozilla Bug 1242644"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <script type="application/javascript"><![CDATA[
- ["SimpleTest", "SpecialPowers", "info", "is", "ok", "add_task"].forEach(key => {
- window[key] = window.arguments[0][key];
- })
-
- const NS = {
- xul: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
- html: "http://www.w3.org/1999/xhtml",
- }
-
- const TAG = {
- xul: "browser",
- html: "iframe", // mozbrowser
- }
-
- const SCENARIOS = [
- ["xul", "xul"],
- ["xul", "html"],
- ["html", "xul"],
- ["html", "html"],
- ["xul", "xul", { remote: true }],
- ["xul", "html", { remote: true }],
- ["html", "xul", { remote: true }],
- ["html", "html", { remote: true }],
- ["xul", "html", { userContextId: 2 }],
- ["xul", "html", { userContextId: 2, remote: true }],
- ];
-
- const HEIGHTS = [
- 200,
- 400
- ];
-
- function frameScript() {
- /* eslint-env mozilla/frame-script */
- addEventListener("load", function onLoad() {
- sendAsyncMessage("test:load");
- }, true);
- }
-
- // Watch for loads in new frames
- window.messageManager.loadFrameScript(`data:,(${frameScript})();`, true);
-
- function once(target, eventName, useCapture = false) {
- info("Waiting for event: '" + eventName + "' on " + target + ".");
-
- return new Promise(resolve => {
- for (let [add, remove] of [
- ["addEventListener", "removeEventListener"],
- ["addMessageListener", "removeMessageListener"],
- ]) {
- if ((add in target) && (remove in target)) {
- target[add](eventName, function onEvent(...aArgs) {
- info("Got event: '" + eventName + "' on " + target + ".");
- target[remove](eventName, onEvent, useCapture);
- resolve(aArgs);
- }, useCapture);
- break;
- }
- }
- });
- }
-
- async function addFrame(type, options, height) {
- let remote = options && options.remote;
- let userContextId = options && options.userContextId;
- let frame = document.createElementNS(NS[type], TAG[type]);
- frame.setAttribute("remote", remote);
- if (remote && type == "xul") {
- frame.setAttribute("style", "-moz-binding: none;");
- }
- if (userContextId) {
- frame.setAttribute("usercontextid", userContextId);
- }
- if (type == "html") {
- frame.setAttribute("mozbrowser", "true");
- frame.setAttribute("noisolation", "true");
- frame.setAttribute("allowfullscreen", "true");
- } else if (type == "xul") {
- frame.setAttribute("type", "content");
- }
- let src = `data:text/html,<!doctype html>` +
- `<body style="height:${height}px"/>`;
- frame.setAttribute("src", src);
- document.documentElement.appendChild(frame);
- let mm = frame.frameLoader.messageManager;
- await once(mm, "test:load");
- return frame;
- }
-
- add_task(async function() {
- for (let scenario of SCENARIOS) {
- let [ typeA, typeB, options ] = scenario;
- let heightA = HEIGHTS[0];
- info(`Adding frame A, type ${typeA}, options ${JSON.stringify(options)}, height ${heightA}`);
- let frameA = await addFrame(typeA, options, heightA);
-
- let heightB = HEIGHTS[1];
- info(`Adding frame B, type ${typeB}, options ${JSON.stringify(options)}, height ${heightB}`);
- let frameB = await addFrame(typeB, options, heightB);
-
- let frameScriptFactory = function(name) {
- /* eslint-env mozilla/frame-script */
- return `function() {
- addMessageListener("ping", function() {
- sendAsyncMessage("pong", "${name}");
- });
- addMessageListener("check-browser-api", function() {
- let exists = "api" in this;
- sendAsyncMessage("check-browser-api", {
- exists,
- running: exists && !this.api._shuttingDown,
- });
- });
- addEventListener("pagehide", function({ inFrameSwap }) {
- sendAsyncMessage("pagehide", inFrameSwap);
- }, {mozSystemGroup: true});
- }`;
- }
-
- // Load frame script into each frame
- {
- let mmA = frameA.frameLoader.messageManager;
- let mmB = frameB.frameLoader.messageManager;
-
- mmA.loadFrameScript("data:,(" + frameScriptFactory("A") + ")()", false);
- mmB.loadFrameScript("data:,(" + frameScriptFactory("B") + ")()", false);
- }
-
- // Ping before swap
- {
- let mmA = frameA.frameLoader.messageManager;
- let mmB = frameB.frameLoader.messageManager;
-
- let inflightA = once(mmA, "pong");
- let inflightB = once(mmB, "pong");
-
- info("Ping message manager for frame A");
- mmA.sendAsyncMessage("ping");
- let [ { data: pongA } ] = await inflightA;
- is(pongA, "A", "Frame A message manager gets reply A before swap");
-
- info("Ping message manager for frame B");
- mmB.sendAsyncMessage("ping");
- let [ { data: pongB } ] = await inflightB;
- is(pongB, "B", "Frame B message manager gets reply B before swap");
- }
-
- // Ping after swap using message managers acquired before
- {
- let mmA = frameA.frameLoader.messageManager;
- let mmB = frameB.frameLoader.messageManager;
-
- let pagehideA = once(mmA, "pagehide");
- let pagehideB = once(mmB, "pagehide");
-
- info("swapFrameLoaders");
- frameA.swapFrameLoaders(frameB);
-
- let [ { data: inFrameSwapA } ] = await pagehideA;
- ok(inFrameSwapA, "Frame A got pagehide with inFrameSwap: true");
- let [ { data: inFrameSwapB } ] = await pagehideB;
- ok(inFrameSwapB, "Frame B got pagehide with inFrameSwap: true");
-
- let inflightA = once(mmA, "pong");
- let inflightB = once(mmB, "pong");
-
- info("Ping message manager for frame A");
- mmA.sendAsyncMessage("ping");
- let [ { data: pongA } ] = await inflightA;
- is(pongA, "B", "Frame A message manager acquired before swap gets reply B after swap");
-
- info("Ping message manager for frame B");
- mmB.sendAsyncMessage("ping");
- let [ { data: pongB } ] = await inflightB;
- is(pongB, "A", "Frame B message manager acquired before swap gets reply A after swap");
- }
-
- // Check height after swap
- if (frameA.getContentDimensions) {
- let { height } = await frameA.getContentDimensions();
- is(height, heightB, "Frame A's content height is 400px after swap");
- }
- if (frameB.getContentDimensions) {
- let { height } = await frameB.getContentDimensions();
- is(height, heightA, "Frame B's content height is 200px after swap");
- }
-
- // Ping after swap using message managers acquired after
- {
- let mmA = frameA.frameLoader.messageManager;
- let mmB = frameB.frameLoader.messageManager;
-
- let inflightA = once(mmA, "pong");
- let inflightB = once(mmB, "pong");
-
- info("Ping message manager for frame A");
- mmA.sendAsyncMessage("ping");
- let [ { data: pongA } ] = await inflightA;
- is(pongA, "B", "Frame A message manager acquired after swap gets reply B after swap");
-
- info("Ping message manager for frame B");
- mmB.sendAsyncMessage("ping");
- let [ { data: pongB } ] = await inflightB;
- is(pongB, "A", "Frame B message manager acquired after swap gets reply A after swap");
- }
-
- frameA.remove();
- frameB.remove();
- }
- });
- ]]></script>
-</window>
diff --git a/dom/base/test/common_postMessages.js b/dom/base/test/common_postMessages.js
index c4836fdd77..044f3e7f34 100644
--- a/dom/base/test/common_postMessages.js
+++ b/dom/base/test/common_postMessages.js
@@ -1,3 +1,5 @@
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
function getType(a) {
if (a === null || a === undefined) {
return "null";
diff --git a/dom/base/test/file_bug1008126_worker.js b/dom/base/test/file_bug1008126_worker.js
index aaba278de5..4e418d777e 100644
--- a/dom/base/test/file_bug1008126_worker.js
+++ b/dom/base/test/file_bug1008126_worker.js
@@ -3,6 +3,8 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
+
var gEntry1 = "data_1.txt";
var gEntry2 = "data_2.txt";
var gEntry3 = "data_big.txt";
diff --git a/dom/base/test/file_bug945152_worker.js b/dom/base/test/file_bug945152_worker.js
index 9664045b6d..c0feebf0d6 100644
--- a/dom/base/test/file_bug945152_worker.js
+++ b/dom/base/test/file_bug945152_worker.js
@@ -1,3 +1,4 @@
+/* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
var gData1 = "TEST_DATA_1:ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var gData2 = "TEST_DATA_2:1234567890";
var gPaddingChar = ".";
diff --git a/dom/base/test/file_focus_shadow_dom.html b/dom/base/test/file_focus_shadow_dom.html
index 6fa9d1b88e..7a0a0da729 100644
--- a/dom/base/test/file_focus_shadow_dom.html
+++ b/dom/base/test/file_focus_shadow_dom.html
@@ -79,10 +79,16 @@
opener.is(lastFocusTarget, shadowDate, "Should have focused date element in shadow DOM. (3)");
synthesizeKey("KEY_Tab");
opener.is(lastFocusTarget, shadowDate, "Should have focused date element with a calendar button in shadow DOM. (3)");
- synthesizeKey("KEY_Tab");
- opener.is(shadowIframe.contentDocument.activeElement,
- shadowIframe.contentDocument.documentElement,
- "Should have focused document element in shadow iframe. (3)");
+
+ let canTabMoveFocusToRootElement =
+ !SpecialPowers.getBoolPref("dom.disable_tab_focus_to_root_element");
+ if (canTabMoveFocusToRootElement) {
+ synthesizeKey("KEY_Tab");
+ opener.is(shadowIframe.contentDocument.activeElement,
+ shadowIframe.contentDocument.documentElement,
+ "Should have focused document element in shadow iframe. (3)");
+ }
+
synthesizeKey("KEY_Tab");
opener.is(shadowIframe.contentDocument.activeElement,
shadowIframe.contentDocument.body.firstChild,
@@ -99,10 +105,12 @@
opener.is(shadowIframe.contentDocument.activeElement,
shadowIframe.contentDocument.body.firstChild,
"Should have focused input element in shadow iframe. (4)");
- synthesizeKey("KEY_Tab", {shiftKey: true});
- opener.is(shadowIframe.contentDocument.activeElement,
- shadowIframe.contentDocument.documentElement,
- "Should have focused document element in shadow iframe. (4)");
+ if (canTabMoveFocusToRootElement) {
+ synthesizeKey("KEY_Tab", {shiftKey: true});
+ opener.is(shadowIframe.contentDocument.activeElement,
+ shadowIframe.contentDocument.documentElement,
+ "Should have focused document element in shadow iframe. (4)");
+ }
synthesizeKey("KEY_Tab", {shiftKey: true});
opener.is(lastFocusTarget, shadowDate, "Should have focused date element with a calendar button in shadow DOM. (4)");
synthesizeKey("KEY_Tab", {shiftKey: true});
diff --git a/dom/base/test/file_img_attachment.jpg b/dom/base/test/file_img_attachment.jpg
new file mode 100644
index 0000000000..dcd99b9670
--- /dev/null
+++ b/dom/base/test/file_img_attachment.jpg
Binary files differ
diff --git a/dom/base/test/file_img_attachment.jpg^headers^ b/dom/base/test/file_img_attachment.jpg^headers^
new file mode 100644
index 0000000000..71ed8e7805
--- /dev/null
+++ b/dom/base/test/file_img_attachment.jpg^headers^
@@ -0,0 +1 @@
+Content-Disposition: attachment
diff --git a/dom/base/test/file_img_object_attachment.html b/dom/base/test/file_img_object_attachment.html
new file mode 100644
index 0000000000..502894041e
--- /dev/null
+++ b/dom/base/test/file_img_object_attachment.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <object data="file_img_attachment.jpg" type="image/jpeg" width="100%" height="600">fallback</object>
+ </body>
+</html>
diff --git a/dom/base/test/file_pdf_attachment.pdf b/dom/base/test/file_pdf_attachment.pdf
new file mode 100644
index 0000000000..89066463f1
--- /dev/null
+++ b/dom/base/test/file_pdf_attachment.pdf
Binary files differ
diff --git a/dom/base/test/file_pdf_attachment.pdf^headers^ b/dom/base/test/file_pdf_attachment.pdf^headers^
new file mode 100644
index 0000000000..562009a8de
--- /dev/null
+++ b/dom/base/test/file_pdf_attachment.pdf^headers^
@@ -0,0 +1,2 @@
+Content-Type: application/octet-stream
+Content-Disposition: attachment
diff --git a/dom/base/test/file_pdf_object_attachment.html b/dom/base/test/file_pdf_object_attachment.html
new file mode 100644
index 0000000000..d87eff9923
--- /dev/null
+++ b/dom/base/test/file_pdf_object_attachment.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <object data="file_pdf_attachment.pdf" type="application/pdf" width="100%" height="600">fallback</object>
+ </body>
+</html>
diff --git a/dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml b/dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml
index 93f00311e7..bc92abf3e0 100644
--- a/dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml
+++ b/dom/base/test/fullscreen/MozDomFullscreen_chrome.xhtml
@@ -79,7 +79,7 @@ function thirdEntry(event) {
gOuterDoc.exitFullscreen();
}
-function earlyExit(event) {
+function earlyExit() {
ok(false, "MozDOMFullscreen:Exited should only be triggered after cancel all fullscreen");
}
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 2ea2b9ee40..49a48c3177 100644
--- a/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js
+++ b/dom/base/test/fullscreen/browser_fullscreen-navigation-history-race.js
@@ -82,7 +82,7 @@ function preventBFCache(aBrowsingContext, aPrevent) {
let target = content.document.getElementById("div");
target.addEventListener(
"mousedown",
- function (e) {
+ function () {
content.window.history.back();
},
{ once: true }
diff --git a/dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js b/dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js
index 10d10a0b0f..1338c4a550 100644
--- a/dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js
+++ b/dom/base/test/fullscreen/browser_fullscreen-tab-close-race.js
@@ -70,7 +70,7 @@ async function WaitRemoveDocumentAndCloseTab(aBrowser, aBrowsingContext) {
return new Promise(resolve => {
content.document.addEventListener(
"fullscreenchange",
- e => {
+ () => {
resolve();
},
{ once: true }
diff --git a/dom/base/test/fullscreen/file_fullscreen-api.html b/dom/base/test/fullscreen/file_fullscreen-api.html
index 645e6ece46..9661b10de9 100644
--- a/dom/base/test/fullscreen/file_fullscreen-api.html
+++ b/dom/base/test/fullscreen/file_fullscreen-api.html
@@ -112,7 +112,7 @@ function enter2(event) {
promise = document.exitFullscreen();
}
-function exit2(event) {
+function exit2() {
is(document.fullscreenElement, null,
"Full-screen element should have rolled back.");
is(iframe.contentDocument.fullscreenElement, null,
@@ -156,7 +156,7 @@ function exit3(event) {
promise = outOfDocElement.requestFullscreen();
}
-function error1(event) {
+function error1() {
ok(!document.fullscreenElement,
"Requests for full-screen from not-in-doc elements should fail.");
assertPromiseRejected(promise, "in error1");
@@ -181,7 +181,7 @@ function enter4(event) {
"Should not have a full-screen element again.");
}
-async function exit_to_arg_test_1(event) {
+async function exit_to_arg_test_1() {
ok(!document.fullscreenElement,
"Should have left full-screen mode (third time).");
addFullscreenChangeContinuation("enter", enter_from_arg_test_1);
@@ -196,14 +196,14 @@ async function exit_to_arg_test_1(event) {
ok(!threw, "requestFullscreen with bogus arg (123) shouldn't throw exception");
}
-function enter_from_arg_test_1(event) {
+function enter_from_arg_test_1() {
ok(document.fullscreenElement,
"Should have entered full-screen after calling with bogus (ignored) argument (fourth time)");
addFullscreenChangeContinuation("exit", exit_to_arg_test_2);
document.exitFullscreen();
}
-async function exit_to_arg_test_2(event) {
+async function exit_to_arg_test_2() {
ok(!document.fullscreenElement,
"Should have left full-screen mode (fourth time).");
addFullscreenChangeContinuation("enter", enter_from_arg_test_2);
@@ -218,14 +218,14 @@ async function exit_to_arg_test_2(event) {
ok(!threw, "requestFullscreen with { vrDisplay: null } shouldn't throw exception");
}
-function enter_from_arg_test_2(event) {
+function enter_from_arg_test_2() {
ok(document.fullscreenElement,
"Should have entered full-screen after calling with vrDisplay null argument (fifth time)");
addFullscreenChangeContinuation("exit", exit4);
document.exitFullscreen();
}
-function exit4(event) {
+function exit4() {
ok(!document.fullscreenElement,
"Should be back in non-full-screen mode (fifth time)");
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, function() {
@@ -234,7 +234,7 @@ function exit4(event) {
});
}
-function error2(event) {
+function error2() {
ok(!document.fullscreenElement,
"Should still be in normal mode, because calling context isn't trusted.");
button = document.createElement("button");
@@ -246,13 +246,13 @@ function error2(event) {
sendMouseClick(button);
}
-function enter5(event) {
+function enter5() {
ok(document.fullscreenElement, "Moved to full-screen after mouse click");
addFullscreenChangeContinuation("exit", exit5);
document.exitFullscreen();
}
-function exit5(event) {
+function exit5() {
ok(!document.fullscreenElement,
"Should have left full-screen mode (last time).");
SpecialPowers.pushPrefEnv({
@@ -264,7 +264,7 @@ function exit5(event) {
});
}
-function error3(event) {
+function error3() {
ok(!document.fullscreenElement,
"Should still be in normal mode, because pref is not enabled.");
diff --git a/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html b/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html
index 61db80c228..48f2dea09d 100644
--- a/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html
+++ b/dom/base/test/fullscreen/file_fullscreen-bug-1798219-2.html
@@ -2,7 +2,7 @@
<button>Launch</button>
<script>
let button = document.querySelector("button");
-button.addEventListener("click", function(e) {
+button.addEventListener("click", function() {
let newWindow = window.open("", "", "newWindow");
newWindow.document.write(`<!DOCTYPE HTML>
<button>click me!</button>
diff --git a/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html b/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html
index 7490f12936..beafd79661 100644
--- a/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html
+++ b/dom/base/test/fullscreen/file_fullscreen-bug-1798219.html
@@ -2,7 +2,7 @@
<button>click me!</button>
<script>
let button = document.querySelector("button");
-button.addEventListener("click", function(e) {
+button.addEventListener("click", function() {
document.documentElement.requestFullscreen();
setTimeout(() => {
while(true) {
diff --git a/dom/base/test/fullscreen/file_fullscreen-denied.html b/dom/base/test/fullscreen/file_fullscreen-denied.html
index db9a69e71a..fe4244ec7f 100644
--- a/dom/base/test/fullscreen/file_fullscreen-denied.html
+++ b/dom/base/test/fullscreen/file_fullscreen-denied.html
@@ -137,7 +137,7 @@ function requestFullscreenMouseBtn(event, button) {
synthesizeMouseAtCenter(clickEl, { button });
}
-async function testFullscreenMouseBtn(event, button, next) {
+async function testFullscreenMouseBtn() {
await SpecialPowers.pushPrefEnv({
"set": [["full-screen-api.mouse-event-allow-left-button-only", true]]
});
diff --git a/dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html b/dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html
index d7d8a90aaf..210b2af1b6 100644
--- a/dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html
+++ b/dom/base/test/fullscreen/file_fullscreen-esc-exit-inner.html
@@ -33,7 +33,7 @@ function is(a, b, msg) {
var escKeyReceived = false;
var escKeySent = false;
-function keyHandler(event) {
+function keyHandler() {
if (escKeyReceived == KeyboardEvent.DOM_VK_ESC) {
escKeyReceived = true;
}
diff --git a/dom/base/test/fullscreen/file_fullscreen-esc-exit.html b/dom/base/test/fullscreen/file_fullscreen-esc-exit.html
index f65f930b3f..1e2252f1ab 100644
--- a/dom/base/test/fullscreen/file_fullscreen-esc-exit.html
+++ b/dom/base/test/fullscreen/file_fullscreen-esc-exit.html
@@ -34,14 +34,14 @@ function finish() {
opener.nextTest();
}
-function fullscreenchange1(event) {
+function fullscreenchange1() {
is(document.fullscreenElement, document.body, "FSE should be doc");
addFullscreenChangeContinuation("exit", fullscreenchange2);
ok(!document.getElementById("subdoc").contentWindow.escKeySent, "Should not yet have sent ESC key press.");
document.getElementById("subdoc").contentWindow.startTest();
}
-function fullscreenchange2(event) {
+function fullscreenchange2() {
ok(document.getElementById("subdoc").contentWindow.escKeySent, "Should have sent ESC key press.");
ok(!document.getElementById("subdoc").contentWindow.escKeyReceived, "ESC key press to exit should not be delivered.");
ok(!document.fullscreenElement, "Should have left full-screen mode on ESC key press");
diff --git a/dom/base/test/fullscreen/file_fullscreen-shadowdom.html b/dom/base/test/fullscreen/file_fullscreen-shadowdom.html
index 348e08ae87..1972e1457e 100644
--- a/dom/base/test/fullscreen/file_fullscreen-shadowdom.html
+++ b/dom/base/test/fullscreen/file_fullscreen-shadowdom.html
@@ -29,7 +29,7 @@
var elem = shadowRoot.firstChild;
var gotFullscreenEvent = false;
- document.addEventListener("fullscreenchange", function (e) {
+ document.addEventListener("fullscreenchange", function () {
if (document.fullscreenElement === host) {
is(shadowRoot.fullscreenElement, elem,
"Expected element entered fullsceen");
diff --git a/dom/base/test/fullscreen/file_fullscreen-svg-element.html b/dom/base/test/fullscreen/file_fullscreen-svg-element.html
index 1dfc78aa1c..d03a13ee84 100644
--- a/dom/base/test/fullscreen/file_fullscreen-svg-element.html
+++ b/dom/base/test/fullscreen/file_fullscreen-svg-element.html
@@ -32,7 +32,7 @@
var elem = document.getElementById("svg-elem")
, elemWasLocked = false;
- document.addEventListener("fullscreenchange", function (e) {
+ document.addEventListener("fullscreenchange", function () {
if (document.fullscreenElement === elem) {
elemWasLocked = true;
document.exitFullscreen();
diff --git a/dom/base/test/fullscreen/fullscreen.xhtml b/dom/base/test/fullscreen/fullscreen.xhtml
index 2cc95642b6..76986db540 100644
--- a/dom/base/test/fullscreen/fullscreen.xhtml
+++ b/dom/base/test/fullscreen/fullscreen.xhtml
@@ -11,7 +11,7 @@
window.addEventListener("fullscreen", onFullScreen, true);
-function onFullScreen(event)
+function onFullScreen()
{
window.arguments[0].done(window.fullScreen);
}
diff --git a/dom/base/test/fullscreen/fullscreen_helpers.js b/dom/base/test/fullscreen/fullscreen_helpers.js
index 6e78015cd8..f097ae316e 100644
--- a/dom/base/test/fullscreen/fullscreen_helpers.js
+++ b/dom/base/test/fullscreen/fullscreen_helpers.js
@@ -83,7 +83,7 @@ function waitWidgetFullscreenEvent(
aIsInFullscreen,
aWaitUntil = false
) {
- return BrowserTestUtils.waitForEvent(aWindow, "fullscreen", false, aEvent => {
+ return BrowserTestUtils.waitForEvent(aWindow, "fullscreen", false, () => {
if (
aWaitUntil &&
aIsInFullscreen !=
@@ -106,7 +106,7 @@ function waitForFullScreenObserver(
aIsInFullscreen,
aWaitUntil = false
) {
- return TestUtils.topicObserved("fullscreen-painted", (subject, data) => {
+ return TestUtils.topicObserved("fullscreen-painted", () => {
if (
aWaitUntil &&
aIsInFullscreen !=
diff --git a/dom/base/test/fullscreen/test_fullscreen-api.html b/dom/base/test/fullscreen/test_fullscreen-api.html
index 2a59d6eeb0..ef07a5f97f 100644
--- a/dom/base/test/fullscreen/test_fullscreen-api.html
+++ b/dom/base/test/fullscreen/test_fullscreen-api.html
@@ -111,7 +111,7 @@ function runNextTest() {
// otherwise, the fullscreen request might be denied.
if (testWindow.document.hidden) {
info("Waiting for document to unhide");
- waitForEvent(testWindow.document, "visibilitychange", (event) => {
+ waitForEvent(testWindow.document, "visibilitychange", () => {
return !testWindow.document.hidden;
}, testWindow.begin);
return;
diff --git a/dom/base/test/fullscreen/test_fullscreen_modal.html b/dom/base/test/fullscreen/test_fullscreen_modal.html
index 78e70d9052..fef4e3867d 100644
--- a/dom/base/test/fullscreen/test_fullscreen_modal.html
+++ b/dom/base/test/fullscreen/test_fullscreen_modal.html
@@ -21,7 +21,7 @@ const button = document.querySelector("button");
let clickCount = 0;
let lastFullscreenPromise = null;
let shouldEnterFullscreen = false;
-button.addEventListener("click", function(e) {
+button.addEventListener("click", function() {
clickCount++;
if (shouldEnterFullscreen) {
const fullscreenElement = document.getElementById("fullscreen");
@@ -58,6 +58,15 @@ async function testFullscreenIsModal(modal) {
ok(document.fullscreenElement.matches(":fullscreen"), "Fullscreen element matches :fullscreen");
is(document.fullscreenElement.matches(":modal"), modal, "Fullscreen element matches :modal");
+ // Before exiting fullscreen, wait on the document becoming active,
+ // which signifies that the fullscreen request has been completely
+ // processed. It is important that the fullscreen request is all
+ // the way done, or the exit fullscreen request could be dropped.
+ let documentWrapper = SpecialPowers.wrap(document);
+ await SimpleTest.promiseWaitForCondition(() => documentWrapper.isActive(),
+ "Timed out waiting for document to become active.");
+ ok(documentWrapper.isActive(), "Document is active.");
+
await document.exitFullscreen();
clickButton(/* expectEvent = */ true);
}
diff --git a/dom/base/test/gtest/TestMimeType.cpp b/dom/base/test/gtest/TestMimeType.cpp
index fecb3f8678..40916130a8 100644
--- a/dom/base/test/gtest/TestMimeType.cpp
+++ b/dom/base/test/gtest/TestMimeType.cpp
@@ -9,12 +9,10 @@
#include "MimeType.h"
#include "nsString.h"
-using mozilla::UniquePtr;
-
TEST(MimeType, EmptyString)
{
const auto in = u""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Empty string";
}
@@ -22,7 +20,7 @@ TEST(MimeType, EmptyString)
TEST(MimeType, JustWhitespace)
{
const auto in = u" \t\r\n "_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Just whitespace";
}
@@ -30,7 +28,7 @@ TEST(MimeType, JustWhitespace)
TEST(MimeType, JustBackslash)
{
const auto in = u"\\"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Just backslash";
}
@@ -38,7 +36,7 @@ TEST(MimeType, JustBackslash)
TEST(MimeType, JustForwardslash)
{
const auto in = u"/"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Just forward slash";
}
@@ -46,7 +44,7 @@ TEST(MimeType, JustForwardslash)
TEST(MimeType, MissingType1)
{
const auto in = u"/bogus"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Missing type #1";
}
@@ -54,7 +52,7 @@ TEST(MimeType, MissingType1)
TEST(MimeType, MissingType2)
{
const auto in = u" \r\n\t/bogus"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Missing type #2";
}
@@ -62,7 +60,7 @@ TEST(MimeType, MissingType2)
TEST(MimeType, MissingSubtype1)
{
const auto in = u"bogus"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Missing subtype #1";
}
@@ -70,7 +68,7 @@ TEST(MimeType, MissingSubtype1)
TEST(MimeType, MissingSubType2)
{
const auto in = u"bogus/"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Missing subtype #2";
}
@@ -78,7 +76,7 @@ TEST(MimeType, MissingSubType2)
TEST(MimeType, MissingSubType3)
{
const auto in = u"bogus;"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Missing subtype #3";
}
@@ -86,7 +84,7 @@ TEST(MimeType, MissingSubType3)
TEST(MimeType, MissingSubType4)
{
const auto in = u"bogus; \r\n\t"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Missing subtype #3";
}
@@ -94,7 +92,7 @@ TEST(MimeType, MissingSubType4)
TEST(MimeType, ExtraForwardSlash)
{
const auto in = u"bogus/bogus/;"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Extra forward slash";
}
@@ -102,7 +100,7 @@ TEST(MimeType, ExtraForwardSlash)
TEST(MimeType, WhitespaceInType)
{
const auto in = u"t\re\nx\tt /html"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Type with whitespace";
}
@@ -110,7 +108,7 @@ TEST(MimeType, WhitespaceInType)
TEST(MimeType, WhitespaceInSubtype)
{
const auto in = u"text/ h\rt\nm\tl"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Subtype with whitespace";
}
@@ -118,7 +116,7 @@ TEST(MimeType, WhitespaceInSubtype)
TEST(MimeType, NonAlphanumericMediaType1)
{
const auto in = u"</>"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #1";
}
@@ -126,7 +124,7 @@ TEST(MimeType, NonAlphanumericMediaType1)
TEST(MimeType, NonAlphanumericMediaType2)
{
const auto in = u"(/)"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #2";
}
@@ -134,7 +132,7 @@ TEST(MimeType, NonAlphanumericMediaType2)
TEST(MimeType, NonAlphanumericMediaType3)
{
const auto in = u"{/}"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #3";
}
@@ -142,7 +140,7 @@ TEST(MimeType, NonAlphanumericMediaType3)
TEST(MimeType, NonAlphanumericMediaType4)
{
const auto in = u"\"/\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #4";
}
@@ -150,7 +148,7 @@ TEST(MimeType, NonAlphanumericMediaType4)
TEST(MimeType, NonAlphanumericMediaType5)
{
const auto in = u"\0/\0"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #5";
}
@@ -158,7 +156,7 @@ TEST(MimeType, NonAlphanumericMediaType5)
TEST(MimeType, NonAlphanumericMediaType6)
{
const auto in = u"text/html(;doesnot=matter"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-alphanumeric media type #6";
}
@@ -166,7 +164,7 @@ TEST(MimeType, NonAlphanumericMediaType6)
TEST(MimeType, NonLatin1MediaType1)
{
const auto in = u"ÿ/ÿ"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-latin1 media type #1";
}
@@ -174,7 +172,7 @@ TEST(MimeType, NonLatin1MediaType1)
TEST(MimeType, NonLatin1MediaType2)
{
const auto in = u"\x0100/\x0100"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_FALSE(parsed)
<< "Non-latin1 media type #2";
}
@@ -182,7 +180,7 @@ TEST(MimeType, NonLatin1MediaType2)
TEST(MimeType, MultipleParameters)
{
const auto in = u"text/html;charset=gbk;no=1;charset_=gbk_;yes=2"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
@@ -194,7 +192,7 @@ TEST(MimeType, MultipleParameters)
TEST(MimeType, DuplicateParameter1)
{
const auto in = u"text/html;charset=gbk;charset=windows-1255"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
@@ -206,7 +204,7 @@ TEST(MimeType, DuplicateParameter1)
TEST(MimeType, DuplicateParameter2)
{
const auto in = u"text/html;charset=();charset=GBK"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
@@ -218,7 +216,7 @@ TEST(MimeType, DuplicateParameter2)
TEST(MimeType, CString)
{
const auto in = "text/html;charset=();charset=GBK"_ns;
- UniquePtr<CMimeType> parsed = CMimeType::Parse(in);
+ RefPtr<CMimeType> parsed = CMimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsCString out;
@@ -234,7 +232,7 @@ TEST(MimeType, CString)
TEST(MimeType, NonAlphanumericParametersAreQuoted)
{
const auto in = u"text/html;test=\x00FF\\;charset=gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsString out;
@@ -249,7 +247,7 @@ TEST(MimeType, NonAlphanumericParametersAreQuoted)
TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace1)
{
const auto in = u"text/html;charset= g\\\"bk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -261,7 +259,7 @@ TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace1)
TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace2)
{
const auto in = u"text/html;charset= \"g\\bk\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -273,7 +271,7 @@ TEST(MimeType, ParameterQuotedIfHasLeadingWhitespace2)
TEST(MimeType, ParameterQuotedIfHasInternalWhitespace)
{
const auto in = u"text/html;charset=g \\b\"k"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -285,7 +283,7 @@ TEST(MimeType, ParameterQuotedIfHasInternalWhitespace)
TEST(MimeType, ImproperlyQuotedParameter1)
{
const auto in = u"x/x;test=\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -297,7 +295,7 @@ TEST(MimeType, ImproperlyQuotedParameter1)
TEST(MimeType, ImproperlyQuotedParameter2)
{
const auto in = u"x/x;test=\"\\"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -309,7 +307,7 @@ TEST(MimeType, ImproperlyQuotedParameter2)
TEST(MimeType, NonLatin1ParameterIgnored)
{
const auto in = u"x/x;test=\xFFFD;x=x"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -321,7 +319,7 @@ TEST(MimeType, NonLatin1ParameterIgnored)
TEST(MimeType, ParameterIgnoredIfWhitespaceInName1)
{
const auto in = u"text/html;charset =gbk;charset=123"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -333,7 +331,7 @@ TEST(MimeType, ParameterIgnoredIfWhitespaceInName1)
TEST(MimeType, ParameterIgnoredIfWhitespaceInName2)
{
const auto in = u"text/html;cha rset =gbk;charset=123"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -345,7 +343,7 @@ TEST(MimeType, ParameterIgnoredIfWhitespaceInName2)
TEST(MimeType, WhitespaceTrimmed)
{
const auto in = u"\n\r\t text/plain\n\r\t ;\n\r\t charset=123\n\r\t "_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -357,7 +355,7 @@ TEST(MimeType, WhitespaceTrimmed)
TEST(MimeType, WhitespaceOnlyParameterIgnored)
{
const auto in = u"x/x;x= \r\n\t"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -369,7 +367,7 @@ TEST(MimeType, WhitespaceOnlyParameterIgnored)
TEST(MimeType, IncompleteParameterIgnored1)
{
const auto in = u"x/x;test"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -381,7 +379,7 @@ TEST(MimeType, IncompleteParameterIgnored1)
TEST(MimeType, IncompleteParameterIgnored2)
{
const auto in = u"x/x;test="_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -393,7 +391,7 @@ TEST(MimeType, IncompleteParameterIgnored2)
TEST(MimeType, IncompleteParameterIgnored3)
{
const auto in = u"x/x;test= \r\n\t"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -405,7 +403,7 @@ TEST(MimeType, IncompleteParameterIgnored3)
TEST(MimeType, IncompleteParameterIgnored4)
{
const auto in = u"text/html;test;charset=gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -417,7 +415,7 @@ TEST(MimeType, IncompleteParameterIgnored4)
TEST(MimeType, IncompleteParameterIgnored5)
{
const auto in = u"text/html;test=;charset=gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -429,7 +427,7 @@ TEST(MimeType, IncompleteParameterIgnored5)
TEST(MimeType, EmptyParameterIgnored1)
{
const auto in = u"text/html ; ; charset=gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -441,7 +439,7 @@ TEST(MimeType, EmptyParameterIgnored1)
TEST(MimeType, EmptyParameterIgnored2)
{
const auto in = u"text/html;;;;charset=gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -453,7 +451,7 @@ TEST(MimeType, EmptyParameterIgnored2)
TEST(MimeType, InvalidParameterIgnored1)
{
const auto in = u"text/html;';charset=gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -465,7 +463,7 @@ TEST(MimeType, InvalidParameterIgnored1)
TEST(MimeType, InvalidParameterIgnored2)
{
const auto in = u"text/html;\";charset=gbk;=123; =321"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -477,7 +475,7 @@ TEST(MimeType, InvalidParameterIgnored2)
TEST(MimeType, InvalidParameterIgnored3)
{
const auto in = u"text/html;charset= \"\u007F;charset=GBK"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -490,7 +488,7 @@ TEST(MimeType, InvalidParameterIgnored4)
{
const auto in = nsLiteralString(
u"text/html;charset=\"\u007F;charset=foo\";charset=GBK;charset=");
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -502,7 +500,7 @@ TEST(MimeType, InvalidParameterIgnored4)
TEST(MimeType, SingleQuotes1)
{
const auto in = u"text/html;charset='gbk'"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -514,7 +512,7 @@ TEST(MimeType, SingleQuotes1)
TEST(MimeType, SingleQuotes2)
{
const auto in = u"text/html;charset='gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -526,7 +524,7 @@ TEST(MimeType, SingleQuotes2)
TEST(MimeType, SingleQuotes3)
{
const auto in = u"text/html;charset=gbk'"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -538,7 +536,7 @@ TEST(MimeType, SingleQuotes3)
TEST(MimeType, SingleQuotes4)
{
const auto in = u"text/html;charset=';charset=GBK"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -550,7 +548,7 @@ TEST(MimeType, SingleQuotes4)
TEST(MimeType, SingleQuotes5)
{
const auto in = u"text/html;charset=''';charset=GBK"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -562,7 +560,7 @@ TEST(MimeType, SingleQuotes5)
TEST(MimeType, DoubleQuotes1)
{
const auto in = u"text/html;charset=\"gbk\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -574,7 +572,7 @@ TEST(MimeType, DoubleQuotes1)
TEST(MimeType, DoubleQuotes2)
{
const auto in = u"text/html;charset=\"gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -586,7 +584,7 @@ TEST(MimeType, DoubleQuotes2)
TEST(MimeType, DoubleQuotes3)
{
const auto in = u"text/html;charset=gbk\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -598,7 +596,7 @@ TEST(MimeType, DoubleQuotes3)
TEST(MimeType, DoubleQuotes4)
{
const auto in = u"text/html;charset=\" gbk\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -610,7 +608,7 @@ TEST(MimeType, DoubleQuotes4)
TEST(MimeType, DoubleQuotes5)
{
const auto in = u"text/html;charset=\"gbk \""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -622,7 +620,7 @@ TEST(MimeType, DoubleQuotes5)
TEST(MimeType, DoubleQuotes6)
{
const auto in = u"text/html;charset=\"\\ gbk\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -634,7 +632,7 @@ TEST(MimeType, DoubleQuotes6)
TEST(MimeType, DoubleQuotes7)
{
const auto in = u"text/html;charset=\"\\g\\b\\k\""_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -646,7 +644,7 @@ TEST(MimeType, DoubleQuotes7)
TEST(MimeType, DoubleQuotes8)
{
const auto in = u"text/html;charset=\"gbk\"x"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -658,7 +656,7 @@ TEST(MimeType, DoubleQuotes8)
TEST(MimeType, DoubleQuotes9)
{
const auto in = u"text/html;charset=\"\";charset=GBK"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -670,7 +668,7 @@ TEST(MimeType, DoubleQuotes9)
TEST(MimeType, DoubleQuotes10)
{
const auto in = u"text/html;charset=\";charset=GBK"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -682,7 +680,7 @@ TEST(MimeType, DoubleQuotes10)
TEST(MimeType, UnexpectedCodePoints)
{
const auto in = u"text/html;charset={gbk}"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -699,7 +697,7 @@ TEST(MimeType, LongTypesSubtypesAccepted)
"2345678901234567890123456789012345678901234567890123456789/"
"012345678901234567890123456789012345678901234567890123456789012345678901"
"2345678901234567890123456789012345678901234567890123456789");
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -716,7 +714,7 @@ TEST(MimeType, LongParametersAccepted)
"012345678901234567890123456789012345678901234567890123456789012345678901"
"2345678901234567890123456789012345678901234567890123456789=x;charset="
"gbk");
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -744,7 +742,7 @@ TEST(MimeType, AllValidCharactersAccepted1)
u"\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED"
u"\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8"
u"\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF\"");
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -756,7 +754,7 @@ TEST(MimeType, AllValidCharactersAccepted1)
TEST(MimeType, CaseNormalization1)
{
const auto in = u"TEXT/PLAIN;CHARSET=TEST"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -775,7 +773,7 @@ TEST(MimeType, CaseNormalization2)
".^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=!#$"
"%&'*+-.^_`|~"
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -794,7 +792,7 @@ TEST(MimeType, CaseNormalization2)
TEST(MimeType, LegacyCommentSyntax1)
{
const auto in = u"text/html;charset=gbk("_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
@@ -806,7 +804,7 @@ TEST(MimeType, LegacyCommentSyntax1)
TEST(MimeType, LegacyCommentSyntax2)
{
const auto in = u"text/html;x=(;charset=gbk"_ns;
- UniquePtr<MimeType> parsed = MimeType::Parse(in);
+ RefPtr<MimeType> parsed = MimeType::Parse(in);
ASSERT_TRUE(parsed)
<< "Parsing succeeded";
nsAutoString out;
diff --git a/dom/base/test/meta_viewport/viewport_helpers.js b/dom/base/test/meta_viewport/viewport_helpers.js
index d4d346b5d0..cad6613549 100644
--- a/dom/base/test/meta_viewport/viewport_helpers.js
+++ b/dom/base/test/meta_viewport/viewport_helpers.js
@@ -40,5 +40,6 @@ function getViewportInfo(aDisplayWidth, aDisplayHeight) {
}
function fuzzeq(a, b, msg) {
+ // eslint-disable-next-line mozilla/no-comparison-or-assignment-inside-ok
ok(Math.abs(a - b) < 1e-6, msg);
}
diff --git a/dom/base/test/mochitest.toml b/dom/base/test/mochitest.toml
index 6415c4b33b..fb6724e497 100644
--- a/dom/base/test/mochitest.toml
+++ b/dom/base/test/mochitest.toml
@@ -3,7 +3,6 @@ tags = "condprof"
prefs = [
"formhelper.autozoom.force-disable.test-only=true",
"plugins.rewrite_youtube_embeds=true",
- "dom.domrequest.enabled=true",
]
support-files = [
"audio.ogg",
@@ -1232,8 +1231,6 @@ skip-if = [
["test_domparsing.html"]
-["test_domrequest.html"]
-
["test_domwindowutils.html"]
skip-if = ["os == 'android'"] # Bug 1525959
@@ -1301,6 +1298,8 @@ skip-if = [
"http2",
]
+["test_focus_radio.html"]
+
["test_focus_scroll_padding_tab.html"]
["test_focus_scrollable_fieldset.html"]
diff --git a/dom/base/test/test_domrequest.html b/dom/base/test/test_domrequest.html
deleted file mode 100644
index 1aea26f657..0000000000
--- a/dom/base/test/test_domrequest.html
+++ /dev/null
@@ -1,233 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test for DOMRequest</title>
- <script src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="application/javascript">
-"use strict";
-
-var reqserv = SpecialPowers.getDOMRequestService();
-ok("createRequest" in reqserv, "appears to be a service");
-
-function testBasics() {
- // create a request
- var req = reqserv.createRequest(window);
- ok("result" in req, "request has result");
- ok("error" in req, "request has error");
- ok("onsuccess" in req, "request has onsuccess");
- ok("onerror" in req, "request has onerror");
- ok("readyState" in req, "request has readyState");
- ok("then" in req, "request has then");
-
- is(req.readyState, "pending", "readyState is pending");
- is(req.result, undefined, "result is undefined");
- is(req.onsuccess, null, "onsuccess is null");
- is(req.onerror, null, "onerror is null");
-
- runTest();
-}
-
-function testSuccess() {
- // fire success
- var req = reqserv.createRequest(window);
- var ev = null;
- req.onsuccess = function(e) {
- ev = e;
- }
- var result = null;
- var promise = req.then(function(r) {
- is(r, "my result", "correct result when resolving the promise");
- result = r;
- runTest();
- }, function(e) {
- ok(false, "promise should not be rejected");
- runTest();
- });
- ok(promise instanceof Promise, "then() should return a Promise");
- reqserv.fireSuccess(req, "my result");
- ok(ev, "got success event");
- is(ev.type, "success", "correct type during success");
- is(ev.target, req, "correct target during success");
- is(req.readyState, "done", "correct readyState after success");
- is(req.error, null, "correct error after success");
- is(req.result, "my result", "correct result after success");
- is(result, null, "Promise should not be resolved synchronously");
-}
-
-function testError() {
- // fire error
- var req = reqserv.createRequest(window);
- var ev = null;
- req.onerror = function(e) {
- ev = e;
- }
- var error = null;
- var promise = req.then(function(r) {
- ok(false, "promise should not be resolved");
- runTest();
- }, function(e) {
- ok(e instanceof DOMException, "got error rejection");
- ok(e === req.error, "got correct error when rejecting the promise");
- error = e;
- runTest();
- });
- ok(promise instanceof Promise, "then() should return a Promise");
- reqserv.fireError(req, "OhMyError");
- ok(ev, "got error event");
- is(ev.type, "error", "correct type during error");
- is(ev.target, req, "correct target during error");
- is(req.readyState, "done", "correct readyState after error");
- is(req.error.name, "UnknownError", "correct error type after error");
- is(req.error.message, "OhMyError", "correct error message after error");
- is(req.result, undefined, "correct result after error");
- is(error, null, "Promise should not be rejected synchronously");
-}
-
-function testDetailedError() {
- // fire detailed error
- var req = reqserv.createRequest(window);
- var ev = null;
- req.onerror = function(e) {
- ev = e;
- };
- var error = null;
- var promise = req.then(function(r) {
- ok(false, "promise should not be resolved");
- runTest();
- }, function(e) {
- ok(e instanceof DOMException, "got error rejection");
- ok(e === req.error, "got correct error when rejecting the promise");
- error = e;
- runTest();
- });
- ok(promise instanceof Promise, "then() should return a Promise");
- SpecialPowers.wrwp(req).fireDetailedError(new DOMException("detailedError"));
- ok(ev, "got error event");
- is(ev.type, "error", "correct type during error");
- is(ev.target, req, "correct target during error");
- is(req.readyState, "done", "correct readyState after error");
- is(req.error.name, "UnknownError", "correct error type after error");
- is(req.error.message, "detailedError", "correct error message after error");
- is(req.result, undefined, "correct result after error");
- is(error, null, "Promise should not be rejected synchronously");
-}
-
-function testThenAfterSuccess() {
- // fire success
- var req = reqserv.createRequest(window);
- var ev = null;
- req.onsuccess = function(e) {
- ev = e;
- }
- reqserv.fireSuccess(req, "my result");
- ok(ev, "got success event");
- is(ev.type, "success", "correct type during success");
- is(ev.target, req, "correct target during success");
- is(req.readyState, "done", "correct readyState after success");
- is(req.error, null, "correct error after success");
- is(req.result, "my result", "correct result after success");
- var result = null;
- var promise = req.then(function(r) {
- is(r, "my result", "correct result when resolving the promise");
- result = r;
- runTest();
- }, function(e) {
- ok(false, "promise should not be rejected");
- runTest();
- });
- ok(promise instanceof Promise, "then() should return a Promise");
- is(result, null, "Promise should not be resolved synchronously");
-}
-
-function testThenAfterError() {
- // fire error
- var req = reqserv.createRequest(window);
- var ev = null;
- req.onerror = function(e) {
- ev = e;
- }
- reqserv.fireError(req, "OhMyError");
- ok(ev, "got error event");
- is(ev.type, "error", "correct type during error");
- is(ev.target, req, "correct target during error");
- is(req.readyState, "done", "correct readyState after error");
- is(req.error.name, "UnknownError", "correct error type after error");
- is(req.error.message, "OhMyError", "correct error message after error");
- is(req.result, undefined, "correct result after error");
- var error = null;
- var promise = req.then(function(r) {
- ok(false, "promise should not be resolved");
- runTest();
- }, function(e) {
- ok(e instanceof DOMException, "got error rejection");
- ok(e === req.error, "got correct error when rejecting the promise");
- error = e;
- runTest();
- });
- ok(promise instanceof Promise, "then() should return a Promise");
- is(error, null, "Promise should not be rejected synchronously");
-}
-
-function testDetailedError() {
- // fire detailed error
- var req = reqserv.createRequest(window);
- var ev = null;
- req.onerror = function(e) {
- ev = e;
- };
- var error = null;
- var promise = req.then(function(r) {
- ok(false, "promise should not be resolved");
- runTest();
- }, function(e) {
- ok(e instanceof DOMException, "got error rejection");
- ok(e === req.error, "got correct error when rejecting the promise");
- error = e;
- runTest();
- });
- ok(promise instanceof Promise, "then() should return a Promise");
- SpecialPowers.wrap(req).fireDetailedError(new DOMException("detailedError"));
- ok(ev, "got error event");
- is(ev.type, "error", "correct type during error");
- is(ev.target, req, "correct target during error");
- is(req.readyState, "done", "correct readyState after error");
- is(req.error.name, "Error", "correct error type after error");
- is(req.error.message, "detailedError", "correct error message after error");
- is(req.result, undefined, "correct result after error");
- is(error, null, "Promise should not be rejected synchronously");
-}
-
-var tests = [
- testBasics,
- testSuccess,
- testError,
- testDetailedError,
- testThenAfterSuccess,
- testThenAfterError,
-];
-
-function runTest() {
- if (!tests.length) {
- SimpleTest.finish();
- return;
- }
-
- var test = tests.shift();
- test();
-}
-
-SimpleTest.waitForExplicitFinish();
-runTest();
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/base/test/test_domrequesthelper.xhtml b/dom/base/test/test_domrequesthelper.xhtml
deleted file mode 100644
index 6b9061b8a2..0000000000
--- a/dom/base/test/test_domrequesthelper.xhtml
+++ /dev/null
@@ -1,549 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
-
-<window title="DOMRequestHelper Test"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- onload="start();">
-
- <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
- <script type="application/javascript">
- <![CDATA[
- const {DOMRequestIpcHelper} = ChromeUtils.importESModule(
- "resource://gre/modules/DOMRequestHelper.sys.mjs"
- );
- let obs = Cc["@mozilla.org/observer-service;1"].
- getService(Ci.nsIObserverService);
- let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService();
-
- function DummyHelperSubclass() {
- this.onuninit = null;
- }
- DummyHelperSubclass.prototype = {
- __proto__: DOMRequestIpcHelper.prototype,
- uninit() {
- if (typeof this.onuninit === "function") {
- this.onuninit();
- }
- this.onuninit = null;
- }
- };
-
- var dummy = new DummyHelperSubclass();
- var isDOMRequestHelperDestroyed = false;
-
- /**
- * Init & destroy.
- */
- function initDOMRequestHelperTest(aMessages) {
- // If we haven't initialized the DOMRequestHelper object, its private
- // properties will be undefined, but once destroyDOMRequestHelper is
- // called, they're set to null.
- var expectedPrivatePropertyValues =
- isDOMRequestHelperDestroyed ? null : undefined;
-
- is(dummy._requests, expectedPrivatePropertyValues, "Request is expected");
- is(dummy._messages, undefined, "Messages is undefined");
- is(dummy._window, expectedPrivatePropertyValues, "Window is expected");
-
- dummy.initDOMRequestHelper(window, aMessages);
-
- ok(dummy._window, "Window exists");
- is(dummy._window, window, "Correct window");
- if (aMessages) {
- is(typeof dummy._listeners, "object", "Listeners is an object");
- }
- }
-
- function destroyDOMRequestHelperTest() {
- dummy.destroyDOMRequestHelper();
- isDOMRequestHelperDestroyed = true;
-
- is(dummy._requests, null, "Request is null");
- is(dummy._messages, undefined, "Messages is undefined");
- is(dummy._window, null, "Window is null");
- }
-
- /**
- * Message listeners.
- */
- function checkMessageListeners(aExpectedListeners, aCount) {
- info("Checking message listeners\n" + "Expected listeners " +
- JSON.stringify(aExpectedListeners) + " \nExpected count " + aCount);
- let count = 0;
- Object.keys(dummy._listeners).forEach(function(name) {
- count++;
- is(aExpectedListeners[name].weakRef, dummy._listeners[name].weakRef,
- "Message found " + name + " - Same weakRef");
- is(aExpectedListeners[name].count, dummy._listeners[name].count,
- "Message found " + name + " - Same count");
- });
- is(aCount, count, "Correct number of listeners");
- }
-
- function addMessageListenersTest(aMessages, aExpectedListeners, aCount) {
- dummy.addMessageListeners(aMessages);
- info(JSON.stringify(dummy._listeners));
- checkMessageListeners(aExpectedListeners, aCount);
- }
-
- function removeMessageListenersTest(aMessages, aExpectedListeners, aCount) {
- dummy.removeMessageListeners(aMessages);
- checkMessageListeners(aExpectedListeners, aCount);
- }
-
- /**
- * Utility function to test window destruction behavior. In general this
- * function does the following:
- *
- * 1) Create a new iframe
- * 2) Create a new DOMRequestHelper
- * 3) initDOMRequestHelper(), optionally with weak or strong listeners
- * 4) Optionally force a garbage collection to reap weak references
- * 5) Destroy the iframe triggering an inner-window-destroyed event
- * 6) Callback with a boolean indicating if DOMRequestHelper.uninit() was
- * called.
- *
- * Example usage:
- *
- * checkWindowDestruction({ messages: ["foo"], gc: true },
- * function(uninitCalled) {
- * // expect uninitCalled === false since GC with only weak refs
- * });
- */
- const TOPIC = "inner-window-destroyed";
- function checkWindowDestruction(aOptions, aCallback) {
- aOptions = aOptions || {};
- aOptions.messages = aOptions.messages || [];
- aOptions.gc = !!aOptions.gc;
-
- if (typeof aCallback !== "function") {
- aCallback = function() { };
- }
-
- let uninitCalled = false;
-
- // Use a secondary observer so we know when to expect the uninit(). We
- // can then reasonably expect uninitCalled to be set properly on the
- // next tick.
- let observer = {
- observe(aSubject, aTopic, aData) {
- if (aTopic !== TOPIC) {
- return;
- }
- obs.removeObserver(observer, TOPIC);
- setTimeout(function() {
- aCallback(uninitCalled);
- });
- }
- };
-
- let frame = document.createXULElement("iframe");
- frame.onload = function() {
- obs.addObserver(observer, TOPIC);
- // Create dummy DOMRequestHelper specific to checkWindowDestruction()
- let cwdDummy = new DummyHelperSubclass();
- cwdDummy.onuninit = function() {
- uninitCalled = true;
-
- if (!aOptions.messages || !aOptions.messages.length) {
- return;
- }
-
- // If all message listeners are removed, cwdDummy.receiveMessage
- // should never be called.
- ppmm.broadcastAsyncMessage(aOptions.messages[0].name);
- };
-
- // Test if we still receive messages from ppmm.
- cwdDummy.receiveMessage = function(aMessage) {
- ok(false, "cwdDummy.receiveMessage should NOT be called: " + aMessage.name);
- };
-
- cwdDummy.initDOMRequestHelper(frame.contentWindow, aOptions.messages);
- // Make sure to clear our strong ref here so that we can test our
- // weak reference listeners and observer.
- cwdDummy = null;
- if (aOptions.gc) {
- Cu.schedulePreciseGC(function() {
- SpecialPowers.DOMWindowUtils.cycleCollect();
- SpecialPowers.DOMWindowUtils.garbageCollect();
- SpecialPowers.DOMWindowUtils.garbageCollect();
- document.documentElement.removeChild(frame);
- });
- return;
- }
- document.documentElement.removeChild(frame);
- };
- document.documentElement.appendChild(frame);
- }
-
- /**
- * Test steps.
- */
- var tests = [
- function() {
- info("== InitDOMRequestHelper no messages");
- initDOMRequestHelperTest(null);
- next();
- },
- function() {
- info("== DestroyDOMRequestHelper");
- destroyDOMRequestHelperTest();
- next();
- },
- function() {
- info("== InitDOMRequestHelper empty array");
- initDOMRequestHelperTest([]);
- checkMessageListeners({}, 0);
- next();
- },
- function() {
- info("== DestroyDOMRequestHelper");
- destroyDOMRequestHelperTest();
- next();
- },
- function() {
- info("== InitDOMRequestHelper with strings array");
- initDOMRequestHelperTest(["name1", "nameN"]);
- checkMessageListeners({"name1": {weakRef: false, count: 1},
- "nameN": {weakRef: false, count: 1}}, 2);
- next();
- },
- function() {
- info("== DestroyDOMRequestHelper");
- destroyDOMRequestHelperTest();
- next();
- },
- function() {
- info("== InitDOMRequestHelper with objects array");
- initDOMRequestHelperTest([{
- name: "name1",
- weakRef: false
- }, {
- name: "nameN",
- weakRef: true
- }]);
- checkMessageListeners({
- "name1": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 2);
- next();
- },
- function() {
- info("== AddMessageListeners empty array");
- addMessageListenersTest([], {
- "name1": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 2);
- next();
- },
- function() {
- info("== AddMessageListeners null");
- addMessageListenersTest(null, {
- "name1": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 2);
- next();
- },
- function() {
- info("== AddMessageListeners new listener, string only");
- addMessageListenersTest("name2", {
- "name1": {weakRef: false, count: 1},
- "name2": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 3);
- next();
- },
- function() {
- info("== AddMessageListeners new listeners, strings array");
- addMessageListenersTest(["name3", "name4"], {
- "name1": {weakRef: false, count: 1},
- "name2": {weakRef: false, count: 1},
- "name3": {weakRef: false, count: 1},
- "name4": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 5);
- next();
- },
- function() {
- info("== AddMessageListeners new listeners, objects array");
- addMessageListenersTest([{
- name: "name5",
- weakRef: true
- }, {
- name: "name6",
- weakRef: false
- }], {
- "name1": {weakRef: false, count: 1},
- "name2": {weakRef: false, count: 1},
- "name3": {weakRef: false, count: 1},
- "name4": {weakRef: false, count: 1},
- "name5": {weakRef: true, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 7);
- next();
- },
- function() {
- info("== RemoveMessageListeners, null");
- removeMessageListenersTest(null, {
- "name1": {weakRef: false, count: 1},
- "name2": {weakRef: false, count: 1},
- "name3": {weakRef: false, count: 1},
- "name4": {weakRef: false, count: 1},
- "name5": {weakRef: true, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 7);
- next();
- },
- function() {
- info("== RemoveMessageListeners, one message");
- removeMessageListenersTest("name1", {
- "name2": {weakRef: false, count: 1},
- "name3": {weakRef: false, count: 1},
- "name4": {weakRef: false, count: 1},
- "name5": {weakRef: true, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 6);
- next();
- },
- function() {
- info("== RemoveMessageListeners, array of messages");
- removeMessageListenersTest(["name2", "name3"], {
- "name4": {weakRef: false, count: 1},
- "name5": {weakRef: true, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 4);
- next();
- },
- function() {
- info("== RemoveMessageListeners, unknown message");
- removeMessageListenersTest("unknown", {
- "name4": {weakRef: false, count: 1},
- "name5": {weakRef: true, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 4);
- next();
- },
- function() {
- try {
- info("== AddMessageListeners, same message, same kind");
- addMessageListenersTest("name4", {
- "name4": {weakRef: false, count: 2},
- "name5": {weakRef: true, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 4);
- next();
- } catch (ex) {
- ok(false, "Unexpected exception " + ex);
- }
- },
- function() {
- info("== AddMessageListeners, same message, different kind");
- try {
- addMessageListenersTest({name: "name4", weakRef: true}, {
- "name4": {weakRef: false, count: 2},
- "name5": {weakRef: true, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 4);
- ok(false, "Should have thrown an exception");
- } catch (ex) {
- ok(true, "Expected exception");
- next();
- }
- },
- function() {
- info("== RemoveMessageListeners, message with two listeners");
- try {
- removeMessageListenersTest(["name4", "name5"], {
- "name4": {weakRef: false, count: 1},
- "name6": {weakRef: false, count: 1},
- "nameN": {weakRef: true, count: 1}
- }, 3);
- next();
- } catch (ex) {
- ok(false, "Unexpected exception " + ex);
- }
- },
- function() {
- info("== Test createRequest()");
- ok(DOMRequest, "DOMRequest object exists");
- var req = dummy.createRequest();
- ok(DOMRequest.isInstance(req), "Returned a DOMRequest");
- next();
- },
- function() {
- info("== Test getRequestId(), removeRequest() and getRequest()");
- var req = dummy.createRequest();
- var id = dummy.getRequestId(req);
- is(typeof id, "string", "id is a string");
- var req_ = dummy.getRequest(id);
- is(req, req_, "Got correct request");
- dummy.removeRequest(id);
- req = dummy.getRequest(id);
- is(req, undefined, "No request");
- next();
- },
- function() {
- info("== Test createPromise()");
- ok(Promise, "Promise object exists");
- var promise = dummy.createPromise(function(resolve, reject) {
- resolve(true);
- });
- ok(promise instanceof Promise, "Returned a Promise");
- promise.then(next);
- },
- function() {
- info("== Test createPromiseWithId()");
- var _resolverId;
- var promise = dummy.createPromiseWithId(function(resolverId) {
- _resolverId = resolverId;
- });
- var resolver = dummy.getPromiseResolver(_resolverId);
- ok(promise instanceof Promise, "Returned a Promise");
- ok(typeof _resolverId === "string", "resolverId is a string");
- ok(resolver != null, "resolverId is a valid id");
- next();
- },
- function() {
- info("== Test getResolver()");
- var id;
- var resolver;
- var promise = dummy.createPromise(function(resolve, reject) {
- var r = { resolve, reject };
- id = dummy.getPromiseResolverId(r);
- resolver = r;
- ok(typeof id === "string", "id is a string");
- r.resolve(true);
- }).then(function(unused) {
- var r = dummy.getPromiseResolver(id);
- ok(resolver === r, "Get succeeded");
- next();
- });
- },
- function() {
- info("== Test removeResolver");
- var id;
- var promise = dummy.createPromise(function(resolve, reject) {
- var r = { resolve, reject };
- id = dummy.getPromiseResolverId(r);
- ok(typeof id === "string", "id is a string");
-
- var resolver = dummy.getPromiseResolver(id);
- info("Got resolver " + JSON.stringify(resolver));
- ok(resolver === r, "Resolver get succeeded");
-
- r.resolve(true);
- }).then(function(unused) {
- dummy.removePromiseResolver(id);
- var resolver = dummy.getPromiseResolver(id);
- ok(resolver === undefined, "removeResolver: get failed");
- next();
- });
- },
- function() {
- info("== Test takeResolver");
- var id;
- var resolver;
- var promise = dummy.createPromise(function(resolve, reject) {
- var r = { resolve, reject };
- id = dummy.getPromiseResolverId(r);
- resolver = r;
- ok(typeof id === "string", "id is a string");
-
- var gotR = dummy.getPromiseResolver(id);
- ok(gotR === r, "resolver get succeeded");
-
- r.resolve(true);
- }).then(function(unused) {
- var r = dummy.takePromiseResolver(id);
- ok(resolver === r, "take should succeed");
-
- r = dummy.getPromiseResolver(id);
- ok(r === undefined, "takeResolver: get failed");
- next();
- });
- },
- function() {
- info("== Test window destroyed without messages and without GC");
- checkWindowDestruction({ gc: false }, function(uninitCalled) {
- ok(uninitCalled, "uninit() should have been called");
- next();
- });
- },
- function() {
- info("== Test window destroyed without messages and with GC");
- checkWindowDestruction({ gc: true }, function(uninitCalled) {
- ok(!uninitCalled, "uninit() should NOT have been called");
- next();
- });
- },
- function() {
- info("== Test window destroyed with weak messages and without GC");
- checkWindowDestruction({ messages: [{ name: "foo", weakRef: true }],
- gc: false }, function(uninitCalled) {
- ok(uninitCalled, "uninit() should have been called");
- next();
- });
- },
- function() {
- info("== Test window destroyed with weak messages and with GC");
- checkWindowDestruction({ messages: [{ name: "foo", weakRef: true }],
- gc: true }, function(uninitCalled) {
- ok(!uninitCalled, "uninit() should NOT have been called");
- next();
- });
- },
- function() {
- info("== Test window destroyed with strong messages and without GC");
- checkWindowDestruction({ messages: [{ name: "foo", weakRef: false }],
- gc: false }, function(uninitCalled) {
- ok(uninitCalled, "uninit() should have been called");
- next();
- });
- },
- function() {
- info("== Test window destroyed with strong messages and with GC");
- checkWindowDestruction({ messages: [{ name: "foo", weakRef: false }],
- gc: true }, function(uninitCalled) {
- ok(uninitCalled, "uninit() should have been called");
- next();
- });
- }
- ];
-
- function next() {
- if (!tests.length) {
- SimpleTest.finish();
- return;
- }
-
- var test = tests.shift();
- test();
- }
-
- function start() {
- SimpleTest.waitForExplicitFinish();
- next();
- }
- ]]>
- </script>
-
- <body xmlns="http://www.w3.org/1999/xhtml">
- <p id="display"></p>
- <div id="content" style="display: none"></div>
- <pre id="test"></pre>
- </body>
-</window>
diff --git a/dom/base/test/test_focus_radio.html b/dom/base/test/test_focus_radio.html
new file mode 100644
index 0000000000..8e97012745
--- /dev/null
+++ b/dom/base/test/test_focus_radio.html
@@ -0,0 +1,90 @@
+<!doctype html>
+<title>Test for input radio focus</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+
+<button id="before">before</button>
+<fieldset>
+ <legend>a</legend>
+ <label><input id="a1" type="radio" name="a" checked>a1</label>
+ <label><input id="a2" type="radio" name="a">a2</label>
+</fieldset>
+<fieldset>
+ <legend>b</legend>
+ <label><input id="b1" type="radio" name="b">b1</label>
+ <label><input id="b2" type="radio" name="b" checked>b2</label>
+</fieldset>
+<fieldset>
+ <legend>c</legend>
+ <label><input id="c1" type="radio" name="c">c1</label>
+ <label><input id="c2" type="radio" name="c">c2</label>
+</fieldset>
+<fieldset>
+ <legend>d</legend>
+ <label><input id="d1" type="radio" name="d" disabled>d1</label>
+ <label><input id="d2" type="radio" name="d">d2</label>
+ <label><input id="d3" type="radio" name="d" disabled>d3</label>
+ <label><input id="d4" type="radio" name="d">d4</label>
+</fieldset>
+<button id="after">after</button>
+
+<script>
+ SimpleTest.waitForExplicitFinish();
+
+ function expectFocusAfterKey(key, id) {
+ const res = key.match(/(Shift\+)?(.*)/);
+ const shiftKey = Boolean(res[1]);
+ const rawKey = res[2];
+ synthesizeKey(`KEY_${rawKey}`, { shiftKey });
+ is(document.activeElement.id, id, `${id} is focused after ${key}`);
+ }
+
+ SimpleTest.waitForFocus(async function() {
+ await SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]});
+
+ expectFocusAfterKey("Tab", "before");
+ // a1 is checked.
+ expectFocusAfterKey("Tab", "a1");
+ // b2 is checked.
+ expectFocusAfterKey("Tab", "b2");
+ // Nothing is checked in group c, so c1 should get focus.
+ expectFocusAfterKey("Tab", "c1");
+ // d1 is disabled, so d2 should get focus.
+ expectFocusAfterKey("Tab", "d2");
+ expectFocusAfterKey("Tab", "after");
+
+ expectFocusAfterKey("Shift+Tab", "d2");
+ expectFocusAfterKey("Shift+Tab", "c1");
+ expectFocusAfterKey("Shift+Tab", "b2");
+ expectFocusAfterKey("Shift+Tab", "a1");
+ expectFocusAfterKey("Shift+Tab", "before");
+
+ expectFocusAfterKey("Tab", "a1");
+ expectFocusAfterKey("ArrowDown", "a2");
+ expectFocusAfterKey("Tab", "b2");
+ // a2 is now checked, so shift+tab should focus it.
+ expectFocusAfterKey("Shift+Tab", "a2");
+
+ expectFocusAfterKey("Tab", "b2");
+ expectFocusAfterKey("ArrowUp", "b1");
+ expectFocusAfterKey("Shift+Tab", "a2");
+ expectFocusAfterKey("Tab", "b1");
+
+ expectFocusAfterKey("Tab", "c1");
+ expectFocusAfterKey("ArrowDown", "c2");
+ expectFocusAfterKey("Tab", "d2");
+ expectFocusAfterKey("Shift+Tab", "c2");
+
+ expectFocusAfterKey("Tab", "d2");
+ // d3 is disabled, so down arrow should focus d4.
+ expectFocusAfterKey("ArrowDown", "d4");
+ expectFocusAfterKey("ArrowUp", "d2");
+ expectFocusAfterKey("ArrowDown", "d4");
+ // Down arrow should wrap at the bottom, skipping disabled.
+ expectFocusAfterKey("ArrowDown", "d2");
+ // Up arrow should wrap at the top.
+ expectFocusAfterKey("ArrowUp", "d4");
+
+ SimpleTest.finish();
+ });
+</script>
diff --git a/dom/base/test/unit/test_error_codes.js b/dom/base/test/unit/test_error_codes.js
index 73c893c512..5c26331d11 100644
--- a/dom/base/test/unit/test_error_codes.js
+++ b/dom/base/test/unit/test_error_codes.js
@@ -10,7 +10,7 @@ function asyncXHR(expectedStatus, nextTestFunc) {
xhr.open("GET", "http://localhost:4444/test_error_code.xml", true);
var sawError = false;
- xhr.addEventListener("loadend", function doAsyncRequest_onLoad(event) {
+ xhr.addEventListener("loadend", function doAsyncRequest_onLoad() {
Assert.ok(sawError, "Should have received an error");
nextTestFunc();
});
diff --git a/dom/base/test/useractivation/file_clipboard_common.js b/dom/base/test/useractivation/file_clipboard_common.js
index fe172e52c8..3925404350 100644
--- a/dom/base/test/useractivation/file_clipboard_common.js
+++ b/dom/base/test/useractivation/file_clipboard_common.js
@@ -373,10 +373,10 @@ function allMechanisms(aCb, aClipOverride, aNegateAll) {
case 0:
// Keyboard issued
cutCopyAll(
- function docut(aSucc) {
+ function docut() {
synthesizeKey("x", { accelKey: true });
},
- function docopy(aSucc) {
+ function docopy() {
synthesizeKey("c", { accelKey: true });
},
function done() {
@@ -411,14 +411,14 @@ function allMechanisms(aCb, aClipOverride, aNegateAll) {
case 2:
// Not triggered by user gesture
cutCopyAll(
- function doCut(aSucc) {
+ function doCut() {
is(
false,
document.execCommand("cut"),
"Can't directly execCommand not in a user callback"
);
},
- function doCopy(aSucc) {
+ function doCopy() {
is(
false,
document.execCommand("copy"),
diff --git a/dom/base/test/useractivation/test_popup_blocker_async_callback.html b/dom/base/test/useractivation/test_popup_blocker_async_callback.html
index dc53596531..4667229116 100644
--- a/dom/base/test/useractivation/test_popup_blocker_async_callback.html
+++ b/dom/base/test/useractivation/test_popup_blocker_async_callback.html
@@ -16,7 +16,7 @@ SimpleTest.requestFlakyTimeout("Need to test setTimeout");
function startTest(aTestAsyncFun, aAllowPopup = true) {
return new Promise(aResolve => {
let target = document.getElementById("target");
- target.addEventListener("click", (e) => {
+ target.addEventListener("click", () => {
aTestAsyncFun(() => {
let w = window.open("about:blank");
is(!!w, aAllowPopup, `Should ${aAllowPopup ? "allow" : "block"} popup`);
diff --git a/dom/base/test/useractivation/test_useractivation_scrollbar.html b/dom/base/test/useractivation/test_useractivation_scrollbar.html
index 778d6d0898..197cdc49fb 100644
--- a/dom/base/test/useractivation/test_useractivation_scrollbar.html
+++ b/dom/base/test/useractivation/test_useractivation_scrollbar.html
@@ -78,7 +78,7 @@ if (!opener) {
SimpleTest.waitForFocus(async function() {
function waitForEvent(aTarget, aEvent) {
return new Promise((aResolve) => {
- aTarget.addEventListener(aEvent, function listener(event) {
+ aTarget.addEventListener(aEvent, function listener() {
aResolve();
}, { once: true });
});