1010namespace mozilla {
1111namespace dom {
1212
13+ NS_IMPL_CYCLE_COLLECTION_CLASS (AuthenticatorAssertionResponse)
14+ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED (AuthenticatorAssertionResponse,
15+ AuthenticatorResponse)
16+ tmp->mAuthenticatorDataCachedObj = nullptr ;
17+ tmp->mSignatureCachedObj = nullptr ;
18+ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
19+
20+ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED (AuthenticatorAssertionResponse,
21+ AuthenticatorResponse)
22+ NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
23+ NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK (mAuthenticatorDataCachedObj )
24+ NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK (mSignatureCachedObj )
25+ NS_IMPL_CYCLE_COLLECTION_TRACE_END
26+
27+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED (AuthenticatorAssertionResponse,
28+ AuthenticatorResponse)
29+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
30+
1331NS_IMPL_ADDREF_INHERITED (AuthenticatorAssertionResponse, AuthenticatorResponse)
1432NS_IMPL_RELEASE_INHERITED (AuthenticatorAssertionResponse, AuthenticatorResponse)
1533
@@ -18,10 +36,16 @@ NS_INTERFACE_MAP_END_INHERITING(AuthenticatorResponse)
1836
1937AuthenticatorAssertionResponse::AuthenticatorAssertionResponse (nsPIDOMWindowInner* aParent)
2038 : AuthenticatorResponse(aParent)
21- {}
39+ , mAuthenticatorDataCachedObj (nullptr )
40+ , mSignatureCachedObj (nullptr )
41+ {
42+ mozilla::HoldJSObjects (this );
43+ }
2244
2345AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse ()
24- {}
46+ {
47+ mozilla::DropJSObjects (this );
48+ }
2549
2650JSObject*
2751AuthenticatorAssertionResponse::WrapObject (JSContext* aCx,
@@ -32,9 +56,12 @@ AuthenticatorAssertionResponse::WrapObject(JSContext* aCx,
3256
3357void
3458AuthenticatorAssertionResponse::GetAuthenticatorData (JSContext* aCx,
35- JS::MutableHandle<JSObject*> aRetVal) const
59+ JS::MutableHandle<JSObject*> aRetVal)
3660{
37- aRetVal.set (mAuthenticatorData .ToUint8Array (aCx));
61+ if (!mAuthenticatorDataCachedObj ) {
62+ mAuthenticatorDataCachedObj = mAuthenticatorData .ToUint8Array (aCx);
63+ }
64+ aRetVal.set (mAuthenticatorDataCachedObj );
3865}
3966
4067nsresult
@@ -48,9 +75,12 @@ AuthenticatorAssertionResponse::SetAuthenticatorData(CryptoBuffer& aBuffer)
4875
4976void
5077AuthenticatorAssertionResponse::GetSignature (JSContext* aCx,
51- JS::MutableHandle<JSObject*> aRetVal) const
78+ JS::MutableHandle<JSObject*> aRetVal)
5279{
53- aRetVal.set (mSignature .ToUint8Array (aCx));
80+ if (!mSignatureCachedObj ) {
81+ mSignatureCachedObj = mSignature .ToUint8Array (aCx);
82+ }
83+ aRetVal.set (mSignatureCachedObj );
5484}
5585
5686nsresult
0 commit comments