diff --git a/toolkit/components/search/tests/xpcshell/head_search.js b/toolkit/components/search/tests/xpcshell/head_search.js index a607de834720..3a87c2b11552 100644 --- a/toolkit/components/search/tests/xpcshell/head_search.js +++ b/toolkit/components/search/tests/xpcshell/head_search.js @@ -66,15 +66,14 @@ SearchSettings.SETTNGS_INVALIDATION_DELAY = 250; async function promiseSettingsData() { let path = OS.Path.join(OS.Constants.Path.profileDir, SETTINGS_FILENAME); - let bytes = await OS.File.read(path, { compression: "lz4" }); - return JSON.parse(new TextDecoder().decode(bytes)); + return JSON.parse(await IOUtils.readUTF8(path, { decompress: true })); } function promiseSaveSettingsData(data) { - return OS.File.writeAtomic( + return IOUtils.write( OS.Path.join(OS.Constants.Path.profileDir, SETTINGS_FILENAME), new TextEncoder().encode(JSON.stringify(data)), - { compression: "lz4" } + { compress: true } ); } @@ -197,8 +196,7 @@ async function promiseSetLocale(locale) { * false otherwise. */ async function readJSONFile(file) { - let bytes = await OS.File.read(file.path); - return JSON.parse(new TextDecoder().decode(bytes)); + return JSON.parse(await IOUtils.readUTF8(file.path)); } /** diff --git a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js index 746cbdf4440d..d7b154afd175 100644 --- a/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js +++ b/toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js @@ -11,7 +11,6 @@ XPCOMUtils.defineLazyModuleGetters(this, { AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm", AppConstants: "resource://gre/modules/AppConstants.jsm", ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", - OS: "resource://gre/modules/osfile.jsm", Region: "resource://gre/modules/Region.jsm", RemoteSettings: "resource://services-settings/remote-settings.js", SearchEngine: "resource://gre/modules/SearchEngine.jsm", @@ -219,9 +218,7 @@ class SearchConfigTest { if (TEST_DEBUG) { return ["be", "en-US", "kk", "tr", "ru", "zh-CN", "ach", "unknown"]; } - const data = await OS.File.read(do_get_file("all-locales").path, { - encoding: "utf-8", - }); + const data = await IOUtils.readUTF8(do_get_file("all-locales").path); // "en-US" is not in all-locales as it is the default locale // add it manually to ensure it is tested. let locales = [...data.split("\n").filter(e => e != ""), "en-US"]; diff --git a/toolkit/components/search/tests/xpcshell/test_settings_duplicate.js b/toolkit/components/search/tests/xpcshell/test_settings_duplicate.js index 56ac4abf5cdc..d649bbef235c 100644 --- a/toolkit/components/search/tests/xpcshell/test_settings_duplicate.js +++ b/toolkit/components/search/tests/xpcshell/test_settings_duplicate.js @@ -97,10 +97,10 @@ add_task(async function setup() { enginesSettings.buildID = appInfo.platformBuildID; enginesSettings.appVersion = appInfo.version; - await OS.File.writeAtomic( + await IOUtils.write( OS.Path.join(OS.Constants.Path.profileDir, SETTINGS_FILENAME), new TextEncoder().encode(JSON.stringify(enginesSettings)), - { compression: "lz4" } + { compress: true } ); }); diff --git a/toolkit/components/search/tests/xpcshell/test_webextensions_startup_remove.js b/toolkit/components/search/tests/xpcshell/test_webextensions_startup_remove.js index 4e5de5644950..07ebabc42f2e 100644 --- a/toolkit/components/search/tests/xpcshell/test_webextensions_startup_remove.js +++ b/toolkit/components/search/tests/xpcshell/test_webextensions_startup_remove.js @@ -51,7 +51,7 @@ add_task(async function test_removeAddonOnStartup() { // Now remove it, reset the search service and start up the add-on manager. // Note: the saved settings will have the engine in. If this didn't work, // the engine would still be present. - await OS.File.remove( + await IOUtils.remove( OS.Path.join(profile.path, "extensions", `${ENGINE_ID}.xpi`) );