diff options
author | Ms2ger <Ms2ger@gmail.com> | 2015-08-07 15:19:16 +0200 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2015-08-07 15:19:16 +0200 |
commit | 40b5c4586ed7aa8327b2ae1f058bdaf6202bb90e (patch) | |
tree | c829bd1b7bb1fdfeba9f4771d9696258c9ed2f18 /components/script/dom/document.rs | |
parent | ec9f79067d22cf848032fef7579b36bb6a8c8b32 (diff) | |
download | servo-40b5c4586ed7aa8327b2ae1f058bdaf6202bb90e.tar.gz servo-40b5c4586ed7aa8327b2ae1f058bdaf6202bb90e.zip |
Push the url parsing out of Window::load_url.
This will allow the two callers to decide on the base url independently.
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 4f4b43437e7..42e3891a9fd 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -86,7 +86,7 @@ use html5ever::tree_builder::{QuirksMode, NoQuirks, LimitedQuirks, Quirks}; use ipc_channel::ipc; use layout_interface::{LayoutChan, Msg}; use string_cache::{Atom, QualName}; -use url::Url; +use url::{Url, UrlParser}; use js::jsapi::{JSContext, JSObject, JSRuntime}; use num::ToPrimitive; @@ -466,7 +466,11 @@ impl<'a> DocumentHelpers<'a> for &'a Document { fn load_anchor_href(self, href: DOMString) { let window = self.window.root(); - window.r().load_url(href); + let base_url = window.get_url(); + let url = UrlParser::new().base_url(&base_url).parse(&href); + // FIXME: handle URL parse errors more gracefully. + let url = url.unwrap(); + window.load_url(url); } /// Attempt to find a named element in this page's document. |