mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1385274 - Don't try to resolve WebAuthnManager::mPBackgroundCreationPromise twice r=jcj
This commit is contained in:
parent
db40f0ec94
commit
0aee684c17
@ -239,14 +239,25 @@ WebAuthnManager::~WebAuthnManager()
|
||||
MaybeClearTransaction();
|
||||
}
|
||||
|
||||
already_AddRefed<MozPromise<nsresult, nsresult, false>>
|
||||
RefPtr<WebAuthnManager::BackgroundActorPromise>
|
||||
WebAuthnManager::GetOrCreateBackgroundActor()
|
||||
{
|
||||
bool ok = BackgroundChild::GetOrCreateForCurrentThread(this);
|
||||
if (NS_WARN_IF(!ok)) {
|
||||
ActorFailed();
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
PBackgroundChild *actor = BackgroundChild::GetForCurrentThread();
|
||||
RefPtr<WebAuthnManager::BackgroundActorPromise> promise =
|
||||
mPBackgroundCreationPromise.Ensure(__func__);
|
||||
|
||||
if (actor) {
|
||||
ActorCreated(actor);
|
||||
} else {
|
||||
bool ok = BackgroundChild::GetOrCreateForCurrentThread(this);
|
||||
if (NS_WARN_IF(!ok)) {
|
||||
ActorFailed();
|
||||
}
|
||||
}
|
||||
return mPBackgroundCreationPromise.Ensure(__func__);
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
//static
|
||||
@ -875,8 +886,13 @@ WebAuthnManager::Cancel(const nsresult& aError)
|
||||
void
|
||||
WebAuthnManager::ActorCreated(PBackgroundChild* aActor)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
if (mChild) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<WebAuthnTransactionChild> mgr(new WebAuthnTransactionChild());
|
||||
PWebAuthnTransactionChild* constructedMgr =
|
||||
aActor->SendPWebAuthnTransactionConstructor(mgr);
|
||||
|
@ -99,8 +99,9 @@ private:
|
||||
|
||||
void MaybeClearTransaction();
|
||||
|
||||
already_AddRefed<MozPromise<nsresult, nsresult, false>>
|
||||
GetOrCreateBackgroundActor();
|
||||
typedef MozPromise<nsresult, nsresult, false> BackgroundActorPromise;
|
||||
|
||||
RefPtr<BackgroundActorPromise> GetOrCreateBackgroundActor();
|
||||
|
||||
// JS Promise representing transaction status.
|
||||
RefPtr<Promise> mTransactionPromise;
|
||||
@ -120,7 +121,7 @@ private:
|
||||
Maybe<WebAuthnTransactionInfo> mInfo;
|
||||
|
||||
// Promise for dealing with PBackground Actor creation.
|
||||
MozPromiseHolder<MozPromise<nsresult, nsresult, false>> mPBackgroundCreationPromise;
|
||||
MozPromiseHolder<BackgroundActorPromise> mPBackgroundCreationPromise;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
Loading…
Reference in New Issue
Block a user