summaryrefslogtreecommitdiffstats
path: root/docshell/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'docshell/test/unit')
-rw-r--r--docshell/test/unit/head_docshell.js36
-rw-r--r--docshell/test/unit/test_URIFixup.js21
-rw-r--r--docshell/test/unit/test_URIFixup_check_host.js2
-rw-r--r--docshell/test/unit/test_pb_notification.js2
-rw-r--r--docshell/test/unit/test_privacy_transition.js2
-rw-r--r--docshell/test/unit/test_subframe_stop_after_parent_error.js2
6 files changed, 56 insertions, 9 deletions
diff --git a/docshell/test/unit/head_docshell.js b/docshell/test/unit/head_docshell.js
index 1d74bd61c7..3295a44266 100644
--- a/docshell/test/unit/head_docshell.js
+++ b/docshell/test/unit/head_docshell.js
@@ -42,6 +42,36 @@ const SEARCH_CONFIG = [
},
];
+const CONFIG_V2 = [
+ {
+ recordType: "engine",
+ identifier: "test_urifixup_search_engine_app_provided",
+ base: {
+ name: "test_urifixup_search_engine_app_provided",
+ urls: {
+ search: {
+ base: "https://www.example.org/",
+ searchTermParamName: "search",
+ },
+ },
+ },
+ variants: [
+ {
+ environment: { allRegionsAndLocales: true },
+ },
+ ],
+ },
+ {
+ recordType: "defaultEngines",
+ globalDefault: "test_urifixup_search_engine_app_provided",
+ specificDefaults: [],
+ },
+ {
+ recordType: "engineOrders",
+ orders: [],
+ },
+];
+
async function setupSearchService() {
SearchTestUtils.init(this);
@@ -54,7 +84,11 @@ async function setupSearchService() {
"42"
);
- await SearchTestUtils.useTestEngines(".", null, SEARCH_CONFIG);
+ await SearchTestUtils.useTestEngines(
+ ".",
+ null,
+ SearchUtils.newSearchConfigEnabled ? CONFIG_V2 : SEARCH_CONFIG
+ );
await AddonTestUtils.promiseStartupManager();
await Services.search.init();
}
diff --git a/docshell/test/unit/test_URIFixup.js b/docshell/test/unit/test_URIFixup.js
index 794ee8cfa2..54e717244d 100644
--- a/docshell/test/unit/test_URIFixup.js
+++ b/docshell/test/unit/test_URIFixup.js
@@ -1,3 +1,7 @@
+const { PromiseTestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/PromiseTestUtils.sys.mjs"
+);
+
var pref = "browser.fixup.typo.scheme";
var data = [
@@ -103,11 +107,20 @@ var dontFixURIs = [
var len = data.length;
add_task(async function setup() {
- await setupSearchService();
- // Now we've initialised the search service, we force remove the engines
- // it has, so they don't interfere with this test.
+ // Force search service to fail, so we do not have any engines that can
+ // interfere with this test.
// Search engine integration is tested in test_URIFixup_search.js.
- Services.search.wrappedJSObject._engines.clear();
+ Services.search.wrappedJSObject.errorToThrowInTest = "Settings";
+
+ // When search service fails, we want the promise rejection to be uncaught
+ // so we can continue running the test.
+ PromiseTestUtils.expectUncaughtRejection(
+ /Fake Settings error during search service initialization./
+ );
+
+ try {
+ await setupSearchService();
+ } catch {}
});
// Make sure we fix what needs fixing when there is no pref set.
diff --git a/docshell/test/unit/test_URIFixup_check_host.js b/docshell/test/unit/test_URIFixup_check_host.js
index 132d74ca9b..8d75fcc032 100644
--- a/docshell/test/unit/test_URIFixup_check_host.js
+++ b/docshell/test/unit/test_URIFixup_check_host.js
@@ -161,7 +161,7 @@ add_task(async function test_ip_address() {
let didResolve = false;
let topic = "uri-fixup-check-dns";
let observer = {
- observe(aSubject, aTopicInner, aData) {
+ observe(aSubject, aTopicInner) {
if (aTopicInner == topic) {
didResolve = true;
}
diff --git a/docshell/test/unit/test_pb_notification.js b/docshell/test/unit/test_pb_notification.js
index 51cd3b95ff..ea6824e983 100644
--- a/docshell/test/unit/test_pb_notification.js
+++ b/docshell/test/unit/test_pb_notification.js
@@ -8,7 +8,7 @@ function destroy_transient_docshell() {
function run_test() {
var obs = {
- observe(aSubject, aTopic, aData) {
+ observe(aSubject, aTopic) {
Assert.equal(aTopic, "last-pb-context-exited");
do_test_finished();
},
diff --git a/docshell/test/unit/test_privacy_transition.js b/docshell/test/unit/test_privacy_transition.js
index ae1bf71284..3fe9ad116d 100644
--- a/docshell/test/unit/test_privacy_transition.js
+++ b/docshell/test/unit/test_privacy_transition.js
@@ -6,7 +6,7 @@ var observer = {
"nsISupportsWeakReference",
]),
- privateModeChanged(enabled) {
+ privateModeChanged() {
gNotifications++;
},
};
diff --git a/docshell/test/unit/test_subframe_stop_after_parent_error.js b/docshell/test/unit/test_subframe_stop_after_parent_error.js
index ee1876b4b9..b7ae25ee84 100644
--- a/docshell/test/unit/test_subframe_stop_after_parent_error.js
+++ b/docshell/test/unit/test_subframe_stop_after_parent_error.js
@@ -50,7 +50,7 @@ let thunks = new Set();
function promiseStateStop(webProgress) {
return new Promise(resolve => {
let listener = {
- onStateChange(aWebProgress, request, stateFlags, status) {
+ onStateChange(aWebProgress, request, stateFlags) {
if (stateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
webProgress.removeProgressListener(listener);