mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Report panics in web worker threads.
This commit is contained in:
parent
aa8c835d3b
commit
1ebe681d8d
7 changed files with 42 additions and 12 deletions
|
@ -36,8 +36,7 @@ use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use url::Url;
|
||||
use util::str::DOMString;
|
||||
use util::thread::spawn_named;
|
||||
use util::thread_state;
|
||||
use util::thread::spawn_named_with_send_on_panic;
|
||||
use util::thread_state::{IN_WORKER, SCRIPT};
|
||||
|
||||
/// Messages used to control the worker event loops
|
||||
|
@ -218,9 +217,9 @@ impl DedicatedWorkerGlobalScope {
|
|||
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>) {
|
||||
let serialized_worker_url = worker_url.to_string();
|
||||
spawn_named(format!("WebWorker for {}", serialized_worker_url), move || {
|
||||
thread_state::initialize(SCRIPT | IN_WORKER);
|
||||
|
||||
let name = format!("WebWorker for {}", serialized_worker_url);
|
||||
let panic_chan = init.panic_chan.clone();
|
||||
spawn_named_with_send_on_panic(name, SCRIPT | IN_WORKER, move || {
|
||||
let roots = RootCollection::new();
|
||||
let _stack_roots_tls = StackRootTLS::new(&roots);
|
||||
|
||||
|
@ -284,7 +283,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
global.handle_event(event);
|
||||
}
|
||||
}, reporter_name, parent_sender, CommonScriptMsg::CollectReports);
|
||||
});
|
||||
}, Some(id.clone()), panic_chan);
|
||||
}
|
||||
|
||||
pub fn script_chan(&self) -> Box<ScriptChan + Send> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue