aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/task_source/rendering.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/task_source/rendering.rs')
-rw-r--r--components/script/task_source/rendering.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/components/script/task_source/rendering.rs b/components/script/task_source/rendering.rs
index 43afa4abb68..0c652add2bb 100644
--- a/components/script/task_source/rendering.rs
+++ b/components/script/task_source/rendering.rs
@@ -43,3 +43,19 @@ impl TaskSource for RenderingTaskSource {
self.0.send(msg_task).map_err(|_| ())
}
}
+
+impl RenderingTaskSource {
+ /// This queues a task that will not be cancelled when its associated
+ /// global scope gets destroyed.
+ pub fn queue_unconditionally<T>(&self, task: T) -> Result<(), ()>
+ where
+ T: TaskOnce + 'static,
+ {
+ self.0.send(CommonScriptMsg::Task(
+ ScriptThreadEventCategory::NetworkEvent,
+ Box::new(task),
+ Some(self.1),
+ RenderingTaskSource::NAME,
+ ))
+ }
+}