diff options
author | Martin Robinson <mrobinson@igalia.com> | 2025-01-07 04:36:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-07 03:36:39 +0000 |
commit | fe8a22b72c42296ccbbd5c4f459936ea28c5dee2 (patch) | |
tree | 9749d88dc818a054c204ebbc5dc82878ced68c8d /components/script/script_thread.rs | |
parent | d252a631d292afc492b337c8b32a34b86139f99d (diff) | |
download | servo-fe8a22b72c42296ccbbd5c4f459936ea28c5dee2.tar.gz servo-fe8a22b72c42296ccbbd5c4f459936ea28c5dee2.zip |
script: Unsilence all main thread `TaskQueue` errors (#34849)
No longer hide errors while queueing tasks on the main thread. This
requires creating two types of `TaskSource`s: one for the main thread
and one that can be sent to other threads. This makes queueing a bit
more efficient on the main thread and more importantly, no longer hides
task queue errors.
Fixes #25688.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 18f67c5d86c..b743b8b264f 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -153,7 +153,7 @@ use crate::script_runtime::{ ThreadSafeJSContext, }; use crate::task_queue::TaskQueue; -use crate::task_source::{TaskSource, TaskSourceName}; +use crate::task_source::{SendableTaskSource, TaskSourceName}; use crate::{devtools, webdriver_handlers}; thread_local!(static SCRIPT_THREAD_ROOT: Cell<Option<*const ScriptThread>> = const { Cell::new(None) }); @@ -692,8 +692,7 @@ impl ScriptThread { global .task_manager() .dom_manipulation_task_source() - .queue(task) - .expect("Enqueing navigate js task on the DOM manipulation task source failed"); + .queue(task); } else { if let Some(ref sender) = script_thread.senders.devtools_server_sender { let _ = sender.send(ScriptToDevtoolsControlMsg::Navigate( @@ -902,7 +901,7 @@ impl ScriptThread { let (self_sender, self_receiver) = unbounded(); let self_sender = MainThreadScriptChan(self_sender.clone()); - let runtime = Runtime::new(Some(TaskSource { + let runtime = Runtime::new(Some(SendableTaskSource { sender: self_sender.as_boxed(), pipeline_id: state.id, name: TaskSourceName::Networking, @@ -1410,9 +1409,11 @@ impl ScriptThread { // This task is empty because any new IPC messages in the ScriptThread trigger a // rendering update when animations are not running. let _realm = enter_realm(&*document); - let rendering_task_source = document.window().task_manager().rendering_task_source(); - let _ = - rendering_task_source.queue_unconditionally(task!(update_the_rendering: move || { })); + document + .window() + .task_manager() + .rendering_task_source() + .queue_unconditionally(task!(update_the_rendering: move || { })); } /// Handle incoming messages from other tasks and the task queue. |