Make WebIDL constructors take a more specific global if possible (fixes #14071)

This commit is contained in:
Rohan Prinja 2016-11-10 02:24:01 -05:00 committed by Anthony Ramine
parent 8af2327e95
commit 973f77c006
17 changed files with 50 additions and 49 deletions

View file

@ -14,8 +14,8 @@ use dom::bindings::js::RootedReference;
use dom::bindings::str::DOMString;
use dom::characterdata::CharacterData;
use dom::document::Document;
use dom::globalscope::GlobalScope;
use dom::node::Node;
use dom::window::Window;
/// An HTML text node.
#[dom_struct]
@ -35,8 +35,8 @@ impl Text {
document, TextBinding::Wrap)
}
pub fn Constructor(global: &GlobalScope, text: DOMString) -> Fallible<Root<Text>> {
let document = global.as_window().Document();
pub fn Constructor(window: &Window, text: DOMString) -> Fallible<Root<Text>> {
let document = window.Document();
Ok(Text::new(text, &document))
}
}