From f905e21a03754e39537bb38e5d736bd7a6a37ff9 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Tue, 8 Jul 2014 13:46:23 -0700 Subject: [PATCH] Bug 1034911 - Make the destructor for KeyAlgorithm private. r=smaug --- dom/crypto/KeyAlgorithm.h | 10 ++-------- dom/crypto/WebCryptoTask.cpp | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/dom/crypto/KeyAlgorithm.h b/dom/crypto/KeyAlgorithm.h index 3b3c4ce18082..4900685ef555 100644 --- a/dom/crypto/KeyAlgorithm.h +++ b/dom/crypto/KeyAlgorithm.h @@ -31,12 +31,6 @@ enum KeyAlgorithmStructuredCloneTags { } -template<> -struct HasDangerousPublicDestructor -{ - static const bool value = true; -}; - namespace dom { class KeyAlgorithm : public nsISupports, @@ -49,8 +43,6 @@ public: public: KeyAlgorithm(nsIGlobalObject* aGlobal, const nsString& aName); - virtual ~KeyAlgorithm(); - nsIGlobalObject* GetParentObject() const { return mGlobal; @@ -72,6 +64,8 @@ public: } protected: + virtual ~KeyAlgorithm(); + nsRefPtr mGlobal; nsString mName; CK_MECHANISM_TYPE mMechanism; diff --git a/dom/crypto/WebCryptoTask.cpp b/dom/crypto/WebCryptoTask.cpp index 8272b972c9d9..a99434348fb7 100644 --- a/dom/crypto/WebCryptoTask.cpp +++ b/dom/crypto/WebCryptoTask.cpp @@ -1167,8 +1167,8 @@ public: if (params.mLength.WasPassed()) { mLength = params.mLength.Value(); } else { - KeyAlgorithm hashAlg(global, hashName); - switch (hashAlg.Mechanism()) { + nsRefPtr hashAlg = new KeyAlgorithm(global, hashName); + switch (hashAlg->Mechanism()) { case CKM_SHA_1: case CKM_SHA256: mLength = 512;