Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "mozilla/dom/WebAuthnTransactionChild.h"
8 : #include "mozilla/dom/WebAuthnManager.h"
9 :
10 : namespace mozilla {
11 : namespace dom {
12 :
13 0 : WebAuthnTransactionChild::WebAuthnTransactionChild()
14 : {
15 : // Retain a reference so the task object isn't deleted without IPDL's
16 : // knowledge. The reference will be released by
17 : // mozilla::ipc::BackgroundChildImpl::DeallocPWebAuthnTransactionChild.
18 0 : NS_ADDREF_THIS();
19 0 : }
20 :
21 : mozilla::ipc::IPCResult
22 0 : WebAuthnTransactionChild::RecvConfirmRegister(nsTArray<uint8_t>&& aRegBuffer)
23 : {
24 0 : RefPtr<WebAuthnManager> mgr = WebAuthnManager::Get();
25 0 : MOZ_ASSERT(mgr);
26 0 : mgr->FinishMakeCredential(aRegBuffer);
27 0 : return IPC_OK();
28 : }
29 :
30 : mozilla::ipc::IPCResult
31 0 : WebAuthnTransactionChild::RecvConfirmSign(nsTArray<uint8_t>&& aCredentialId,
32 : nsTArray<uint8_t>&& aBuffer)
33 : {
34 0 : RefPtr<WebAuthnManager> mgr = WebAuthnManager::Get();
35 0 : MOZ_ASSERT(mgr);
36 0 : mgr->FinishGetAssertion(aCredentialId, aBuffer);
37 0 : return IPC_OK();
38 : }
39 :
40 : mozilla::ipc::IPCResult
41 0 : WebAuthnTransactionChild::RecvCancel(const nsresult& aError)
42 : {
43 0 : RefPtr<WebAuthnManager> mgr = WebAuthnManager::Get();
44 0 : MOZ_ASSERT(mgr);
45 0 : mgr->Cancel(aError);
46 0 : return IPC_OK();
47 : }
48 :
49 : void
50 0 : WebAuthnTransactionChild::ActorDestroy(ActorDestroyReason why)
51 : {
52 0 : RefPtr<WebAuthnManager> mgr = WebAuthnManager::Get();
53 : // This could happen after the WebAuthnManager has been shut down.
54 0 : if (mgr) {
55 0 : mgr->ActorDestroyed();
56 : }
57 0 : }
58 :
59 : }
60 : }
|