Stub out readyState and networkState attributes for HTMLMediaElement.

This commit is contained in:
Josh Matthews 2015-11-06 16:28:31 -06:00
parent 3d38a60cee
commit b8b4be34c0
3 changed files with 29 additions and 138 deletions

View file

@ -2,14 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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::document::Document;
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use std::cell::Cell;
use string_cache::Atom; use string_cache::Atom;
use util::str::DOMString; use util::str::DOMString;
#[dom_struct] #[dom_struct]
pub struct HTMLMediaElement { pub struct HTMLMediaElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
network_state: Cell<u16>,
ready_state: Cell<u16>,
} }
impl HTMLMediaElement { impl HTMLMediaElement {
@ -18,7 +23,9 @@ impl HTMLMediaElement {
-> HTMLMediaElement { -> HTMLMediaElement {
HTMLMediaElement { HTMLMediaElement {
htmlelement: 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 &self.htmlelement
} }
} }
impl HTMLMediaElementMethods for HTMLMediaElement {
fn NetworkState(&self) -> u16 {
self.network_state.get()
}
fn ReadyState(&self) -> u16 {
self.ready_state.get()
}
}

View file

@ -14,23 +14,23 @@ interface HTMLMediaElement : HTMLElement {
// attribute DOMString src; // attribute DOMString src;
//readonly attribute DOMString currentSrc; //readonly attribute DOMString currentSrc;
// attribute DOMString crossOrigin; // attribute DOMString crossOrigin;
//const unsigned short NETWORK_EMPTY = 0; const unsigned short NETWORK_EMPTY = 0;
//const unsigned short NETWORK_IDLE = 1; const unsigned short NETWORK_IDLE = 1;
//const unsigned short NETWORK_LOADING = 2; const unsigned short NETWORK_LOADING = 2;
//const unsigned short NETWORK_NO_SOURCE = 3; const unsigned short NETWORK_NO_SOURCE = 3;
//readonly attribute unsigned short networkState; readonly attribute unsigned short networkState;
// attribute DOMString preload; // attribute DOMString preload;
//readonly attribute TimeRanges buffered; //readonly attribute TimeRanges buffered;
//void load(); //void load();
//CanPlayTypeResult canPlayType(DOMString type); //CanPlayTypeResult canPlayType(DOMString type);
// ready state // ready state
//const unsigned short HAVE_NOTHING = 0; const unsigned short HAVE_NOTHING = 0;
//const unsigned short HAVE_METADATA = 1; const unsigned short HAVE_METADATA = 1;
//const unsigned short HAVE_CURRENT_DATA = 2; const unsigned short HAVE_CURRENT_DATA = 2;
//const unsigned short HAVE_FUTURE_DATA = 3; const unsigned short HAVE_FUTURE_DATA = 3;
//const unsigned short HAVE_ENOUGH_DATA = 4; const unsigned short HAVE_ENOUGH_DATA = 4;
//readonly attribute unsigned short readyState; readonly attribute unsigned short readyState;
//readonly attribute boolean seeking; //readonly attribute boolean seeking;
// playback state // playback state

View file

@ -2631,21 +2631,6 @@
[HTMLMediaElement interface: document.createElement("video") must inherit property "crossOrigin" with the proper type (3)] [HTMLMediaElement interface: document.createElement("video") must inherit property "crossOrigin" with the proper type (3)]
expected: FAIL 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)] [HTMLMediaElement interface: document.createElement("video") must inherit property "preload" with the proper type (9)]
expected: FAIL expected: FAIL
@ -2661,24 +2646,6 @@
[HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("video") with too few arguments must throw TypeError] [HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("video") with too few arguments must throw TypeError]
expected: FAIL 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)] [HTMLMediaElement interface: document.createElement("video") must inherit property "seeking" with the proper type (19)]
expected: FAIL expected: FAIL
@ -2772,21 +2739,6 @@
[HTMLMediaElement interface: document.createElement("audio") must inherit property "crossOrigin" with the proper type (3)] [HTMLMediaElement interface: document.createElement("audio") must inherit property "crossOrigin" with the proper type (3)]
expected: FAIL 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)] [HTMLMediaElement interface: document.createElement("audio") must inherit property "preload" with the proper type (9)]
expected: FAIL expected: FAIL
@ -2802,24 +2754,6 @@
[HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("audio") with too few arguments must throw TypeError] [HTMLMediaElement interface: calling canPlayType(DOMString) on document.createElement("audio") with too few arguments must throw TypeError]
expected: FAIL 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)] [HTMLMediaElement interface: document.createElement("audio") must inherit property "seeking" with the proper type (19)]
expected: FAIL expected: FAIL
@ -3168,33 +3102,6 @@
[HTMLMediaElement interface: attribute crossOrigin] [HTMLMediaElement interface: attribute crossOrigin]
expected: FAIL 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] [HTMLMediaElement interface: attribute preload]
expected: FAIL expected: FAIL
@ -3207,39 +3114,6 @@
[HTMLMediaElement interface: operation canPlayType(DOMString)] [HTMLMediaElement interface: operation canPlayType(DOMString)]
expected: FAIL 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] [HTMLMediaElement interface: attribute seeking]
expected: FAIL expected: FAIL