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/WebAuthenticationBinding.h"
8 : #include "mozilla/dom/AuthenticatorResponse.h"
9 :
10 : namespace mozilla {
11 : namespace dom {
12 :
13 : // Only needed for refcounted objects.
14 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AuthenticatorResponse, mParent)
15 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(AuthenticatorResponse)
16 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(AuthenticatorResponse)
17 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AuthenticatorResponse)
18 0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
19 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
20 0 : NS_INTERFACE_MAP_END
21 :
22 0 : AuthenticatorResponse::AuthenticatorResponse(nsPIDOMWindowInner* aParent)
23 0 : : mParent(aParent)
24 0 : {}
25 :
26 0 : AuthenticatorResponse::~AuthenticatorResponse()
27 0 : {}
28 :
29 : JSObject*
30 0 : AuthenticatorResponse::WrapObject(JSContext* aCx,
31 : JS::Handle<JSObject*> aGivenProto)
32 : {
33 0 : return AuthenticatorResponseBinding::Wrap(aCx, this, aGivenProto);
34 : }
35 :
36 : void
37 0 : AuthenticatorResponse::GetClientDataJSON(JSContext* aCx,
38 : JS::MutableHandle<JSObject*> aRetVal) const
39 : {
40 0 : aRetVal.set(mClientDataJSON.ToUint8Array(aCx));
41 0 : }
42 :
43 : nsresult
44 0 : AuthenticatorResponse::SetClientDataJSON(CryptoBuffer& aBuffer)
45 : {
46 0 : if (NS_WARN_IF(!mClientDataJSON.Assign(aBuffer))) {
47 0 : return NS_ERROR_OUT_OF_MEMORY;
48 : }
49 0 : return NS_OK;
50 : }
51 :
52 : } // namespace dom
53 : } // namespace mozilla
|