mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
d252a631d2
commit
fe8a22b72c
48 changed files with 628 additions and 571 deletions
|
@ -26,7 +26,7 @@ use crate::dom::serviceworker::ServiceWorker;
|
|||
use crate::dom::serviceworkerregistration::ServiceWorkerRegistration;
|
||||
use crate::realms::{enter_realm, InRealm};
|
||||
use crate::script_runtime::CanGc;
|
||||
use crate::task_source::TaskSource;
|
||||
use crate::task_source::SendableTaskSource;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct ServiceWorkerContainer {
|
||||
|
@ -140,10 +140,9 @@ impl ServiceWorkerContainerMethods<crate::DomTypeHolder> for ServiceWorkerContai
|
|||
|
||||
// Setup the callback for reject/resolve of the promise,
|
||||
// from steps running "in-parallel" from here in the serviceworker manager.
|
||||
let task_source = global.task_manager().dom_manipulation_task_source();
|
||||
let mut handler = RegisterJobResultHandler {
|
||||
trusted_promise: Some(TrustedPromise::new(promise.clone())),
|
||||
task_source,
|
||||
task_source: global.task_manager().dom_manipulation_task_source().into(),
|
||||
};
|
||||
|
||||
let (job_result_sender, job_result_receiver) = ipc::channel().expect("ipc channel failure");
|
||||
|
@ -183,7 +182,7 @@ impl ServiceWorkerContainerMethods<crate::DomTypeHolder> for ServiceWorkerContai
|
|||
/// <https://w3c.github.io/ServiceWorker/#register>
|
||||
struct RegisterJobResultHandler {
|
||||
trusted_promise: Option<TrustedPromise>,
|
||||
task_source: TaskSource,
|
||||
task_source: SendableTaskSource,
|
||||
}
|
||||
|
||||
impl RegisterJobResultHandler {
|
||||
|
@ -199,7 +198,7 @@ impl RegisterJobResultHandler {
|
|||
.expect("No promise to resolve for SW Register job.");
|
||||
|
||||
// Step 1
|
||||
let _ = self.task_source.queue(
|
||||
self.task_source.queue(
|
||||
task!(reject_promise_with_security_error: move || {
|
||||
let promise = promise.root();
|
||||
let _ac = enter_realm(&*promise.global());
|
||||
|
@ -224,7 +223,7 @@ impl RegisterJobResultHandler {
|
|||
.expect("No promise to resolve for SW Register job.");
|
||||
|
||||
// Step 1
|
||||
let _ = self.task_source.queue(task!(resolve_promise: move || {
|
||||
self.task_source.queue(task!(resolve_promise: move || {
|
||||
let promise = promise.root();
|
||||
let global = promise.global();
|
||||
let _ac = enter_realm(&*global);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue