mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Implement HTMLMediaElement.crossorigin attribute logic.
This commit is contained in:
parent
415b26e4f1
commit
ade697b782
4 changed files with 19 additions and 55 deletions
|
@ -30,6 +30,9 @@ use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
|
|||
use crate::dom::bindings::str::{DOMString, USVString};
|
||||
use crate::dom::blob::Blob;
|
||||
use crate::dom::document::Document;
|
||||
use crate::dom::element::{
|
||||
cors_setting_for_element, reflect_cross_origin_attribute, set_cross_origin_attribute,
|
||||
};
|
||||
use crate::dom::element::{AttributeMutation, Element};
|
||||
use crate::dom::event::Event;
|
||||
use crate::dom::eventtarget::EventTarget;
|
||||
|
@ -64,7 +67,7 @@ use ipc_channel::ipc;
|
|||
use ipc_channel::router::ROUTER;
|
||||
use net_traits::image::base::Image;
|
||||
use net_traits::image_cache::ImageResponse;
|
||||
use net_traits::request::{CredentialsMode, Destination, Referrer, RequestBuilder};
|
||||
use net_traits::request::{CredentialsMode, Destination, Referrer, RequestBuilder, RequestMode};
|
||||
use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseListener, Metadata};
|
||||
use net_traits::{NetworkError, ResourceFetchTiming, ResourceTimingType};
|
||||
use script_layout_interface::HTMLMediaData;
|
||||
|
@ -707,7 +710,6 @@ impl HTMLMediaElement {
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME(nox): Handle CORS setting from crossorigin attribute.
|
||||
let document = document_from_node(self);
|
||||
let destination = match self.media_type_id() {
|
||||
HTMLMediaElementTypeId::HTMLAudioElement => Destination::Audio,
|
||||
|
@ -728,6 +730,11 @@ impl HTMLMediaElement {
|
|||
.headers(headers)
|
||||
.destination(destination)
|
||||
.credentials_mode(CredentialsMode::Include)
|
||||
// https://html.spec.whatwg.org/multipage/#create-a-potential-cors-request
|
||||
.mode(match cors_setting_for_element(self.upcast::<Element>()) {
|
||||
Some(_) => RequestMode::CorsMode,
|
||||
None => RequestMode::NoCors,
|
||||
})
|
||||
.use_url_credentials(true)
|
||||
.origin(document.origin().immutable().clone())
|
||||
.pipeline_id(Some(self.global().pipeline_id()))
|
||||
|
@ -1614,6 +1621,15 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
|
|||
// https://html.spec.whatwg.org/multipage/#dom-media-src
|
||||
make_url_setter!(SetSrc, "src");
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-crossOrigin
|
||||
fn GetCrossOrigin(&self) -> Option<DOMString> {
|
||||
reflect_cross_origin_attribute(self.upcast::<Element>())
|
||||
}
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-crossOrigin
|
||||
fn SetCrossOrigin(&self, value: Option<DOMString>) {
|
||||
set_cross_origin_attribute(self.upcast::<Element>(), value);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-muted
|
||||
fn Muted(&self) -> bool {
|
||||
self.muted.get()
|
||||
|
|
|
@ -16,7 +16,7 @@ interface HTMLMediaElement : HTMLElement {
|
|||
[CEReactions] attribute USVString src;
|
||||
attribute MediaProvider? srcObject;
|
||||
readonly attribute USVString currentSrc;
|
||||
// [CEReactions] attribute DOMString crossOrigin;
|
||||
[CEReactions] attribute DOMString? crossOrigin;
|
||||
const unsigned short NETWORK_EMPTY = 0;
|
||||
const unsigned short NETWORK_IDLE = 1;
|
||||
const unsigned short NETWORK_LOADING = 2;
|
||||
|
|
|
@ -1016,9 +1016,6 @@
|
|||
[HTMLMediaElement interface: document.createElement("video") must inherit property "srcObject" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("video") must inherit property "crossOrigin" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("video") must inherit property "buffered" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1085,9 +1082,6 @@
|
|||
[HTMLMediaElement interface: document.createElement("audio") must inherit property "srcObject" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("audio") must inherit property "crossOrigin" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("audio") must inherit property "buffered" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -1169,9 +1163,6 @@
|
|||
[HTMLMediaElement interface: new Audio() must inherit property "currentSrc" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: new Audio() must inherit property "crossOrigin" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: new Audio() must inherit property "NETWORK_EMPTY" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -6768,9 +6759,6 @@
|
|||
[HTMLMediaElement interface: document.createElement("video") must inherit property "srcObject" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("video") must inherit property "crossOrigin" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("video") must inherit property "getStartDate()" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -6786,9 +6774,6 @@
|
|||
[HTMLMediaElement interface: document.createElement("audio") must inherit property "srcObject" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("audio") must inherit property "crossOrigin" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: document.createElement("audio") must inherit property "getStartDate()" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -6804,9 +6789,6 @@
|
|||
[HTMLMediaElement interface: new Audio() must inherit property "srcObject" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: new Audio() must inherit property "crossOrigin" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: new Audio() must inherit property "getStartDate()" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -6819,9 +6801,6 @@
|
|||
[HTMLMediaElement interface: new Audio() must inherit property "controls" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: attribute crossOrigin]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement interface: operation getStartDate()]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
[crossOrigin.html]
|
||||
[HTMLMediaElement.crossOrigin, setting to invalid value]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, content attribute use-credentials]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, content attribute invalid value]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, setting to uppercase ANONYMOUS]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, content attribute uppercase ANONYMOUS]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, setting to empty string]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, content attribute empty string]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, content attribute missing]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin, setting to use-credentials]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMediaElement.crossOrigin]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue