diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-03-13 14:30:49 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-03-13 14:30:49 -0600 |
commit | 19cd87aefc24fa153fa013b5f96ae46de9a427fd (patch) | |
tree | cd851e0b8b82b7889bb1417604d9936f95fcc461 /components/script/dom/urlhelper.rs | |
parent | 2382d71242b1f9fe6385b64436f3b18f8f0939bb (diff) | |
parent | 2345f5461bf847fa0d7840fde04da13df4a36d51 (diff) | |
download | servo-19cd87aefc24fa153fa013b5f96ae46de9a427fd.tar.gz servo-19cd87aefc24fa153fa013b5f96ae46de9a427fd.zip |
auto merge of #5208 : Ms2ger/servo/USVString, r=jdm
Diffstat (limited to 'components/script/dom/urlhelper.rs')
-rw-r--r-- | components/script/dom/urlhelper.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs index 66eec322176..c83e65c98b2 100644 --- a/components/script/dom/urlhelper.rs +++ b/components/script/dom/urlhelper.rs @@ -2,7 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use util::str::DOMString; +use dom::bindings::str::USVString; + use url::Url; use std::borrow::ToOwned; @@ -10,24 +11,24 @@ use std::borrow::ToOwned; pub struct UrlHelper; impl UrlHelper { - pub fn Href(url: &Url) -> DOMString { - url.serialize() + pub fn Href(url: &Url) -> USVString { + USVString(url.serialize()) } - pub fn Search(url: &Url) -> DOMString { - match url.query { + pub fn Search(url: &Url) -> USVString { + USVString(match url.query { None => "".to_owned(), Some(ref query) if query.as_slice() == "" => "".to_owned(), Some(ref query) => format!("?{}", query) - } + }) } - pub fn Hash(url: &Url) -> DOMString { - match url.fragment { + pub fn Hash(url: &Url) -> USVString { + USVString(match url.fragment { None => "".to_owned(), Some(ref hash) if hash.as_slice() == "" => "".to_owned(), Some(ref hash) => format!("#{}", hash) - } + }) } /// https://html.spec.whatwg.org/multipage/browsers.html#same-origin |