[DOM] Drop mWrappedRunnable early in workers.

This should prevent some intermittent crashes.
This commit is contained in:
Moonchild 2023-10-25 18:04:26 +02:00 committed by roytam1
commit aae5866390

View file

@ -241,6 +241,7 @@ private:
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
{
nsresult rv = mWrappedRunnable->Run();
mWrappedRunnable = nullptr;
if (NS_FAILED(rv)) {
if (!JS_IsExceptionPending(aCx)) {
Throw(aCx, rv);
@ -259,6 +260,7 @@ private:
MOZ_ASSERT(cancelable); // We checked this earlier!
rv = cancelable->Cancel();
nsresult rv2 = WorkerRunnable::Cancel();
mWrappedRunnable = nullptr;
return NS_FAILED(rv) ? rv : rv2;
}
};