зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1523609 - avoid triggering nsChromeRegistryChrome::CheckForNewChrome (which does main thread I/O) during shutdown of system add-ons, r=kmag.
Differential Revision: https://phabricator.services.mozilla.com/D22380 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d65d068e74
Коммит
dbd7ac1015
|
@ -130,7 +130,11 @@ this.formautofill = class extends ExtensionAPI {
|
|||
Services.mm.loadFrameScript("chrome://formautofill/content/FormAutofillFrameScript.js", true, true);
|
||||
}
|
||||
|
||||
onShutdown() {
|
||||
onShutdown(reason) {
|
||||
if (reason == "APP_SHUTDOWN") {
|
||||
return;
|
||||
}
|
||||
|
||||
resProto.setSubstitution(RESOURCE_HOST, null);
|
||||
|
||||
this.chromeHandle.destruct();
|
||||
|
|
|
@ -17,7 +17,7 @@ let l10nManifest;
|
|||
|
||||
this.l10n = class extends ExtensionAPI {
|
||||
onShutdown(reason) {
|
||||
if (l10nManifest) {
|
||||
if (reason !== "APP_SHUTDOWN" && l10nManifest) {
|
||||
Components.manager.removeBootstrappedManifestLocation(l10nManifest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/intl/LocaleService.h"
|
||||
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
@ -273,6 +274,12 @@ nsChromeRegistryChrome::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsChromeRegistryChrome::CheckForNewChrome() {
|
||||
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
|
||||
if (appStartup->GetShuttingDown()) {
|
||||
MOZ_ASSERT(false, "checking for new chrome during shutdown");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
mPackagesHash.Clear();
|
||||
mOverrideTable.Clear();
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
interface nsIToolkitProfile;
|
||||
|
||||
[scriptable, uuid(6621f6d5-6c04-4a0e-9e74-447db221484e)]
|
||||
|
||||
[scriptable, builtinclass, uuid(6621f6d5-6c04-4a0e-9e74-447db221484e)]
|
||||
interface nsIAppStartup : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -142,7 +141,7 @@ interface nsIAppStartup : nsISupports
|
|||
/**
|
||||
* True if the application is in the process of shutting down.
|
||||
*/
|
||||
readonly attribute boolean shuttingDown;
|
||||
[infallible] readonly attribute boolean shuttingDown;
|
||||
|
||||
/**
|
||||
* True if the application is in the process of starting up.
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/Compression.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -30,6 +31,7 @@
|
|||
#include "nsAppRunner.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsChromeRegistry.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIDOMWindowUtils.h" // for nsIJSRAIIHelper
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIIOService.h"
|
||||
|
@ -692,6 +694,13 @@ RegistryEntries::Destruct() {
|
|||
if (isInList()) {
|
||||
remove();
|
||||
|
||||
// No point in doing I/O to check for new chrome during shutdown, return
|
||||
// early in that case.
|
||||
nsCOMPtr<nsIAppStartup> appStartup = components::AppStartup::Service();
|
||||
if (!appStartup || appStartup->GetShuttingDown()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// When we remove dynamic entries from the registry, we need to rebuild it
|
||||
// in order to ensure a consistent state. See comments in Observe().
|
||||
RefPtr<nsChromeRegistry> cr = nsChromeRegistry::GetSingleton();
|
||||
|
|
Загрузка…
Ссылка в новой задаче