Files
firefox/dom/webauthn/WebAuthnTransactionParent.cpp
T
Tim Taubert afa10b4d8d Bug 1375744 - Add U2FTokenTransport::Cancel() to abort requests on HW devices r=qDot
This patch adds a Cancel() method to the U2FTokenTransport interface so that
we can forward request cancellations to the actual token manager implementation.
The current softtoken doesn't need that as it processes API calls synchronously,
USB HID tokens however need a cancellation mechanism.

The SendRequestCancel() call has been removed from WebAuthnManager::Cancel() as
we're currently only calling this method either when the chrome process
cancels the request (and then we don't need to send it back again) or the
content process fails to process the data after a request was fulfilled and
thus there's nothing to cancel. We will touch this again later when the UI
cancels requests on tab switch and similar user actions.
2017-06-23 21:04:38 +02:00

45 lines
1.2 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/WebAuthnTransactionParent.h"
#include "mozilla/dom/U2FTokenManager.h"
namespace mozilla {
namespace dom {
mozilla::ipc::IPCResult
WebAuthnTransactionParent::RecvRequestRegister(const WebAuthnTransactionInfo& aTransactionInfo)
{
U2FTokenManager* mgr = U2FTokenManager::Get();
mgr->Register(this, aTransactionInfo);
return IPC_OK();
}
mozilla::ipc::IPCResult
WebAuthnTransactionParent::RecvRequestSign(const WebAuthnTransactionInfo& aTransactionInfo)
{
U2FTokenManager* mgr = U2FTokenManager::Get();
mgr->Sign(this, aTransactionInfo);
return IPC_OK();
}
mozilla::ipc::IPCResult
WebAuthnTransactionParent::RecvRequestCancel()
{
U2FTokenManager* mgr = U2FTokenManager::Get();
mgr->Cancel(this);
return IPC_OK();
}
void
WebAuthnTransactionParent::ActorDestroy(ActorDestroyReason aWhy)
{
U2FTokenManager* mgr = U2FTokenManager::Get();
mgr->MaybeClearTransaction(this);
}
}
}