mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1850843 - Keeping doing nothing for NotificationWorkerRunnable when the worker is dying. r=dom-worker-reviewers,smaug a=pascalc
Differential Revision: https://phabricator.services.mozilla.com/D187433
This commit is contained in:
parent
7af79efedd
commit
73d506b255
@ -321,7 +321,14 @@ class NotificationWorkerRunnable : public MainThreadWorkerRunnable {
|
||||
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
|
||||
aWorkerPrivate->AssertIsOnWorkerThread();
|
||||
aWorkerPrivate->ModifyBusyCountFromWorker(true);
|
||||
WorkerRunInternal(aWorkerPrivate);
|
||||
// WorkerScope might start dying at the moment. And WorkerRunInternal()
|
||||
// should not be executed once WorkerScope is dying, since
|
||||
// WorkerRunInternal() might access resources which already been freed
|
||||
// during WorkerRef::Notify().
|
||||
if (aWorkerPrivate->GlobalScope() &&
|
||||
!aWorkerPrivate->GlobalScope()->IsDying()) {
|
||||
WorkerRunInternal(aWorkerPrivate);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -360,6 +367,18 @@ class ReleaseNotificationRunnable final : public NotificationWorkerRunnable {
|
||||
: NotificationWorkerRunnable(aNotification->mWorkerPrivate),
|
||||
mNotification(aNotification) {}
|
||||
|
||||
bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override {
|
||||
aWorkerPrivate->AssertIsOnWorkerThread();
|
||||
aWorkerPrivate->ModifyBusyCountFromWorker(true);
|
||||
// ReleaseNotificationRunnable is only used in StrongWorkerRef's shutdown
|
||||
// callback. At the moment, it is supposed to executing
|
||||
// mNotification->ReleaseObject() safely even though the corresponding
|
||||
// WorkerScope::IsDying() is true. It is unlike other
|
||||
// NotificationWorkerRunnable.
|
||||
WorkerRunInternal(aWorkerPrivate);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorkerRunInternal(WorkerPrivate* aWorkerPrivate) override {
|
||||
mNotification->ReleaseObject();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user