summaryrefslogtreecommitdiffstats
path: root/dom/webscheduling/WebTaskSchedulerWorker.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
commitfcea19dfd2c426bac0456da850e7c12258e4b9eb (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /dom/webscheduling/WebTaskSchedulerWorker.cpp
parentAdding upstream version 115.7.0esr. (diff)
downloadfirefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.tar.xz
firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/webscheduling/WebTaskSchedulerWorker.cpp')
-rw-r--r--dom/webscheduling/WebTaskSchedulerWorker.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/dom/webscheduling/WebTaskSchedulerWorker.cpp b/dom/webscheduling/WebTaskSchedulerWorker.cpp
index 89fbb6169f..479d12cf7b 100644
--- a/dom/webscheduling/WebTaskSchedulerWorker.cpp
+++ b/dom/webscheduling/WebTaskSchedulerWorker.cpp
@@ -36,6 +36,9 @@ bool WebTaskWorkerRunnable::WorkerRun(JSContext* aCx,
nsresult WebTaskSchedulerWorker::SetTimeoutForDelayedTask(WebTask* aTask,
uint64_t aDelay) {
+ if (!mWorkerPrivate) {
+ return NS_ERROR_UNEXPECTED;
+ }
JSContext* cx = nsContentUtils::GetCurrentJSContext();
if (!cx) {
return NS_ERROR_UNEXPECTED;
@@ -52,8 +55,18 @@ nsresult WebTaskSchedulerWorker::SetTimeoutForDelayedTask(WebTask* aTask,
}
bool WebTaskSchedulerWorker::DispatchEventLoopRunnable() {
+ if (!mWorkerPrivate) {
+ return false;
+ }
RefPtr<WebTaskWorkerRunnable> runnable =
new WebTaskWorkerRunnable(mWorkerPrivate, this);
return runnable->Dispatch();
}
+
+void WebTaskSchedulerWorker::Disconnect() {
+ if (mWorkerPrivate) {
+ mWorkerPrivate = nullptr;
+ }
+ WebTaskScheduler::Disconnect();
+}
} // namespace mozilla::dom