mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Push the url parsing out of Window::load_url.
This will allow the two callers to decide on the base url independently.
This commit is contained in:
parent
ec9f79067d
commit
40b5c4586e
3 changed files with 18 additions and 12 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue