Skip to content

Commit

Permalink
Backed out changeset 536420808253 (bug 1849056) for bustages on Authe…
Browse files Browse the repository at this point in the history
…nticatorResponse.cpp
  • Loading branch information
nbeleuzu committed Aug 17, 2023
1 parent 29d972f commit 9716a0a
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 56 deletions.
26 changes: 7 additions & 19 deletions dom/webauthn/AuthenticatorAssertionResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,11 @@ JSObject* AuthenticatorAssertionResponse::WrapObject(
}

void AuthenticatorAssertionResponse::GetAuthenticatorData(
JSContext* aCx, JS::MutableHandle<JSObject*> aValue, ErrorResult& aRv) {
JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal) {
if (!mAuthenticatorDataCachedObj) {
mAuthenticatorDataCachedObj = mAuthenticatorData.ToArrayBuffer(aCx);
if (!mAuthenticatorDataCachedObj) {
aRv.NoteJSContextException(aCx);
return;
}
}
aValue.set(mAuthenticatorDataCachedObj);
aRetVal.set(mAuthenticatorDataCachedObj);
}

nsresult AuthenticatorAssertionResponse::SetAuthenticatorData(
Expand All @@ -75,15 +71,11 @@ nsresult AuthenticatorAssertionResponse::SetAuthenticatorData(
}

void AuthenticatorAssertionResponse::GetSignature(
JSContext* aCx, JS::MutableHandle<JSObject*> aValue, ErrorResult& aRv) {
JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal) {
if (!mSignatureCachedObj) {
mSignatureCachedObj = mSignature.ToArrayBuffer(aCx);
if (!mSignatureCachedObj) {
aRv.NoteJSContextException(aCx);
return;
}
}
aValue.set(mSignatureCachedObj);
aRetVal.set(mSignatureCachedObj);
}

nsresult AuthenticatorAssertionResponse::SetSignature(CryptoBuffer& aBuffer) {
Expand All @@ -94,21 +86,17 @@ nsresult AuthenticatorAssertionResponse::SetSignature(CryptoBuffer& aBuffer) {
}

void AuthenticatorAssertionResponse::GetUserHandle(
JSContext* aCx, JS::MutableHandle<JSObject*> aValue, ErrorResult& aRv) {
JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal) {
// Per
// https://w3c.github.io/webauthn/#ref-for-dom-authenticatorassertionresponse-userhandle%E2%91%A0
// this should return null if the handle is unset.
if (mUserHandle.IsEmpty()) {
aValue.set(nullptr);
aRetVal.set(nullptr);
} else {
if (!mUserHandleCachedObj) {
mUserHandleCachedObj = mUserHandle.ToArrayBuffer(aCx);
if (!mUserHandleCachedObj) {
aRv.NoteJSContextException(aCx);
return;
}
}
aValue.set(mUserHandleCachedObj);
aRetVal.set(mUserHandleCachedObj);
}
}

Expand Down
10 changes: 4 additions & 6 deletions dom/webauthn/AuthenticatorAssertionResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ class AuthenticatorAssertionResponse final : public AuthenticatorResponse {
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;

void GetAuthenticatorData(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
ErrorResult& aRv);
void GetAuthenticatorData(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetVal);

nsresult SetAuthenticatorData(CryptoBuffer& aBuffer);

void GetSignature(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
ErrorResult& aRv);
void GetSignature(JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal);

nsresult SetSignature(CryptoBuffer& aBuffer);

void GetUserHandle(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
ErrorResult& aRv);
void GetUserHandle(JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal);

nsresult SetUserHandle(CryptoBuffer& aUserHandle);

Expand Down
8 changes: 2 additions & 6 deletions dom/webauthn/AuthenticatorAttestationResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,11 @@ JSObject* AuthenticatorAttestationResponse::WrapObject(
}

void AuthenticatorAttestationResponse::GetAttestationObject(
JSContext* aCx, JS::MutableHandle<JSObject*> aValue, ErrorResult& aRv) {
JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal) {
if (!mAttestationObjectCachedObj) {
mAttestationObjectCachedObj = mAttestationObject.ToArrayBuffer(aCx);
if (!mAttestationObjectCachedObj) {
aRv.NoteJSContextException(aCx);
return;
}
}
aValue.set(mAttestationObjectCachedObj);
aRetVal.set(mAttestationObjectCachedObj);
}

nsresult AuthenticatorAttestationResponse::SetAttestationObject(
Expand Down
4 changes: 2 additions & 2 deletions dom/webauthn/AuthenticatorAttestationResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class AuthenticatorAttestationResponse final : public AuthenticatorResponse {
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;

void GetAttestationObject(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
ErrorResult& aRv);
void GetAttestationObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetVal);

nsresult SetAttestationObject(CryptoBuffer& aBuffer);

Expand Down
8 changes: 2 additions & 6 deletions dom/webauthn/AuthenticatorResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ AuthenticatorResponse::~AuthenticatorResponse() {
nsISupports* AuthenticatorResponse::GetParentObject() const { return mParent; }

void AuthenticatorResponse::GetClientDataJSON(
JSContext* aCx, JS::MutableHandle<JSObject*> aValue, ErrorResult& aRv) {
JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal) {
if (!mClientDataJSONCachedObj) {
mClientDataJSONCachedObj = mClientDataJSON.ToArrayBuffer(aCx);
if (!mClientDataJSONCachedObj) {
aRv.NoteJSContextException(aCx);
return;
}
}
aValue.set(mClientDataJSONCachedObj);
aRetVal.set(mClientDataJSONCachedObj);
}

nsresult AuthenticatorResponse::SetClientDataJSON(CryptoBuffer& aBuffer) {
Expand Down
3 changes: 1 addition & 2 deletions dom/webauthn/AuthenticatorResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class AuthenticatorResponse : public nsISupports, public nsWrapperCache {

void GetFormat(nsString& aRetVal) const;

void GetClientDataJSON(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
ErrorResult& aRv);
void GetClientDataJSON(JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal);

nsresult SetClientDataJSON(CryptoBuffer& aBuffer);

Expand Down
9 changes: 2 additions & 7 deletions dom/webauthn/PublicKeyCredential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,11 @@ JSObject* PublicKeyCredential::WrapObject(JSContext* aCx,
}

void PublicKeyCredential::GetRawId(JSContext* aCx,
JS::MutableHandle<JSObject*> aValue,
ErrorResult& aRv) {
JS::MutableHandle<JSObject*> aRetVal) {
if (!mRawIdCachedObj) {
mRawIdCachedObj = mRawId.ToArrayBuffer(aCx);
if (!mRawIdCachedObj) {
aRv.NoteJSContextException(aCx);
return;
}
}
aValue.set(mRawIdCachedObj);
aRetVal.set(mRawIdCachedObj);
}

already_AddRefed<AuthenticatorResponse> PublicKeyCredential::Response() const {
Expand Down
3 changes: 1 addition & 2 deletions dom/webauthn/PublicKeyCredential.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class PublicKeyCredential final : public Credential {
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;

void GetRawId(JSContext* aCx, JS::MutableHandle<JSObject*> aValue,
ErrorResult& aRv);
void GetRawId(JSContext* cx, JS::MutableHandle<JSObject*> aRetVal);

already_AddRefed<AuthenticatorResponse> Response() const;

Expand Down
12 changes: 6 additions & 6 deletions dom/webidl/WebAuthentication.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[SecureContext, Pref="security.webauth.webauthn",
Exposed=Window]
interface PublicKeyCredential : Credential {
[SameObject, Throws] readonly attribute ArrayBuffer rawId;
[SameObject] readonly attribute ArrayBuffer rawId;
[SameObject] readonly attribute AuthenticatorResponse response;
AuthenticationExtensionsClientOutputs getClientExtensionResults();
};
Expand All @@ -27,21 +27,21 @@ partial interface PublicKeyCredential {
[SecureContext, Pref="security.webauth.webauthn",
Exposed=Window]
interface AuthenticatorResponse {
[SameObject, Throws] readonly attribute ArrayBuffer clientDataJSON;
[SameObject] readonly attribute ArrayBuffer clientDataJSON;
};

[SecureContext, Pref="security.webauth.webauthn",
Exposed=Window]
interface AuthenticatorAttestationResponse : AuthenticatorResponse {
[SameObject, Throws] readonly attribute ArrayBuffer attestationObject;
[SameObject] readonly attribute ArrayBuffer attestationObject;
};

[SecureContext, Pref="security.webauth.webauthn",
Exposed=Window]
interface AuthenticatorAssertionResponse : AuthenticatorResponse {
[SameObject, Throws] readonly attribute ArrayBuffer authenticatorData;
[SameObject, Throws] readonly attribute ArrayBuffer signature;
[SameObject, Throws] readonly attribute ArrayBuffer? userHandle;
[SameObject] readonly attribute ArrayBuffer authenticatorData;
[SameObject] readonly attribute ArrayBuffer signature;
[SameObject] readonly attribute ArrayBuffer? userHandle;
};

dictionary PublicKeyCredentialParameters {
Expand Down

0 comments on commit 9716a0a

Please sign in to comment.