aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/util/task.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2014-04-21 12:24:03 -0400
committerJosh Matthews <josh@joshmatthews.net>2014-04-24 01:07:52 -0400
commitbe2b983ec199f63f3f6011e1a94b19d517ccda4f (patch)
tree2ea1709cf400a1d1b00a75a5927b6f93677333af /src/components/util/task.rs
parent3fc2c119103ce743bda53d1ef25c360bc6c713a7 (diff)
downloadservo-be2b983ec199f63f3f6011e1a94b19d517ccda4f.tar.gz
servo-be2b983ec199f63f3f6011e1a94b19d517ccda4f.zip
Make the I Tried star appear when a top-level page load fails for network-related reasons.
Under the hood, this requires treating the I Tried pipeline as a new load instead of a replacement, since the failure-handling code interacts poorly with the rest of the replacement code when we get a series of staggered failures over time from the various pipeline components.
Diffstat (limited to 'src/components/util/task.rs')
-rw-r--r--src/components/util/task.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/util/task.rs b/src/components/util/task.rs
index 8500649370d..ec12b1eaf58 100644
--- a/src/components/util/task.rs
+++ b/src/components/util/task.rs
@@ -16,10 +16,15 @@ pub fn spawn_named<S: IntoMaybeOwned<'static>>(name: S, f: proc()) {
/// this `TaskBuilder` fails.
pub fn send_on_failure<T: Send>(builder: &mut TaskBuilder, msg: T, dest: Sender<T>) {
let port = builder.future_result();
- spawn(proc() {
+ let watched_name = builder.opts.name.as_ref().unwrap().as_slice().to_owned();
+ let name = format!("{:s}Watcher", watched_name);
+ spawn_named(name, proc() {
match port.recv() {
Ok(()) => (),
- Err(..) => dest.send(msg),
+ Err(..) => {
+ debug!("{:s} failed, notifying constellation", watched_name);
+ dest.send(msg);
+ }
}
})
}