Bug 1731298: Explicitly check if the worker is running in Exec. r=dom-worker-reviewers,jesup

Differential Revision: https://phabricator.services.mozilla.com/D140302
This commit is contained in:
Jens Stutte 2022-03-04 14:47:02 +00:00
Родитель 015a3aeb12
Коммит db8e331c53
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -936,13 +936,17 @@ class RemoteWorkerChild::SharedWorkerOp : public RemoteWorkerChild::Op {
auto lock = aOwner->mState.Lock();
MOZ_ASSERT(lock->is<Running>() || IsTerminationOp());
if (IsTerminationOp()) {
aOwner->CloseWorkerOnMainThread(lock.ref());
return;
}
MOZ_ASSERT(lock->is<Running>());
if (!lock->is<Running>()) {
aOwner->ErrorPropagationDispatch(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
RefPtr<WorkerPrivate> workerPrivate = lock->as<Running>().mWorkerPrivate;
MOZ_ASSERT(workerPrivate);