-
Rob Wu authored
TelemetryEnvironment.jsm's EnvironmentAddonBuilder has a shutdown blocker that depends on the addons database to have been loaded. There are two calls to asyncLoadDB() in XPIProvider.jsm that are supposed to activate the load. Neither of them work: - XPIProvider calls asyncLoadDB() during quitApplicationGranted. But "quit-application-granted" is not always triggered, as seen in: https://bugzilla.mozilla.org/show_bug.cgi?id=1601678#c12 - XPIProvider.shutdown() calls asyncLoadDB(). But shutdown() is only called when TelemetryEnvironment's blocker has been released. So this is never reached. More details in: https://bugzilla.mozilla.org/show_bug.cgi?id=1601678#c7 To fix the deadlock, asyncLoadDB() is called from profile-before-change, which is the same phase as the blocker of EnvironmentAddonBuilder. The two existing calls to asyncLoadDB() mentioned above are obsolete and have been removed. --- After the removal of asyncLoadDB() from XPIProvider.shutdown(), the test_ext_persistent_events.js test started to fail. This is because the test sends the "sessionstore-windows-restored" notification, for which XPIProvider has a handler that calls asyncLoadDB(), without awaiting the result. Since XPIProvider.shutdown() doesn't await the DB load any more, it is possible for the DB to be unloaded while being used. This only happens in tests, because the construction with the TelemetryEnvironment ensures that the addons database has fully loaded before shutdown() is called. To resolve this test-only issue, AddonTestUtils.promiseShutdownManager() has been updated to explicitly wait for the pending _dbPromise if any. Differential Revision: https://phabricator.services.mozilla.com/D91388
dc4938fe