Bug 914353 - Use the new window.crypto implementation in e10s. r=khuey

This commit is contained in:
Tom Schuster 2013-09-17 12:54:34 -04:00
parent d2564b10a0
commit 3f1f05810b
3 changed files with 99 additions and 17 deletions

View File

@ -128,6 +128,85 @@ Crypto::SetEnableSmartCardEvents(bool aEnableSmartCardEvents)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
bool
Crypto::EnableSmartCardEvents()
{
return false;
}
void
Crypto::SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::GetVersion(nsString& aVersion)
{
}
already_AddRefed<nsIDOMCRMFObject>
Crypto::GenerateCRMFRequest(JSContext* aContext,
const nsCString& aReqDN,
const nsCString& aRegToken,
const nsCString& aAuthenticator,
const nsCString& aEaCert,
const nsCString& aJsCallback,
const Sequence<JS::Value>& aArgs,
ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
return nullptr;
}
void
Crypto::ImportUserCertificates(const nsAString& aNickname,
const nsAString& aCmmfResponse,
bool aDoForcedBackup,
nsAString& aReturn,
ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::PopChallengeResponse(const nsAString& aChallenge,
nsAString& aReturn,
ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::Random(int32_t aNumBytes, nsAString& aReturn, ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::SignText(JSContext* aContext,
const nsAString& aStringToSign,
const nsAString& aCaOption,
const Sequence<nsCString>& aArgs,
nsAString& aReturn)
{
aReturn.AssignLiteral("error:internalError");
}
void
Crypto::Logout(ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
void
Crypto::DisableRightClick(ErrorResult& aRv)
{
aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
}
#endif
/* static */ uint8_t*

View File

@ -41,10 +41,10 @@ public:
ErrorResult& aRv);
#ifndef MOZ_DISABLE_CRYPTOLEGACY
virtual bool EnableSmartCardEvents() = 0;
virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv) = 0;
virtual bool EnableSmartCardEvents();
virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv);
virtual void GetVersion(nsString& aVersion) = 0;
virtual void GetVersion(nsString& aVersion);
virtual already_AddRefed<nsIDOMCRMFObject>
GenerateCRMFRequest(JSContext* aContext,
@ -54,29 +54,29 @@ public:
const nsCString& aEaCert,
const nsCString& aJsCallback,
const Sequence<JS::Value>& aArgs,
ErrorResult& aRv) = 0;
ErrorResult& aRv);
virtual void ImportUserCertificates(const nsAString& aNickname,
const nsAString& aCmmfResponse,
bool aDoForcedBackup,
nsAString& aReturn,
ErrorResult& aRv) = 0;
ErrorResult& aRv);
virtual void PopChallengeResponse(const nsAString& aChallenge,
nsAString& aReturn,
ErrorResult& aRv) = 0;
ErrorResult& aRv);
virtual void Random(int32_t aNumBytes, nsAString& aReturn, ErrorResult& aRv) = 0;
virtual void Random(int32_t aNumBytes, nsAString& aReturn, ErrorResult& aRv);
virtual void SignText(JSContext* aContext,
const nsAString& aStringToSign,
const nsAString& aCaOption,
const Sequence<nsCString>& aArgs,
nsAString& aReturn) = 0;
nsAString& aReturn);
virtual void Logout(ErrorResult& aRv) = 0;
virtual void Logout(ErrorResult& aRv);
virtual void DisableRightClick(ErrorResult& aRv) = 0;
virtual void DisableRightClick(ErrorResult& aRv);
#endif
// WebIDL

View File

@ -78,9 +78,8 @@
#include "nsIDocShell.h"
#include "nsIDocCharset.h"
#include "nsIDocument.h"
#ifdef MOZ_DISABLE_CRYPTOLEGACY
#include "Crypto.h"
#else
#ifndef MOZ_DISABLE_CRYPTOLEGACY
#include "nsIDOMCryptoLegacy.h"
#endif
#include "nsIDOMDocument.h"
@ -3857,12 +3856,16 @@ nsGlobalWindow::GetCrypto(nsIDOMCrypto** aCrypto)
if (!mCrypto) {
#ifndef MOZ_DISABLE_CRYPTOLEGACY
nsresult rv;
mCrypto = do_CreateInstance(NS_CRYPTO_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
#else
mCrypto = new Crypto();
if (XRE_GetProcessType() != GeckoProcessType_Content) {
nsresult rv;
mCrypto = do_CreateInstance(NS_CRYPTO_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
} else
#endif
{
mCrypto = new Crypto();
}
mCrypto->Init(this);
}
NS_IF_ADDREF(*aCrypto = mCrypto);