Ensure JS runnables are dispatched to a worker's event loop instead of its parent.

This commit is contained in:
Josh Matthews 2019-11-22 13:07:01 -05:00
parent 1b524ead1e
commit 0f30755522
6 changed files with 12 additions and 271 deletions

View file

@ -347,10 +347,14 @@ impl DedicatedWorkerGlobalScope {
let runtime = unsafe {
if let Some(pipeline_id) = pipeline_id {
new_child_runtime(
parent,
Some(NetworkingTaskSource(parent_sender.clone(), pipeline_id)),
)
let task_source = NetworkingTaskSource(
Box::new(WorkerThreadWorkerChan {
sender: own_sender.clone(),
worker: worker.clone(),
}),
pipeline_id,
);
new_child_runtime(parent, Some(task_source))
} else {
new_child_runtime(parent, None)
}