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>
This commit is contained in:
Martin Robinson 2025-01-07 04:36:39 +01:00 committed by GitHub
parent d252a631d2
commit fe8a22b72c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 628 additions and 571 deletions

View file

@ -73,7 +73,7 @@ use crate::dom::xmlhttprequestupload::XMLHttpRequestUpload;
use crate::fetch::FetchCanceller;
use crate::network_listener::{self, PreInvoke, ResourceTimingListener};
use crate::script_runtime::{CanGc, JSContext};
use crate::task_source::{TaskSource, TaskSourceName};
use crate::task_source::{SendableTaskSource, TaskSourceName};
use crate::timers::{OneshotTimerCallback, OneshotTimerHandle};
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
@ -294,7 +294,7 @@ impl XMLHttpRequest {
fn initiate_async_xhr(
context: Arc<Mutex<XHRContext>>,
task_source: TaskSource,
task_source: SendableTaskSource,
global: &GlobalScope,
init: RequestBuilder,
cancellation_chan: ipc::IpcReceiver<()>,
@ -1562,7 +1562,7 @@ impl XMLHttpRequest {
let (task_source, script_port) = if self.sync.get() {
let (sender, receiver) = global.new_script_pair();
(
TaskSource {
SendableTaskSource {
sender,
pipeline_id: global.pipeline_id(),
name: TaskSourceName::Networking,
@ -1571,7 +1571,10 @@ impl XMLHttpRequest {
Some(receiver),
)
} else {
(global.task_manager().networking_task_source(), None)
(
global.task_manager().networking_task_source().to_sendable(),
None,
)
};
let cancel_receiver = self.canceller.borrow_mut().initialize();