Make TaskSource::queue take a &GlobalScope

This commit is contained in:
Anthony Ramine 2016-10-04 15:49:48 +02:00
parent 514819f37a
commit 44ca9f3d71
9 changed files with 25 additions and 27 deletions

View file

@ -5,7 +5,6 @@
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding;
use dom::bindings::codegen::Bindings::HTMLDetailsElementBinding::HTMLDetailsElementMethods;
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::refcounted::Trusted;
@ -79,7 +78,7 @@ impl VirtualMethods for HTMLDetailsElement {
element: details,
toggle_number: counter
};
let _ = task_source.queue(runnable, GlobalRef::Window(&window));
let _ = task_source.queue(runnable, window.upcast());
}
}
}

View file

@ -12,7 +12,6 @@ use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMet
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
use dom::bindings::codegen::Bindings::HTMLTextAreaElementBinding::HTMLTextAreaElementMethods;
use dom::bindings::conversions::DerivedFrom;
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
use dom::bindings::js::{JS, MutNullableHeap, Root};
use dom::bindings::refcounted::Trusted;
@ -444,7 +443,7 @@ impl HTMLFormElement {
};
// Step 3
window.dom_manipulation_task_source().queue(nav, GlobalRef::Window(&window)).unwrap();
window.dom_manipulation_task_source().queue(nav, window.upcast()).unwrap();
}
/// Interactively validate the constraints of form elements

View file

@ -9,7 +9,6 @@ use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{LayoutJS, Root};
use dom::bindings::refcounted::Trusted;
@ -192,7 +191,7 @@ impl HTMLImageElement {
src: src.into(),
};
let task = window.dom_manipulation_task_source();
let _ = task.queue(runnable, GlobalRef::Window(window));
let _ = task.queue(runnable, window.upcast());
}
}
}

View file

@ -12,7 +12,6 @@ use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementC
use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementMethods;
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorConstants::*;
use dom::bindings::codegen::Bindings::MediaErrorBinding::MediaErrorMethods;
use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, MutNullableHeap, JS};
use dom::bindings::refcounted::Trusted;
@ -276,7 +275,7 @@ impl HTMLMediaElement {
elem: Trusted::new(self),
};
let win = window_from_node(self);
let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
let _ = win.dom_manipulation_task_source().queue(task, win.upcast());
}
// https://html.spec.whatwg.org/multipage/#internal-pause-steps step 2.2
@ -300,13 +299,13 @@ impl HTMLMediaElement {
elem: Trusted::new(self),
};
let win = window_from_node(self);
let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
let _ = win.dom_manipulation_task_source().queue(task, win.upcast());
}
fn queue_fire_simple_event(&self, type_: &'static str) {
let win = window_from_node(self);
let task = box FireSimpleEventTask::new(self, type_);
let _ = win.dom_manipulation_task_source().queue(task, GlobalRef::Window(&win));
let _ = win.dom_manipulation_task_source().queue(task, win.upcast());
}
fn fire_simple_event(&self, type_: &str) {
@ -533,8 +532,8 @@ impl HTMLMediaElement {
fn queue_dedicated_media_source_failure_steps(&self) {
let window = window_from_node(self);
let _ = window.dom_manipulation_task_source().queue(box DedicatedMediaSourceFailureTask::new(self),
GlobalRef::Window(&window));
let _ = window.dom_manipulation_task_source().queue(
box DedicatedMediaSourceFailureTask::new(self), window.upcast());
}
// https://html.spec.whatwg.org/multipage/#dedicated-media-source-failure-steps

View file

@ -150,13 +150,14 @@ impl Storage {
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
fn broadcast_change_notification(&self, key: Option<String>, old_value: Option<String>,
new_value: Option<String>) {
let global_root = self.global();
let global_ref = global_root.r();
let window = global_ref.as_global_scope().as_window();
let global = self.global_scope();
let window = global.as_window();
let task_source = window.dom_manipulation_task_source();
let trusted_storage = Trusted::new(self);
task_source.queue(box StorageEventRunnable::new(trusted_storage, key, old_value, new_value),
global_ref).unwrap();
task_source
.queue(
box StorageEventRunnable::new(trusted_storage, key, old_value, new_value), &global)
.unwrap();
}
}