From 981a809447575ad05418a8cbd491f9922a0100df Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Fri, 7 Aug 2015 14:27:14 +0200 Subject: [PATCH] Bug 1188750 - CryptoKey::ReadStructuredClone() needs to ensure NSS is initialized before trying to deserialize a key r=keeler --- dom/crypto/CryptoKey.cpp | 6 ++++++ dom/crypto/moz.build | 1 + 2 files changed, 7 insertions(+) diff --git a/dom/crypto/CryptoKey.cpp b/dom/crypto/CryptoKey.cpp index de9bd0de6b62..bff113fad7ce 100644 --- a/dom/crypto/CryptoKey.cpp +++ b/dom/crypto/CryptoKey.cpp @@ -6,6 +6,7 @@ #include "pk11pub.h" #include "cryptohi.h" +#include "nsNSSComponent.h" #include "ScopedNSSTypes.h" #include "mozilla/dom/CryptoKey.h" #include "mozilla/dom/WebCryptoCommon.h" @@ -1249,6 +1250,11 @@ CryptoKey::ReadStructuredClone(JSStructuredCloneReader* aReader) return false; } + // Ensure that NSS is initialized. + if (!EnsureNSSInitializedChromeOrContent()) { + return false; + } + uint32_t version; CryptoBuffer sym, priv, pub; diff --git a/dom/crypto/moz.build b/dom/crypto/moz.build index 0299501502db..0d30632a7ba5 100644 --- a/dom/crypto/moz.build +++ b/dom/crypto/moz.build @@ -27,6 +27,7 @@ FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '/security/manager/ssl', + '/security/pkix/include', ] MOCHITEST_MANIFESTS += ['test/mochitest.ini']