From 79b06ec49dcc88c4d2b72d80acc738b165207e9c Mon Sep 17 00:00:00 2001 From: Tomislav Jovanovic Date: Tue, 14 Mar 2023 12:12:35 +0000 Subject: [PATCH] Bug 1819176 - Set default extension.startupReason for our tests, r=rpl Differential Revision: https://phabricator.services.mozilla.com/D171169 --- toolkit/components/extensions/ExtensionTestCommon.jsm | 2 +- .../xpcshell/test_ext_storage_idb_data_migration.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/toolkit/components/extensions/ExtensionTestCommon.jsm b/toolkit/components/extensions/ExtensionTestCommon.jsm index 014cae8eb848..a4b4e8795d7f 100644 --- a/toolkit/components/extensions/ExtensionTestCommon.jsm +++ b/toolkit/components/extensions/ExtensionTestCommon.jsm @@ -701,7 +701,7 @@ ExtensionTestCommon = class ExtensionTestCommon { // By default we set TEST_NO_DELAYED_STARTUP to true TEST_NO_DELAYED_STARTUP: !data.delayedStartup, }, - data.startupReason + data.startupReason ?? "ADDON_INSTALL" ); } }; diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js b/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js index 08f5f6fefe6d..63d2853c2da4 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_idb_data_migration.js @@ -102,7 +102,7 @@ function assertTelemetryEvents(expectedEvents) { }); } -add_task(async function setup() { +add_setup(async function setup() { Services.prefs.setBoolPref(ExtensionStorageIDB.BACKEND_ENABLED_PREF, true); await promiseStartupManager(); @@ -437,6 +437,9 @@ add_task(async function test_extensionId_trimmed_in_telemetry_event() { }, }, background, + // We don't want the (default) startupReason ADDON_INSTALL because + // that automatically sets the migrated pref and skips migration. + startupReason: "APP_STARTUP", }); await extension.startup(); @@ -521,6 +524,9 @@ add_task(async function test_storage_local_corrupted_data_migration() { }, }, background, + // We don't want the (default) startupReason ADDON_INSTALL because + // that automatically sets the migrated pref and skips migration. + startupReason: "APP_STARTUP", }); await extension.startup(); @@ -612,6 +618,9 @@ add_task(async function test_storage_local_data_migration_failure() { }, }, background, + // We don't want the (default) startupReason ADDON_INSTALL because + // that automatically sets the migrated pref and skips migration. + startupReason: "APP_STARTUP", }); await extension.startup(); @@ -665,6 +674,9 @@ add_task(async function test_migration_aborted_on_shutdown() { }, }, }, + // We don't want the (default) startupReason ADDON_INSTALL because + // that automatically sets the migrated pref and skips migration. + startupReason: "APP_STARTUP", }); await extension.startup(); @@ -754,6 +766,9 @@ async function test_quota_exceeded_while_migrating_data() { browser.test.sendMessage("bg-page:ready"); }, + // We don't want the (default) startupReason ADDON_INSTALL because + // that automatically sets the migrated pref and skips migration. + startupReason: "APP_STARTUP", }); await extension.startup(); -- 2.11.4.GIT