aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlimageelement.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2015-10-21 16:42:30 -0400
committerJosh Matthews <josh@joshmatthews.net>2015-11-06 10:41:38 -0500
commit989e80036e078a19003f0e4eb069671b5222c77b (patch)
tree3fe8c22b82bd0521d87b4ef63464406da6555c7a /components/script/dom/htmlimageelement.rs
parent9fea6d2e46dd917f16a5f1ec0f6484e8164c7a3a (diff)
downloadservo-989e80036e078a19003f0e4eb069671b5222c77b.tar.gz
servo-989e80036e078a19003f0e4eb069671b5222c77b.zip
Implement cancellable runnables.
Additionally, make image load events cancellable. Resolves #7731.
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r--components/script/dom/htmlimageelement.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 098938c8285..e05a50e6027 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -110,13 +110,16 @@ impl HTMLImageElement {
let trusted_node = Trusted::new(window.get_cx(), self, window.script_chan());
let (responder_sender, responder_receiver) = ipc::channel().unwrap();
let script_chan = window.script_chan();
+ let wrapper = window.get_runnable_wrapper();
ROUTER.add_route(responder_receiver.to_opaque(), box move |message| {
// Return the image via a message to the script task, which marks the element
// as dirty and triggers a reflow.
let image_response = message.to().unwrap();
- script_chan.send(CommonScriptMsg::RunnableMsg(UpdateReplacedElement,
- box ImageResponseHandlerRunnable::new(
- trusted_node.clone(), image_response))).unwrap();
+ let runnable = ImageResponseHandlerRunnable::new(
+ trusted_node.clone(), image_response);
+ let runnable = wrapper.wrap_runnable(runnable);
+ script_chan.send(CommonScriptMsg::RunnableMsg(
+ UpdateReplacedElement, runnable)).unwrap();
});
image_cache.request_image(img_url,