diff options
4 files changed, 37 insertions, 1 deletions
diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl index 65a7acbd1a2..c75def477da 100644 --- a/components/script/dom/webidls/Window.webidl +++ b/components/script/dom/webidls/Window.webidl @@ -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(); diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 0b3b4f3cec7..38c2588749c 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -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)), diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 91b533bcbff..5d096a98043 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -35938,6 +35938,12 @@ "deleted_reftests": {}, "items": { "testharness": { + "html/browsers/the-window-object/browser-interface-elements/status.html": [ + { + "path": "html/browsers/the-window-object/browser-interface-elements/status.html", + "url": "/html/browsers/the-window-object/browser-interface-elements/status.html" + } + ], "html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_attribute-getter-setter.html": [ { "path": "html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_attribute-getter-setter.html", diff --git a/tests/wpt/web-platform-tests/html/browsers/the-window-object/browser-interface-elements/status.html b/tests/wpt/web-platform-tests/html/browsers/the-window-object/browser-interface-elements/status.html new file mode 100644 index 00000000000..ed3facb53f8 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/browsers/the-window-object/browser-interface-elements/status.html @@ -0,0 +1,18 @@ +<!doctype html> +<meta charset=utf-8> +<title>Window.status tests</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-window-status"> +<div id=log></div> +<script> +test(function() { + assert_true("status" in window, "status in window"); + assert_equals(window.status, "", "window.status is empty string initially"); + window.status = "newstatus"; + assert_equals(window.status, "newstatus", "window.string is set to newstatus"); + window.status = 5; + assert_equals(window.status, "5", "window.status is a string"); +}, "Functional properties of window.status"); + +</script> |