aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-02-21 12:51:44 -0700
committerbors-servo <metajack+bors@gmail.com>2015-02-21 12:51:44 -0700
commitf1f826544919b4fa7cdf4bf263abf0c0c1497f70 (patch)
treef80ddaf5eccc7c96c8c5e95172cc794573ec7e92 /components/script/script_task.rs
parent939b13f436d2fc895cf8a57140b0bd50acc53a89 (diff)
parentcc487979994ec637a3d37f9a3e5edb4a56e7a379 (diff)
downloadservo-f1f826544919b4fa7cdf4bf263abf0c0c1497f70.tar.gz
servo-f1f826544919b4fa7cdf4bf263abf0c0c1497f70.zip
auto merge of #4956 : psdh/servo/interfail, r=jdm
Fixes #4923
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index f63bd70abbf..f29e5690cf5 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -84,6 +84,7 @@ use std::fmt::{self, Display};
use std::mem::replace;
use std::num::ToPrimitive;
use std::rc::Rc;
+use std::result::Result;
use std::sync::mpsc::{channel, Sender, Receiver, Select};
use std::u32;
use time::{Tm, strptime};
@@ -133,7 +134,7 @@ pub enum ScriptMsg {
/// A cloneable interface for communicating with an event loop.
pub trait ScriptChan {
/// Send a message to the associated event loop.
- fn send(&self, msg: ScriptMsg);
+ fn send(&self, msg: ScriptMsg) -> Result<(), ()>;
/// Clone this handle.
fn clone(&self) -> Box<ScriptChan+Send>;
}
@@ -143,9 +144,9 @@ pub trait ScriptChan {
pub struct NonWorkerScriptChan(pub Sender<ScriptMsg>);
impl ScriptChan for NonWorkerScriptChan {
- fn send(&self, msg: ScriptMsg) {
+ fn send(&self, msg: ScriptMsg) -> Result<(), ()> {
let NonWorkerScriptChan(ref chan) = *self;
- chan.send(msg).unwrap();
+ return chan.send(msg).map_err(|_| ());
}
fn clone(&self) -> Box<ScriptChan+Send> {
@@ -893,7 +894,7 @@ impl ScriptTask {
// https://html.spec.whatwg.org/multipage/#the-end step 4
let addr: Trusted<Document> = Trusted::new(self.get_cx(), document.r(), self.chan.clone());
let handler = Box::new(DocumentProgressHandler::new(addr.clone(), DocumentProgressTask::DOMContentLoaded));
- self.chan.send(ScriptMsg::RunnableMsg(handler));
+ self.chan.send(ScriptMsg::RunnableMsg(handler)).unwrap();
// We have no concept of a document loader right now, so just dispatch the
// "load" event as soon as we've finished executing all scripts parsed during
@@ -901,7 +902,7 @@ impl ScriptTask {
// https://html.spec.whatwg.org/multipage/#the-end step 7
let handler = Box::new(DocumentProgressHandler::new(addr, DocumentProgressTask::Load));
- self.chan.send(ScriptMsg::RunnableMsg(handler));
+ self.chan.send(ScriptMsg::RunnableMsg(handler)).unwrap();
*page.fragment_name.borrow_mut() = final_url.fragment.clone();