aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-05-28 14:37:16 -0500
committerbors-servo <lbergstrom+bors@mozilla.com>2016-05-28 14:37:16 -0500
commite8e7c6545d714a64d7971fad74f2b2c538dbed65 (patch)
treeccfeeaeb38eecf5953b908a39096d784bd4ee4be /components/script/dom
parent0173cabbb6aedd5695e4035437b233927d4f27d0 (diff)
parent766ad5e0923b2b5c34053db9c115debb7b64f23e (diff)
downloadservo-e8e7c6545d714a64d7971fad74f2b2c538dbed65.tar.gz
servo-e8e7c6545d714a64d7971fad74f2b2c538dbed65.zip
Auto merge of #11491 - thiagopnts:master, r=Ms2ger
use USVStrings instead of DOMString for urls in Node and Document <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #11475 <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because its just switching types <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11491) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/document.rs14
-rw-r--r--components/script/dom/node.rs9
-rw-r--r--components/script/dom/webidls/Document.webidl4
-rw-r--r--components/script/dom/webidls/Node.webidl2
4 files changed, 16 insertions, 13 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 34bb2423007..a12f122e2c6 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -27,7 +27,7 @@ use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
use dom::bindings::num::Finite;
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
-use dom::bindings::str::DOMString;
+use dom::bindings::str::{DOMString, USVString};
use dom::bindings::trace::RootedVec;
use dom::bindings::xmlname::XMLName::InvalidXMLName;
use dom::bindings::xmlname::{validate_and_extract, namespace_from_domstring, xml_name_type};
@@ -1865,8 +1865,8 @@ impl DocumentMethods for Document {
}
// https://dom.spec.whatwg.org/#dom-document-url
- fn URL(&self) -> DOMString {
- DOMString::from(self.url().as_str())
+ fn URL(&self) -> USVString {
+ USVString(String::from(self.url().as_str()))
}
// https://html.spec.whatwg.org/multipage/#dom-document-activeelement
@@ -1916,7 +1916,7 @@ impl DocumentMethods for Document {
}
// https://dom.spec.whatwg.org/#dom-document-documenturi
- fn DocumentURI(&self) -> DOMString {
+ fn DocumentURI(&self) -> USVString {
self.URL()
}
@@ -2192,8 +2192,10 @@ impl DocumentMethods for Document {
)),
"webglcontextevent" =>
Ok(Root::upcast(WebGLContextEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
- "storageevent" =>
- Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, self.URL()))),
+ "storageevent" => {
+ let USVString(url) = self.URL();
+ Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, DOMString::from(url))))
+ },
"progressevent" =>
Ok(Root::upcast(ProgressEvent::new_uninitialized(&self.window))),
"focusevent" =>
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 11b02641f2d..35236dbcb4c 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -28,7 +28,7 @@ use dom::bindings::js::Root;
use dom::bindings::js::RootedReference;
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
-use dom::bindings::str::DOMString;
+use dom::bindings::str::{DOMString, USVString};
use dom::bindings::trace::RootedVec;
use dom::bindings::xmlname::namespace_from_domstring;
use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers};
@@ -804,9 +804,10 @@ impl Node {
}
pub fn summarize(&self) -> NodeInfo {
+ let USVString(baseURI) = self.BaseURI();
NodeInfo {
uniqueId: self.unique_id(),
- baseURI: String::from(self.BaseURI()),
+ baseURI: baseURI,
parent: self.GetParentNode().map_or("".to_owned(), |node| node.unique_id()),
nodeType: self.NodeType(),
namespaceURI: String::new(), //FIXME
@@ -1860,8 +1861,8 @@ impl NodeMethods for Node {
}
// https://dom.spec.whatwg.org/#dom-node-baseuri
- fn BaseURI(&self) -> DOMString {
- DOMString::from(self.owner_doc().base_url().as_str())
+ fn BaseURI(&self) -> USVString {
+ USVString(String::from(self.owner_doc().base_url().as_str()))
}
// https://dom.spec.whatwg.org/#dom-node-ownerdocument
diff --git a/components/script/dom/webidls/Document.webidl b/components/script/dom/webidls/Document.webidl
index b73d563bac7..dd6ff9c924e 100644
--- a/components/script/dom/webidls/Document.webidl
+++ b/components/script/dom/webidls/Document.webidl
@@ -13,10 +13,10 @@ interface Document : Node {
[SameObject]
readonly attribute DOMImplementation implementation;
[Constant]
- readonly attribute DOMString URL;
+ readonly attribute USVString URL;
readonly attribute Element? activeElement;
[Constant]
- readonly attribute DOMString documentURI;
+ readonly attribute USVString documentURI;
readonly attribute DOMString compatMode;
readonly attribute DOMString characterSet;
readonly attribute DOMString charset; // legacy alias of .characterSet
diff --git a/components/script/dom/webidls/Node.webidl b/components/script/dom/webidls/Node.webidl
index f727fa98660..6335dfc565e 100644
--- a/components/script/dom/webidls/Node.webidl
+++ b/components/script/dom/webidls/Node.webidl
@@ -26,7 +26,7 @@ interface Node : EventTarget {
readonly attribute DOMString nodeName;
[Pure]
- readonly attribute DOMString baseURI;
+ readonly attribute USVString baseURI;
[Pure]
readonly attribute Document? ownerDocument;