aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-03-13 19:47:17 +0100
committerMs2ger <ms2ger@gmail.com>2015-03-13 21:27:58 +0100
commit0593d77b93ec76c910e280572920b45935ac341b (patch)
treec0421f24ddd456a1a3e2fee1e964865599ddbfbe
parentbbbdb98897913b06a8a4819498e59dbb09ad9aa7 (diff)
downloadservo-0593d77b93ec76c910e280572920b45935ac341b.tar.gz
servo-0593d77b93ec76c910e280572920b45935ac341b.zip
Use USVString for URLUtils and URLUtilsReadOnly.
-rw-r--r--components/script/dom/location.rs9
-rw-r--r--components/script/dom/urlhelper.rs19
-rw-r--r--components/script/dom/webidls/URLUtils.webidl28
-rw-r--r--components/script/dom/webidls/URLUtilsReadOnly.webidl22
-rw-r--r--components/script/dom/workerlocation.rs9
5 files changed, 43 insertions, 44 deletions
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs
index 13cc1a05c65..4f02a7952b7 100644
--- a/components/script/dom/location.rs
+++ b/components/script/dom/location.rs
@@ -6,6 +6,7 @@ use dom::bindings::codegen::Bindings::LocationBinding;
use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, JSRef, Temporary};
+use dom::bindings::str::USVString;
use dom::bindings::utils::{Reflector, reflect_dom_object};
use dom::urlhelper::UrlHelper;
use dom::window::Window;
@@ -41,19 +42,19 @@ impl<'a> LocationMethods for JSRef<'a, Location> {
self.window.root().r().load_url(url);
}
- fn Href(self) -> DOMString {
+ fn Href(self) -> USVString {
UrlHelper::Href(&self.get_url())
}
fn Stringify(self) -> DOMString {
- self.Href()
+ self.Href().0
}
- fn Search(self) -> DOMString {
+ fn Search(self) -> USVString {
UrlHelper::Search(&self.get_url())
}
- fn Hash(self) -> DOMString {
+ fn Hash(self) -> USVString {
UrlHelper::Hash(&self.get_url())
}
}
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
diff --git a/components/script/dom/webidls/URLUtils.webidl b/components/script/dom/webidls/URLUtils.webidl
index 4abb2048917..bdeca5aeabf 100644
--- a/components/script/dom/webidls/URLUtils.webidl
+++ b/components/script/dom/webidls/URLUtils.webidl
@@ -6,21 +6,21 @@
// http://url.spec.whatwg.org/#urlutils
[NoInterfaceObject]
interface URLUtils {
- //stringifier attribute ScalarValueString href;
- readonly attribute DOMString href;
- //readonly attribute ScalarValueString origin;
- // attribute ScalarValueString protocol;
- // attribute ScalarValueString username;
- // attribute ScalarValueString password;
- // attribute ScalarValueString host;
- // attribute ScalarValueString hostname;
- // attribute ScalarValueString port;
- // attribute ScalarValueString pathname;
- // attribute ScalarValueString search;
- readonly attribute DOMString search;
+ //stringifier attribute USVString href;
+ readonly attribute USVString href;
+ //readonly attribute USVString origin;
+ // attribute USVString protocol;
+ // attribute USVString username;
+ // attribute USVString password;
+ // attribute USVString host;
+ // attribute USVString hostname;
+ // attribute USVString port;
+ // attribute USVString pathname;
+ // attribute USVString search;
+ readonly attribute USVString search;
// attribute URLSearchParams searchParams;
- // attribute ScalarValueString hash;
- readonly attribute DOMString hash;
+ // attribute USVString hash;
+ readonly attribute USVString hash;
// This is only doing as well as gecko right now, bug 824857 is on file for
// adding attribute stringifier support.
diff --git a/components/script/dom/webidls/URLUtilsReadOnly.webidl b/components/script/dom/webidls/URLUtilsReadOnly.webidl
index 8518019a6c1..3b152ad8036 100644
--- a/components/script/dom/webidls/URLUtilsReadOnly.webidl
+++ b/components/script/dom/webidls/URLUtilsReadOnly.webidl
@@ -7,17 +7,15 @@
[NoInterfaceObject/*,
Exposed=(Window,Worker)*/]
interface URLUtilsReadOnly {
- //stringifier readonly attribute ScalarValueString href;
- readonly attribute DOMString href;
- //readonly attribute ScalarValueString origin;
+ //stringifier readonly attribute USVString href;
+ readonly attribute USVString href;
+ //readonly attribute USVString origin;
- //readonly attribute ScalarValueString protocol;
- //readonly attribute ScalarValueString host;
- //readonly attribute ScalarValueString hostname;
- //readonly attribute ScalarValueString port;
- //readonly attribute ScalarValueString pathname;
- //readonly attribute ScalarValueString search;
- readonly attribute DOMString search;
- //readonly attribute ScalarValueString hash;
- readonly attribute DOMString hash;
+ //readonly attribute USVString protocol;
+ //readonly attribute USVString host;
+ //readonly attribute USVString hostname;
+ //readonly attribute USVString port;
+ //readonly attribute USVString pathname;
+ readonly attribute USVString search;
+ readonly attribute USVString hash;
};
diff --git a/components/script/dom/workerlocation.rs b/components/script/dom/workerlocation.rs
index 787552c84a0..1f176e2c7d9 100644
--- a/components/script/dom/workerlocation.rs
+++ b/components/script/dom/workerlocation.rs
@@ -6,12 +6,11 @@ use dom::bindings::codegen::Bindings::WorkerLocationBinding;
use dom::bindings::codegen::Bindings::WorkerLocationBinding::WorkerLocationMethods;
use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::global::GlobalRef;
+use dom::bindings::str::USVString;
use dom::bindings::utils::{Reflector, reflect_dom_object};
use dom::urlhelper::UrlHelper;
use dom::workerglobalscope::WorkerGlobalScope;
-use util::str::DOMString;
-
use url::Url;
#[dom_struct]
@@ -36,15 +35,15 @@ impl WorkerLocation {
}
impl<'a> WorkerLocationMethods for JSRef<'a, WorkerLocation> {
- fn Href(self) -> DOMString {
+ fn Href(self) -> USVString {
UrlHelper::Href(&self.url)
}
- fn Search(self) -> DOMString {
+ fn Search(self) -> USVString {
UrlHelper::Search(&self.url)
}
- fn Hash(self) -> DOMString {
+ fn Hash(self) -> USVString {
UrlHelper::Hash(&self.url)
}
}