Add task source for media element

This commit is contained in:
chansuke 2018-09-09 22:21:35 +09:00
parent 7a88a2e28a
commit 7b3cf27c69
5 changed files with 82 additions and 14 deletions

View file

@ -278,7 +278,8 @@ impl HTMLMediaElement {
let state = self.ready_state.get();
let window = window_from_node(self);
let task_source = window.dom_manipulation_task_source();
// FIXME(nox): Why are errors silenced here?
let task_source = window.media_element_task_source();
if self.Paused() {
// Step 6.1.
self.paused.set(false);
@ -356,9 +357,7 @@ impl HTMLMediaElement {
let window = window_from_node(self);
let this = Trusted::new(self);
let generation_id = self.generation_id.get();
// FIXME(nox): Why are errors silenced here?
// FIXME(nox): Media element event task source should be used here.
let _ = window.dom_manipulation_task_source().queue(
let _ = window.media_element_task_source().queue(
task!(internal_pause_steps: move || {
let this = this.root();
if generation_id != this.generation_id.get() {
@ -400,8 +399,7 @@ impl HTMLMediaElement {
let this = Trusted::new(self);
let generation_id = self.generation_id.get();
// FIXME(nox): Why are errors silenced here?
// FIXME(nox): Media element event task source should be used here.
let _ = window.dom_manipulation_task_source().queue(
let _ = window.media_element_task_source().queue(
task!(notify_about_playing: move || {
let this = this.root();
if generation_id != this.generation_id.get() {
@ -435,7 +433,7 @@ impl HTMLMediaElement {
}
let window = window_from_node(self);
let task_source = window.dom_manipulation_task_source();
let task_source = window.media_element_task_source();
// Step 1.
match (old_ready_state, ready_state) {
@ -590,7 +588,7 @@ impl HTMLMediaElement {
// Step 8.
let window = window_from_node(self);
window.dom_manipulation_task_source().queue_simple_event(
window.media_element_task_source().queue_simple_event(
self.upcast(),
atom!("loadstart"),
&window,
@ -667,7 +665,7 @@ impl HTMLMediaElement {
// Step 4.remote.1.2.
let window = window_from_node(self);
window.dom_manipulation_task_source().queue_simple_event(
window.media_element_task_source().queue_simple_event(
self.upcast(),
atom!("suspend"),
&window,
@ -676,7 +674,7 @@ impl HTMLMediaElement {
// Step 4.remote.1.3.
let this = Trusted::new(self);
window
.dom_manipulation_task_source()
.media_element_task_source()
.queue(
task!(set_media_delay_load_event_flag_to_false: move || {
this.root().delay_load_event(false);
@ -755,8 +753,7 @@ impl HTMLMediaElement {
let generation_id = self.generation_id.get();
self.take_pending_play_promises(Err(Error::NotSupported));
// FIXME(nox): Why are errors silenced here?
// FIXME(nox): Media element event task source should be used here.
let _ = window.dom_manipulation_task_source().queue(
let _ = window.media_element_task_source().queue(
task!(dedicated_media_source_failure_steps: move || {
let this = this.root();
if generation_id != this.generation_id.get() {
@ -813,7 +810,7 @@ impl HTMLMediaElement {
}
let window = window_from_node(self);
let task_source = window.dom_manipulation_task_source();
let task_source = window.media_element_task_source();
// Step 5.
let network_state = self.network_state.get();
@ -1291,7 +1288,7 @@ impl FetchResponseListener for HTMLMediaElementContext {
// => "If mode is remote" step 2
if time::get_time() > self.next_progress_event {
let window = window_from_node(&*elem);
window.dom_manipulation_task_source().queue_simple_event(
window.media_element_task_source().queue_simple_event(
elem.upcast(),
atom!("progress"),
&window,