Bug 1323339 - Cleanup of WebAuthn DOM classes; r=jcj r=baku
authorKyle Machulis <kyle@nonpolynomial.com>
Thu, 06 Apr 2017 15:30:54 -0700
changeset 357424 af732e8151707cf418564cf07938df261a7e6a36
parent 357423 c092c00a79077379b03ca85e3c5c2fc647ebd9e9
child 357425 abdbe7c77b7c1f37186091aa01e783165fe05128
push id31792
push usercbook@mozilla.com
push dateWed, 10 May 2017 13:07:59 +0000
treeherdermozilla-central@ebbcdaa5b580 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcj, baku
bugs1323339
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1323339 - Cleanup of WebAuthn DOM classes; r=jcj r=baku Changes WebAuthn DOM classes to take nsPIDOMInnerWindow* as parent pointer, instead of WebAuthentication* pointer. MozReview-Commit-ID: aK3k9Cc7hv
dom/webauthn/ScopedCredential.cpp
dom/webauthn/ScopedCredential.h
dom/webauthn/ScopedCredentialInfo.cpp
dom/webauthn/ScopedCredentialInfo.h
dom/webauthn/WebAuthnAssertion.cpp
dom/webauthn/WebAuthnAssertion.h
dom/webauthn/WebAuthnAttestation.cpp
dom/webauthn/WebAuthnAttestation.h
--- a/dom/webauthn/ScopedCredential.cpp
+++ b/dom/webauthn/ScopedCredential.cpp
@@ -14,17 +14,17 @@ namespace dom {
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ScopedCredential, mParent)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(ScopedCredential)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(ScopedCredential)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScopedCredential)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-ScopedCredential::ScopedCredential(WebAuthentication* aParent)
+ScopedCredential::ScopedCredential(nsPIDOMWindowInner* aParent)
   : mParent(aParent)
   , mType(ScopedCredentialType::ScopedCred)
 {}
 
 ScopedCredential::~ScopedCredential()
 {}
 
 JSObject*
--- a/dom/webauthn/ScopedCredential.h
+++ b/dom/webauthn/ScopedCredential.h
@@ -22,23 +22,23 @@ namespace dom {
 class ScopedCredential final : public nsISupports
                              , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ScopedCredential)
 
 public:
-  explicit ScopedCredential(WebAuthentication* aParent);
+  explicit ScopedCredential(nsPIDOMWindowInner* aParent);
 
 protected:
   ~ScopedCredential();
 
 public:
-  WebAuthentication*
+  nsISupports*
   GetParentObject() const
   {
     return mParent;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
@@ -50,17 +50,17 @@ public:
 
   nsresult
   SetType(ScopedCredentialType aType);
 
   nsresult
   SetId(CryptoBuffer& aBuffer);
 
 private:
-  RefPtr<WebAuthentication> mParent;
+  nsCOMPtr<nsPIDOMWindowInner> mParent;
   CryptoBuffer mIdBuffer;
   ScopedCredentialType mType;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_ScopedCredential_h
--- a/dom/webauthn/ScopedCredentialInfo.cpp
+++ b/dom/webauthn/ScopedCredentialInfo.cpp
@@ -14,17 +14,17 @@ namespace dom {
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ScopedCredentialInfo, mParent)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(ScopedCredentialInfo)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(ScopedCredentialInfo)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScopedCredentialInfo)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-ScopedCredentialInfo::ScopedCredentialInfo(WebAuthentication* aParent)
+ScopedCredentialInfo::ScopedCredentialInfo(nsPIDOMWindowInner* aParent)
   : mParent(aParent)
 {}
 
 ScopedCredentialInfo::~ScopedCredentialInfo()
 {}
 
 JSObject*
 ScopedCredentialInfo::WrapObject(JSContext* aCx,
@@ -54,11 +54,10 @@ ScopedCredentialInfo::SetCredential(RefP
 }
 
 void
 ScopedCredentialInfo::SetAttestation(RefPtr<WebAuthnAttestation> aAttestation)
 {
   mAttestation = aAttestation;
 }
 
-
 } // namespace dom
 } // namespace mozilla
--- a/dom/webauthn/ScopedCredentialInfo.h
+++ b/dom/webauthn/ScopedCredentialInfo.h
@@ -30,23 +30,23 @@ namespace dom {
 class ScopedCredentialInfo final : public nsISupports
                                  , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ScopedCredentialInfo)
 
 public:
-  explicit ScopedCredentialInfo(WebAuthentication* aParent);
+  explicit ScopedCredentialInfo(nsPIDOMWindowInner* aParent);
 
 protected:
   ~ScopedCredentialInfo();
 
 public:
-  WebAuthentication*
+  nsISupports*
   GetParentObject() const
   {
     return mParent;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
@@ -58,17 +58,17 @@ public:
 
   void
   SetCredential(RefPtr<ScopedCredential>);
 
   void
   SetAttestation(RefPtr<WebAuthnAttestation>);
 
 private:
-  RefPtr<WebAuthentication> mParent;
+  nsCOMPtr<nsPIDOMWindowInner> mParent;
   RefPtr<WebAuthnAttestation> mAttestation;
   RefPtr<ScopedCredential> mCredential;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_ScopedCredentialInfo_h
--- a/dom/webauthn/WebAuthnAssertion.cpp
+++ b/dom/webauthn/WebAuthnAssertion.cpp
@@ -14,17 +14,17 @@ namespace dom {
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebAuthnAssertion, mParent)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(WebAuthnAssertion)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(WebAuthnAssertion)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebAuthnAssertion)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-WebAuthnAssertion::WebAuthnAssertion(WebAuthentication* aParent)
+WebAuthnAssertion::WebAuthnAssertion(nsPIDOMWindowInner* aParent)
   : mParent(aParent)
 {}
 
 WebAuthnAssertion::~WebAuthnAssertion()
 {}
 
 JSObject*
 WebAuthnAssertion::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
--- a/dom/webauthn/WebAuthnAssertion.h
+++ b/dom/webauthn/WebAuthnAssertion.h
@@ -28,23 +28,23 @@ namespace dom {
 class WebAuthnAssertion final : public nsISupports
                               , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebAuthnAssertion)
 
 public:
-  explicit WebAuthnAssertion(WebAuthentication* aParent);
+  explicit WebAuthnAssertion(nsPIDOMWindowInner* aParent);
 
 protected:
   ~WebAuthnAssertion();
 
 public:
-  WebAuthentication*
+  nsPIDOMWindowInner*
   GetParentObject() const
   {
     return mParent;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
@@ -68,17 +68,17 @@ public:
 
   nsresult
   SetAuthenticatorData(CryptoBuffer& aBuffer);
 
   nsresult
   SetSignature(CryptoBuffer& aBuffer);
 
 private:
-  RefPtr<WebAuthentication> mParent;
+  nsCOMPtr<nsPIDOMWindowInner> mParent;
   RefPtr<ScopedCredential> mCredential;
   CryptoBuffer mAuthenticatorData;
   CryptoBuffer mClientData;
   CryptoBuffer mSignature;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/webauthn/WebAuthnAttestation.cpp
+++ b/dom/webauthn/WebAuthnAttestation.cpp
@@ -14,17 +14,17 @@ namespace dom {
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebAuthnAttestation, mParent)
 NS_IMPL_CYCLE_COLLECTING_ADDREF(WebAuthnAttestation)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(WebAuthnAttestation)
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebAuthnAttestation)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-WebAuthnAttestation::WebAuthnAttestation(WebAuthentication* aParent)
+WebAuthnAttestation::WebAuthnAttestation(nsPIDOMWindowInner* aParent)
   : mParent(aParent)
 {}
 
 WebAuthnAttestation::~WebAuthnAttestation()
 {}
 
 JSObject*
 WebAuthnAttestation::WrapObject(JSContext* aCx,
@@ -52,18 +52,16 @@ WebAuthnAttestation::GetAuthenticatorDat
 {
   aRetVal.set(mAuthenticatorData.ToUint8Array(aCx));
 }
 
 void
 WebAuthnAttestation::GetAttestation(JSContext* aCx,
                                     JS::MutableHandle<JS::Value> aRetVal) const
 {
-  // JS::RootedObject obj(aCx);
-  // obj.set();
   aRetVal.setObject(*mAttestation.ToUint8Array(aCx));
 }
 
 nsresult
 WebAuthnAttestation::SetFormat(nsString aFormat)
 {
   mFormat = aFormat;
   return NS_OK;
--- a/dom/webauthn/WebAuthnAttestation.h
+++ b/dom/webauthn/WebAuthnAttestation.h
@@ -21,23 +21,23 @@ namespace dom {
 class WebAuthnAttestation final : public nsISupports
                                 , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WebAuthnAttestation)
 
 public:
-  explicit WebAuthnAttestation(WebAuthentication* aParent);
+  explicit WebAuthnAttestation(nsPIDOMWindowInner* aParent);
 
 protected:
   ~WebAuthnAttestation();
 
 public:
-  WebAuthentication*
+  nsISupports*
   GetParentObject() const
   {
     return mParent;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
@@ -61,17 +61,17 @@ public:
 
   nsresult
   SetAuthenticatorData(CryptoBuffer& aBuffer);
 
   nsresult
   SetAttestation(CryptoBuffer& aBuffer);
 
 private:
-  RefPtr<WebAuthentication> mParent;
+  nsCOMPtr<nsPIDOMWindowInner> mParent;
   nsString mFormat;
   CryptoBuffer mClientData;
   CryptoBuffer mAuthenticatorData;
   CryptoBuffer mAttestation;
 };
 
 } // namespace dom
 } // namespace mozilla