mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 842818 - Allow calling WebCryptoTask::DispatchWithPromise() from workers r=keeler
This commit is contained in:
parent
63c7f51d31
commit
3d8c7dabb0
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user