Parse poster url relative to the node's document

This commit is contained in:
Fernando Jiménez Moreno 2019-01-11 16:08:42 +01:00
parent 1033d6bc07
commit 4e286ffa96
4 changed files with 4 additions and 10 deletions

View file

@ -6,7 +6,6 @@ use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding; use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding;
use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding::HTMLVideoElementMethods; use crate::dom::bindings::codegen::Bindings::HTMLVideoElementBinding::HTMLVideoElementMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::refcounted::Trusted; use crate::dom::bindings::refcounted::Trusted;
use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::reflector::DomObject;
@ -112,13 +111,8 @@ impl HTMLVideoElement {
} }
// Step 3. // Step 3.
let poster_url = match ServoUrl::parse(poster_url) { let poster_url = match document_from_node(self).url().join(&poster_url) {
Ok(url) => url, Ok(url) => url,
Err(url::ParseError::RelativeUrlWithoutBase) => {
let window = window_from_node(self);
let url = window.Location().get_url();
url.join(&poster_url).unwrap()
},
Err(_) => return, Err(_) => return,
}; };

View file

@ -37,7 +37,7 @@ impl Location {
) )
} }
pub fn get_url(&self) -> ServoUrl { fn get_url(&self) -> ServoUrl {
self.window.get_url() self.window.get_url()
} }

View file

@ -32838,7 +32838,7 @@
"testharness" "testharness"
], ],
"mozilla/video_poster_frame.html": [ "mozilla/video_poster_frame.html": [
"2f4af97720c40fbbde8d1cad660b1018d88367e5", "8b321ef5d82e0de6e16625ecd41190abc00bacb6",
"reftest" "reftest"
], ],
"mozilla/video_poster_frame_ref.html": [ "mozilla/video_poster_frame_ref.html": [

View file

@ -13,7 +13,7 @@
// Apart from removing the `reftest-wait` class we need to get // Apart from removing the `reftest-wait` class we need to get
// the `load` event to signal that it's ok to take the reftest // the `load` event to signal that it's ok to take the reftest
// screenshot. Video loading delays the document `load` event, // screenshot. Video loading delays the document `load` event,
// so we garantee that we get this event by setting an invaid // so we garantee that we get this event by setting an invalid
// src attribute to the video tag. // src attribute to the video tag.
document.documentElement.classList.remove("reftest-wait"); document.documentElement.classList.remove("reftest-wait");
}); });