Bug 1968427 - Adding a null checking on WorkerPrivate::GlobalScope() in ServiceWorkerOpRunnable. a=diannaS
WorkerPrivate's GlobalScope is created during CompileScriptRunnable::WorkerRun. However, the creation could fail when there is an OOM issue during the WebIDL bindings. Although the Worker will start the shutdown as soon as possible, there is still a chance that some WorkerRunnable had already been dispatched to the Worker. And there is no guarantee that there is a GlobalScope for the WorkerRunnable. Unfortunately, WorkerRunnable should check the GlobalScope existence by itself, because not every WorkerRunnable needs the GlobalScope to perform its functionality. This patch only does the null checking for the ServiceWorkerOpRunnable, since ServiceWorkerOpRunnable are supposed to dispatching an event to the corresponding ServiceWorkerGlobalScope. Original Revision: https://phabricator.services.mozilla.com/D254659 Differential Revision: https://phabricator.services.mozilla.com/D258725
This commit is contained in:
committed by
dsmith@mozilla.com
parent
b48f6f4035
commit
6dbb975108
@@ -303,7 +303,10 @@ class ServiceWorkerOp::ServiceWorkerOpRunnable final
|
||||
MOZ_ASSERT(aWorkerPrivate->IsServiceWorker());
|
||||
MOZ_ASSERT(mOwner);
|
||||
|
||||
if (aWorkerPrivate->GlobalScope()->IsDying()) {
|
||||
// GlobalScope could be nullptr here that OOM issue causes GlobalScope
|
||||
// creation fail.
|
||||
if (!aWorkerPrivate->GlobalScope() ||
|
||||
aWorkerPrivate->GlobalScope()->IsDying()) {
|
||||
Unused << Cancel();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user