bug 1114882 - allow nsICryptoHash to be used in a content process r=mayhemer

This commit is contained in:
David Keeler 2015-01-16 11:59:25 -08:00
Родитель d942d61753
Коммит 11cb332d1e
5 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -157,6 +157,7 @@ bool EnsureNSSInitialized(EnsureNSSOperator op)
// call do_GetService for nss component to ensure it.
case nssEnsure:
case nssEnsureOnChromeOnly:
case nssEnsureChromeOrContent:
// We are reentered during nss component creation or nss component is already up
if (PR_AtomicAdd(&haveLoaded, 0) || loading)
return true;

Просмотреть файл

@ -55,7 +55,8 @@ enum EnsureNSSOperator
nssInitFailed = 2,
nssShutdown = 3,
nssEnsure = 100,
nssEnsureOnChromeOnly = 101
nssEnsureOnChromeOnly = 101,
nssEnsureChromeOrContent = 102,
};
extern bool EnsureNSSInitializedChromeOrContent();

Просмотреть файл

@ -93,8 +93,14 @@ _InstanceClassChrome##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return rv; \
} \
\
if (!EnsureNSSInitialized(ensureOperator)) \
if (!NS_IS_PROCESS_DEFAULT && \
ensureOperator == nssEnsureChromeOrContent) { \
if (!EnsureNSSInitializedChromeOrContent()) { \
return NS_ERROR_FAILURE; \
} \
} else if (!EnsureNSSInitialized(ensureOperator)) { \
return NS_ERROR_FAILURE; \
} \
\
if (NS_IS_PROCESS_DEFAULT) \
NS_NSS_INSTANTIATE(ensureOperator, _InstanceClassChrome); \
@ -193,7 +199,7 @@ NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCertTree)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsPkcs11)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCertPicker)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nssEnsure, nsNTLMAuthModule, InitTest)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCryptoHash)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsureChromeOrContent, nsCryptoHash)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsCryptoHMAC)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsStreamCipher)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsKeyObject)

Просмотреть файл

@ -0,0 +1,3 @@
function run_test() {
run_test_in_child("test_hash_algorithms.js");
}

Просмотреть файл

@ -22,6 +22,9 @@ support-files =
[test_datasignatureverifier.js]
[test_hash_algorithms.js]
[test_hash_algorithms_wrap.js]
# bug 1124289 - run_test_in_child violates the sandbox on b2g and android
skip-if = toolkit == 'android' || toolkit == 'gonk'
[test_hmac.js]
[test_sts_preloadlist_perwindowpb.js]