mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Handle src='' in an iframe element. Without this, infinitely creates iframes with the same url.
This commit is contained in:
parent
8a02fe0fc6
commit
111de569ac
1 changed files with 8 additions and 3 deletions
|
@ -75,9 +75,14 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
|
|||
fn get_url(&self) -> Option<Url> {
|
||||
let element: &JSRef<Element> = ElementCast::from_ref(self);
|
||||
element.get_attribute(Null, "src").root().and_then(|src| {
|
||||
let window = window_from_node(self).root();
|
||||
UrlParser::new().base_url(&window.deref().page().get_url())
|
||||
.parse(src.deref().value().as_slice()).ok()
|
||||
let url = src.deref().value();
|
||||
if url.as_slice().is_empty() {
|
||||
None
|
||||
} else {
|
||||
let window = window_from_node(self).root();
|
||||
UrlParser::new().base_url(&window.deref().page().get_url())
|
||||
.parse(url.as_slice()).ok()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue