diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index 7b21703341d..8b10899c079 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -2,14 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementMethods;
+use dom::bindings::codegen::Bindings::HTMLMediaElementBinding::HTMLMediaElementConstants;
use dom::document::Document;
use dom::htmlelement::HTMLElement;
+use std::cell::Cell;
use string_cache::Atom;
use util::str::DOMString;
#[dom_struct]
pub struct HTMLMediaElement {
htmlelement: HTMLElement,
+ network_state: Cell,
+ ready_state: Cell,
}
impl HTMLMediaElement {
@@ -18,7 +23,9 @@ impl HTMLMediaElement {
-> HTMLMediaElement {
HTMLMediaElement {
htmlelement:
- HTMLElement::new_inherited(tag_name, prefix, document)
+ HTMLElement::new_inherited(tag_name, prefix, document),
+ network_state: Cell::new(HTMLMediaElementConstants::NETWORK_EMPTY),
+ ready_state: Cell::new(HTMLMediaElementConstants::HAVE_NOTHING),
}
}
@@ -27,3 +34,13 @@ impl HTMLMediaElement {
&self.htmlelement
}
}
+
+impl HTMLMediaElementMethods for HTMLMediaElement {
+ fn NetworkState(&self) -> u16 {
+ self.network_state.get()
+ }
+
+ fn ReadyState(&self) -> u16 {
+ self.ready_state.get()
+ }
+}
diff --git a/components/script/dom/webidls/HTMLMediaElement.webidl b/components/script/dom/webidls/HTMLMediaElement.webidl
index 277178732c7..728cf0a53df 100644
--- a/components/script/dom/webidls/HTMLMediaElement.webidl
+++ b/components/script/dom/webidls/HTMLMediaElement.webidl
@@ -14,23 +14,23 @@ interface HTMLMediaElement : HTMLElement {
// attribute DOMString src;
//readonly attribute DOMString currentSrc;
// attribute DOMString crossOrigin;
- //const unsigned short NETWORK_EMPTY = 0;
- //const unsigned short NETWORK_IDLE = 1;
- //const unsigned short NETWORK_LOADING = 2;
- //const unsigned short NETWORK_NO_SOURCE = 3;
- //readonly attribute unsigned short networkState;
+ const unsigned short NETWORK_EMPTY = 0;
+ const unsigned short NETWORK_IDLE = 1;
+ const unsigned short NETWORK_LOADING = 2;
+ const unsigned short NETWORK_NO_SOURCE = 3;
+ readonly attribute unsigned short networkState;
// attribute DOMString preload;
//readonly attribute TimeRanges buffered;
//void load();
//CanPlayTypeResult canPlayType(DOMString type);
// ready state
- //const unsigned short HAVE_NOTHING = 0;
- //const unsigned short HAVE_METADATA = 1;
- //const unsigned short HAVE_CURRENT_DATA = 2;
- //const unsigned short HAVE_FUTURE_DATA = 3;
- //const unsigned short HAVE_ENOUGH_DATA = 4;
- //readonly attribute unsigned short readyState;
+ const unsigned short HAVE_NOTHING = 0;
+ const unsigned short HAVE_METADATA = 1;
+ const unsigned short HAVE_CURRENT_DATA = 2;
+ const unsigned short HAVE_FUTURE_DATA = 3;
+ const unsigned short HAVE_ENOUGH_DATA = 4;
+ readonly attribute unsigned short readyState;
//readonly attribute boolean seeking;
// playback state
diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini
index 1acedab90ec..7f3977671e0 100644
--- a/tests/wpt/metadata/html/dom/interfaces.html.ini
+++ b/tests/wpt/metadata/html/dom/interfaces.html.ini
@@ -2631,21 +2631,6 @@
[HTMLMediaElement interface: document.createElement("video") must inherit property "crossOrigin" with the proper type (3)]
expected: FAIL
- [HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_EMPTY" with the proper type (4)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_IDLE" with the proper type (5)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_LOADING" with the proper type (6)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "NETWORK_NO_SOURCE" with the proper type (7)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "networkState" with the proper type (8)]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("video") must inherit property "preload" with the proper type (9)]
expected: FAIL
@@ -2661,24 +2646,6 @@
[HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("video") with too few arguments must throw TypeError]
expected: FAIL
- [HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_NOTHING" with the proper type (13)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_METADATA" with the proper type (14)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_CURRENT_DATA" with the proper type (15)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_FUTURE_DATA" with the proper type (16)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "HAVE_ENOUGH_DATA" with the proper type (17)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("video") must inherit property "readyState" with the proper type (18)]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("video") must inherit property "seeking" with the proper type (19)]
expected: FAIL
@@ -2772,21 +2739,6 @@
[HTMLMediaElement interface: document.createElement("audio") must inherit property "crossOrigin" with the proper type (3)]
expected: FAIL
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_EMPTY" with the proper type (4)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_IDLE" with the proper type (5)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_LOADING" with the proper type (6)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "NETWORK_NO_SOURCE" with the proper type (7)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "networkState" with the proper type (8)]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("audio") must inherit property "preload" with the proper type (9)]
expected: FAIL
@@ -2802,24 +2754,6 @@
[HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("audio") with too few arguments must throw TypeError]
expected: FAIL
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_NOTHING" with the proper type (13)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_METADATA" with the proper type (14)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_CURRENT_DATA" with the proper type (15)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_FUTURE_DATA" with the proper type (16)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "HAVE_ENOUGH_DATA" with the proper type (17)]
- expected: FAIL
-
- [HTMLMediaElement interface: document.createElement("audio") must inherit property "readyState" with the proper type (18)]
- expected: FAIL
-
[HTMLMediaElement interface: document.createElement("audio") must inherit property "seeking" with the proper type (19)]
expected: FAIL
@@ -3168,33 +3102,6 @@
[HTMLMediaElement interface: attribute crossOrigin]
expected: FAIL
- [HTMLMediaElement interface: constant NETWORK_EMPTY on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant NETWORK_EMPTY on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant NETWORK_IDLE on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant NETWORK_IDLE on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant NETWORK_LOADING on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant NETWORK_LOADING on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant NETWORK_NO_SOURCE on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant NETWORK_NO_SOURCE on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: attribute networkState]
- expected: FAIL
-
[HTMLMediaElement interface: attribute preload]
expected: FAIL
@@ -3207,39 +3114,6 @@
[HTMLMediaElement interface: operation canPlayType(DOMString)]
expected: FAIL
- [HTMLMediaElement interface: constant HAVE_NOTHING on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_NOTHING on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_METADATA on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_METADATA on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_CURRENT_DATA on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_CURRENT_DATA on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_FUTURE_DATA on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_FUTURE_DATA on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_ENOUGH_DATA on interface object]
- expected: FAIL
-
- [HTMLMediaElement interface: constant HAVE_ENOUGH_DATA on interface prototype object]
- expected: FAIL
-
- [HTMLMediaElement interface: attribute readyState]
- expected: FAIL
-
[HTMLMediaElement interface: attribute seeking]
expected: FAIL