Auto merge of #11434 - catchmrbharath:status, r=nox

WIP: Fixes #11407: Implement Window.status

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #11407 (github issue number if applicable).

Either:
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11434)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-27 05:33:14 -05:00
commit d890453f78
4 changed files with 37 additions and 1 deletions

View file

@ -20,7 +20,7 @@
//[Replaceable] readonly attribute BarProp scrollbars;
//[Replaceable] readonly attribute BarProp statusbar;
//[Replaceable] readonly attribute BarProp toolbar;
// attribute DOMString status;
attribute DOMString status;
void close();
//readonly attribute boolean closed;
//void stop();

View file

@ -160,6 +160,7 @@ pub struct Window {
screen: MutNullableHeap<JS<Screen>>,
session_storage: MutNullableHeap<JS<Storage>>,
local_storage: MutNullableHeap<JS<Storage>>,
status: DOMRefCell<DOMString>,
#[ignore_heap_size_of = "channels are hard"]
scheduler_chan: IpcSender<TimerEventRequest>,
timers: OneshotTimers,
@ -828,6 +829,16 @@ impl WindowMethods for Window {
let dpr = self.window_size.get().map_or(1.0f32, |data| data.device_pixel_ratio.get());
Finite::wrap(dpr as f64)
}
// https://html.spec.whatwg.org/multipage/#dom-window-status
fn Status(&self) -> DOMString {
self.status.borrow().clone()
}
// https://html.spec.whatwg.org/multipage/#dom-window-status
fn SetStatus(&self, status: DOMString) {
*self.status.borrow_mut() = status
}
}
pub trait ScriptHelpers {
@ -1513,6 +1524,7 @@ impl Window {
screen: Default::default(),
session_storage: Default::default(),
local_storage: Default::default(),
status: DOMRefCell::new(DOMString::new()),
scheduler_chan: scheduler_chan.clone(),
timers: OneshotTimers::new(timer_event_chan, scheduler_chan),
next_worker_id: Cell::new(WorkerId(0)),