diff --git a/dom/crypto/CryptoKey.cpp b/dom/crypto/CryptoKey.cpp index de9bd0de6b6..bff113fad7c 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 181fba34282..59381c38370 100644 --- a/dom/crypto/moz.build +++ b/dom/crypto/moz.build @@ -25,6 +25,7 @@ FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '/security/manager/ssl', + '/security/pkix/include', ] MOCHITEST_MANIFESTS += ['test/mochitest.ini']