diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-03-13 19:47:17 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-03-13 21:27:58 +0100 |
commit | 0593d77b93ec76c910e280572920b45935ac341b (patch) | |
tree | c0421f24ddd456a1a3e2fee1e964865599ddbfbe /components/script/dom/urlhelper.rs | |
parent | bbbdb98897913b06a8a4819498e59dbb09ad9aa7 (diff) | |
download | servo-0593d77b93ec76c910e280572920b45935ac341b.tar.gz servo-0593d77b93ec76c910e280572920b45935ac341b.zip |
Use USVString for URLUtils and URLUtilsReadOnly.
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 |