зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1644265 - Reject new DataStorages if we are shutting down r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D79760
This commit is contained in:
Родитель
76fccc6721
Коммит
2d9e62963a
|
@ -7,6 +7,7 @@
|
|||
#include "DataStorage.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/AppShutdown.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/PContent.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
|
@ -313,6 +314,14 @@ nsresult DataStorage::Init(const nsTArray<DataStorageItem>* aItems,
|
|||
return NS_ERROR_NOT_SAME_THREAD;
|
||||
}
|
||||
|
||||
if (AppShutdown::IsShuttingDown()) {
|
||||
// Reject new DataStorage instances if the browser is shutting down. There
|
||||
// is no guarantee that DataStorage writes will be able to be persisted if
|
||||
// we init during shutdown, so we return an error here to hopefully make
|
||||
// this more explicit and consistent.
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
// Ignore attempts to initialize several times.
|
||||
|
|
Загрузка…
Ссылка в новой задаче