diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-10-10 16:14:40 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-10-11 13:56:07 +0200 |
commit | 605c679fee29302321878a74b88aa7165519b516 (patch) | |
tree | c52ffde5e21c61b3a5cbdc5aa308247741bb708d /components/script/dom/htmlmediaelement.rs | |
parent | 826352ab4cae13f5154d13ab53885d80a8057337 (diff) | |
download | servo-605c679fee29302321878a74b88aa7165519b516.tar.gz servo-605c679fee29302321878a74b88aa7165519b516.zip |
Fix URL attributes
URL attributes should always use AttrValue::Url, and the input should be
resolved against the document's base URL at setting time always.
Diffstat (limited to 'components/script/dom/htmlmediaelement.rs')
-rw-r--r-- | components/script/dom/htmlmediaelement.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 739025544e7..965dd83cee4 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -46,6 +46,7 @@ use std::collections::VecDeque; use std::mem; use std::rc::Rc; use std::sync::{Arc, Mutex}; +use style::attr::AttrValue; use task_source::TaskSource; use time::{self, Timespec, Duration}; @@ -837,8 +838,9 @@ impl HTMLMediaElementMethods for HTMLMediaElement { // https://html.spec.whatwg.org/multipage/#dom-media-src make_url_getter!(Src, "src"); + // https://html.spec.whatwg.org/multipage/#dom-media-src - make_setter!(SetSrc, "src"); + make_url_setter!(SetSrc, "src"); // https://html.spec.whatwg.org/multipage/#dom-media-srcobject fn GetSrcObject(&self) -> Option<DomRoot<Blob>> { @@ -913,6 +915,13 @@ impl VirtualMethods for HTMLMediaElement { Some(self.upcast::<HTMLElement>() as &VirtualMethods) } + fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue { + match name { + &local_name!("src") => AttrValue::from_url(document_from_node(self).base_url(), value.into()), + _ => self.super_type().unwrap().parse_plain_attribute(name, value), + } + } + fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { self.super_type().unwrap().attribute_mutated(attr, mutation); |