Bug 1811195 - Bail out on AppShutdownConfirmed in SharedWorkerManager::MaybeCreateRemoteWorker and BackgroundParentImpl::AllocPRemoteWorkerControllerParent r=dom-worker-reviewers,smaug

Differential Revision: https://phabricator.services.mozilla.com/D167565
This commit is contained in:
Jens Stutte 2023-01-24 11:22:53 +00:00
Родитель e68a40e22c
Коммит c115ea4556
4 изменённых файлов: 14 добавлений и 0 удалений

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

@ -45,6 +45,7 @@ already_AddRefed<RemoteWorkerController> RemoteWorkerController::Create(
RefPtr<RemoteWorkerManager> manager = RemoteWorkerManager::GetOrCreate();
MOZ_ASSERT(manager);
// XXX: We do not check for failure here, should we?
manager->Launch(controller, aData, aProcessId);
return controller.forget();

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

@ -419,6 +419,7 @@ void RemoteWorkerManager::Launch(RemoteWorkerController* aController,
pending->mController = aController;
pending->mData = aData;
// XXX: We do not check for failure here, should we?
LaunchNewContentProcess(aData);
return;
}

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

@ -63,6 +63,12 @@ bool SharedWorkerManager::MaybeCreateRemoteWorker(
UniqueMessagePortId& aPortIdentifier, base::ProcessId aProcessId) {
::mozilla::ipc::AssertIsOnBackgroundThread();
// Creating remote workers may result in creating new processes, but during
// parent shutdown that would add just noise, so better bail out.
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return false;
}
if (!mRemoteWorkerController) {
mRemoteWorkerController =
RemoteWorkerController::Create(aData, this, aProcessId);

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

@ -544,6 +544,12 @@ bool BackgroundParentImpl::DeallocPRemoteWorkerParent(
dom::PRemoteWorkerControllerParent*
BackgroundParentImpl::AllocPRemoteWorkerControllerParent(
const dom::RemoteWorkerData& aRemoteWorkerData) {
// Creating RemoteWorkerController may result in creating new processes,
// but during parent shutdown that would add just noise, so better bail out.
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
return nullptr;
}
RefPtr<dom::RemoteWorkerControllerParent> actor =
new dom::RemoteWorkerControllerParent(aRemoteWorkerData);
return actor.forget().take();