зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1705533 - Avoid racing on AltSvcCache::mStorage, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D112271
This commit is contained in:
Родитель
b4e39eb71d
Коммит
cd7fa085fa
|
@ -18,6 +18,7 @@
|
|||
#include "nsHttpTransaction.h"
|
||||
#include "nsISSLSocketControl.h"
|
||||
#include "nsIWellKnownOpportunisticUtils.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/dom/PContent.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
|
@ -865,7 +866,9 @@ TransactionObserver::OnStopRequest(nsIRequest* aRequest, nsresult code) {
|
|||
}
|
||||
|
||||
void AltSvcCache::EnsureStorageInited() {
|
||||
if (mStorage) {
|
||||
static Atomic<bool> initialized(false);
|
||||
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -883,6 +886,8 @@ void AltSvcCache::EnsureStorageInited() {
|
|||
|
||||
if (NS_FAILED(mStorage->Init(nullptr))) {
|
||||
mStorage = nullptr;
|
||||
} else {
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
mStorageEpoch = NowInSeconds();
|
||||
|
|
Загрузка…
Ссылка в новой задаче