Bug 1767214: Avoid executing WorkerMainThreadRunnable::Run late in shutdown. r=dom-worker-reviewers,jesup

Differential Revision: https://phabricator.services.mozilla.com/D145577
This commit is contained in:
Jens Stutte 2022-05-12 16:13:28 +00:00
Родитель 5ccb26922f
Коммит 4b7e774817
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -11,6 +11,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/AppShutdown.h"
#include "mozilla/Assertions.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/ErrorResult.h"
@ -584,6 +585,12 @@ NS_IMETHODIMP
WorkerMainThreadRunnable::Run() {
AssertIsOnMainThread();
// This shouldn't be necessary once we're better about making sure no workers
// are created during shutdown in earlier phases.
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
bool runResult = MainThreadRun();
RefPtr<MainThreadStopSyncLoopRunnable> response =