Adding most commonly used parts of window.console. Fixes Issue#506. r=Ms2ger

This commit is contained in:
Austin King 2014-02-10 23:13:59 -08:00
parent f26cdcf235
commit b1b481f3f3
7 changed files with 102 additions and 0 deletions

View file

@ -9,6 +9,7 @@ use dom::bindings::utils::DOMString;
use dom::document::AbstractDocument;
use dom::eventtarget::{EventTarget, WindowTypeId};
use dom::node::AbstractNode;
use dom::console::Console;
use dom::location::Location;
use dom::navigator::Navigator;
@ -65,6 +66,7 @@ pub struct Window {
page: @mut Page,
script_chan: ScriptChan,
compositor: @ScriptListener,
console: Option<@mut Console>,
timer_chan: SharedChan<TimerControlMsg>,
location: Option<@mut Location>,
navigator: Option<@mut Navigator>,
@ -150,6 +152,13 @@ impl Window {
self.location.unwrap()
}
pub fn Console(&mut self) -> @mut Console {
if self.console.is_none() {
self.console = Some(Console::new(self));
}
self.console.unwrap()
}
pub fn Navigator(&mut self) -> @mut Navigator {
if self.navigator.is_none() {
self.navigator = Some(Navigator::new(self));
@ -246,6 +255,7 @@ impl Window {
page: page,
script_chan: script_chan.clone(),
compositor: compositor,
console: None,
timer_chan: {
let (timer_port, timer_chan): (Port<TimerControlMsg>, SharedChan<TimerControlMsg>) = SharedChan::new();
let id = page.id.clone();