Bug 842818 - Allow calling WebCryptoTask::DispatchWithPromise() from workers r=keeler

This commit is contained in:
Tim Taubert 2016-01-20 23:19:42 +01:00
parent 63c7f51d31
commit 3d8c7dabb0
2 changed files with 2 additions and 8 deletions

View File

@ -340,7 +340,6 @@ CloneData(JSContext* aCx, CryptoBuffer& aDst, JS::Handle<JSObject*> aSrc)
void
WebCryptoTask::DispatchWithPromise(Promise* aResultPromise)
{
MOZ_ASSERT(NS_IsMainThread());
mResultPromise = aResultPromise;
// Fail if an error was set during the constructor
@ -357,13 +356,6 @@ WebCryptoTask::DispatchWithPromise(Promise* aResultPromise)
return;
}
// Ensure that NSS is initialized, since presumably CalculateResult
// will use NSS functions
if (!EnsureNSSInitializedChromeOrContent()) {
mEarlyRv = NS_ERROR_DOM_UNKNOWN_ERR;
MAYBE_EARLY_FAIL(mEarlyRv)
}
// Store calling thread and dispatch to thread pool.
mOriginalThread = NS_GetCurrentThread();
mEarlyRv = WebCryptoThreadPool::Dispatch(this);

View File

@ -65,6 +65,8 @@ WebCryptoThreadPool::DispatchInternal(nsIRunnable* aRunnable)
MutexAutoLock lock(mMutex);
if (!mPool) {
NS_ENSURE_TRUE(EnsureNSSInitializedChromeOrContent(), NS_ERROR_FAILURE);
nsCOMPtr<nsIThreadPool> pool(do_CreateInstance(NS_THREADPOOL_CONTRACTID));
NS_ENSURE_TRUE(pool, NS_ERROR_FAILURE);