diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-17 17:41:42 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-18 02:47:09 +0200 |
commit | 91c2865e36cde4af7e4449493dd0c921c7e4453d (patch) | |
tree | 24ed7d1eb1f1d1e3d23c2ff29249fda50bb3e18a | |
parent | e9f6ea40c25758976e030872879c44726b7b97f2 (diff) | |
download | servo-91c2865e36cde4af7e4449493dd0c921c7e4453d.tar.gz servo-91c2865e36cde4af7e4449493dd0c921c7e4453d.zip |
Use task! for notifying about playing
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index d14afa7ac28..057f0ef0512 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -171,24 +171,21 @@ impl HTMLMediaElement { // TODO(nox): Take pending play promises and let promises be the result. // Step 2. + let target = Trusted::new(self.upcast::<EventTarget>()); let window = window_from_node(self); // FIXME(nox): Why are errors silenced here? let _ = window.dom_manipulation_task_source().queue( - box NotifyAboutPlayingTask(Trusted::new(self.upcast())), - window.upcast(), - ); - struct NotifyAboutPlayingTask(Trusted<EventTarget>); - impl Task for NotifyAboutPlayingTask { - fn run(self: Box<Self>) { - let target = self.0.root(); + box task!(notify_about_playing: move || { + let target = target.root(); // Step 2.1. target.fire_event(atom!("playing")); // Step 2.2. // FIXME(nox): Resolve pending play promises with promises. - } - } + }), + window.upcast(), + ); } // https://html.spec.whatwg.org/multipage/#ready-states |