diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index f6f73f08d13c..1c613143fb2d 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -265,7 +265,7 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput, } RefPtr run = new MainThreadFetchRunnable(resolver, r); - MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(run)); + worker->DispatchToMainThread(run.forget()); } return p.forget(); @@ -1032,7 +1032,12 @@ FetchBody::BeginConsumeBody() } nsCOMPtr r = new BeginConsumeBodyRunnable(this); - nsresult rv = NS_DispatchToMainThread(r); + nsresult rv = NS_OK; + if (mWorkerPrivate) { + rv = mWorkerPrivate->DispatchToMainThread(r.forget()); + } else { + rv = NS_DispatchToMainThread(r.forget()); + } if (NS_WARN_IF(NS_FAILED(rv))) { ReleaseObject(); return rv;