зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540658 - Web Authentication - U2FTokenManager must obey the IPC state machine r=keeler
In Bug 1448408 ("Don't listen to visibility events"), I changed `U2FTokenManager:: ClearTransaction` to send aborts, to handle the new visibility states. However, `WebAuthnTransactionParent::ActorDestroy` is called at the conclusion of IPC shutdown, which calls `MaybeClearTransaction` in `U2FTokenManager`, which calls ClearTransaction, which then tries to send an Abort, which is a state machine failure since we just shut the IPC down. This patch creates a new `AbortOngoingTransaction` method which is used to send the aborts instead of shoehorning that into `ClearTransaction`, reverting `ClearTransaction` back to the prior form, and instead changes `Register` and `Sign` to call the new method. Differential Revision: https://phabricator.services.mozilla.com/D25687 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
923a8c4af8
Коммит
dee2fdd745
|
@ -166,6 +166,15 @@ void U2FTokenManager::AbortTransaction(const uint64_t& aTransactionId,
|
|||
ClearTransaction();
|
||||
}
|
||||
|
||||
void U2FTokenManager::AbortOngoingTransaction() {
|
||||
if (mLastTransactionId > 0 && mTransactionParent) {
|
||||
// Send an abort to any other ongoing transaction
|
||||
Unused << mTransactionParent->SendAbort(mLastTransactionId,
|
||||
NS_ERROR_DOM_ABORT_ERR);
|
||||
}
|
||||
ClearTransaction();
|
||||
}
|
||||
|
||||
void U2FTokenManager::MaybeClearTransaction(
|
||||
PWebAuthnTransactionParent* aParent) {
|
||||
// Only clear if we've been requested to do so by our current transaction
|
||||
|
@ -176,12 +185,9 @@ void U2FTokenManager::MaybeClearTransaction(
|
|||
}
|
||||
|
||||
void U2FTokenManager::ClearTransaction() {
|
||||
if (mLastTransactionId > 0 && mTransactionParent) {
|
||||
if (mLastTransactionId) {
|
||||
// Remove any prompts we might be showing for the current transaction.
|
||||
SendPromptNotification(kCancelPromptNotifcation, mLastTransactionId);
|
||||
// Send an abort to any other ongoing transaction
|
||||
Unused << mTransactionParent->SendAbort(mLastTransactionId,
|
||||
NS_ERROR_DOM_ABORT_ERR);
|
||||
}
|
||||
|
||||
mTransactionParent = nullptr;
|
||||
|
@ -271,7 +277,7 @@ void U2FTokenManager::Register(
|
|||
const WebAuthnMakeCredentialInfo& aTransactionInfo) {
|
||||
MOZ_LOG(gU2FTokenManagerLog, LogLevel::Debug, ("U2FAuthRegister"));
|
||||
|
||||
ClearTransaction();
|
||||
AbortOngoingTransaction();
|
||||
mTransactionParent = aTransactionParent;
|
||||
mTokenManagerImpl = GetTokenManagerImpl();
|
||||
|
||||
|
@ -368,7 +374,7 @@ void U2FTokenManager::Sign(PWebAuthnTransactionParent* aTransactionParent,
|
|||
const WebAuthnGetAssertionInfo& aTransactionInfo) {
|
||||
MOZ_LOG(gU2FTokenManagerLog, LogLevel::Debug, ("U2FAuthSign"));
|
||||
|
||||
ClearTransaction();
|
||||
AbortOngoingTransaction();
|
||||
mTransactionParent = aTransactionParent;
|
||||
mTokenManagerImpl = GetTokenManagerImpl();
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class U2FTokenManager final : public nsIU2FTokenManager {
|
|||
~U2FTokenManager() {}
|
||||
RefPtr<U2FTokenTransport> GetTokenManagerImpl();
|
||||
void AbortTransaction(const uint64_t& aTransactionId, const nsresult& aError);
|
||||
void AbortOngoingTransaction();
|
||||
void ClearTransaction();
|
||||
// Step two of "Register", kicking off the actual transaction.
|
||||
void DoRegister(const WebAuthnMakeCredentialInfo& aInfo,
|
||||
|
|
Загрузка…
Ссылка в новой задаче