Use Url.join instead of UrlParser.base_url(...).parse (#9002)

This commit is contained in:
Mathieu Agopian 2015-12-18 17:02:41 +01:00
parent 6764cf0ee9
commit 11234f5370
41 changed files with 58 additions and 64 deletions

View file

@ -10,7 +10,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::USVString;
use dom::urlhelper::UrlHelper;
use dom::window::Window;
use url::{Url, UrlParser};
use url::Url;
use util::str::DOMString;
#[dom_struct]
@ -51,7 +51,7 @@ impl LocationMethods for Location {
// TODO: per spec, we should use the _API base URL_ specified by the
// _entry settings object_.
let base_url = self.window.get_url();
if let Ok(url) = UrlParser::new().base_url(&base_url).parse(&url.0) {
if let Ok(url) = base_url.join(&url.0) {
self.window.load_url(url);
}
}
@ -98,7 +98,7 @@ impl LocationMethods for Location {
// https://html.spec.whatwg.org/multipage/#dom-location-href
fn SetHref(&self, value: USVString) {
if let Ok(url) = UrlParser::new().base_url(&self.window.get_url()).parse(&value.0) {
if let Ok(url) = self.window.get_url().join(&value.0) {
self.window.load_url(url);
}
}