mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
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 -->
This commit is contained in:
commit
e8e7c6545d
4 changed files with 16 additions and 13 deletions
|
@ -27,7 +27,7 @@ use dom::bindings::js::{JS, LayoutJS, MutNullableHeap, Root};
|
||||||
use dom::bindings::num::Finite;
|
use dom::bindings::num::Finite;
|
||||||
use dom::bindings::refcounted::Trusted;
|
use dom::bindings::refcounted::Trusted;
|
||||||
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
|
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::trace::RootedVec;
|
||||||
use dom::bindings::xmlname::XMLName::InvalidXMLName;
|
use dom::bindings::xmlname::XMLName::InvalidXMLName;
|
||||||
use dom::bindings::xmlname::{validate_and_extract, namespace_from_domstring, xml_name_type};
|
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
|
// https://dom.spec.whatwg.org/#dom-document-url
|
||||||
fn URL(&self) -> DOMString {
|
fn URL(&self) -> USVString {
|
||||||
DOMString::from(self.url().as_str())
|
USVString(String::from(self.url().as_str()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-document-activeelement
|
// 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
|
// https://dom.spec.whatwg.org/#dom-document-documenturi
|
||||||
fn DocumentURI(&self) -> DOMString {
|
fn DocumentURI(&self) -> USVString {
|
||||||
self.URL()
|
self.URL()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2192,8 +2192,10 @@ impl DocumentMethods for Document {
|
||||||
)),
|
)),
|
||||||
"webglcontextevent" =>
|
"webglcontextevent" =>
|
||||||
Ok(Root::upcast(WebGLContextEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
|
Ok(Root::upcast(WebGLContextEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
|
||||||
"storageevent" =>
|
"storageevent" => {
|
||||||
Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, self.URL()))),
|
let USVString(url) = self.URL();
|
||||||
|
Ok(Root::upcast(StorageEvent::new_uninitialized(&self.window, DOMString::from(url))))
|
||||||
|
},
|
||||||
"progressevent" =>
|
"progressevent" =>
|
||||||
Ok(Root::upcast(ProgressEvent::new_uninitialized(&self.window))),
|
Ok(Root::upcast(ProgressEvent::new_uninitialized(&self.window))),
|
||||||
"focusevent" =>
|
"focusevent" =>
|
||||||
|
|
|
@ -28,7 +28,7 @@ use dom::bindings::js::Root;
|
||||||
use dom::bindings::js::RootedReference;
|
use dom::bindings::js::RootedReference;
|
||||||
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
|
use dom::bindings::js::{JS, LayoutJS, MutNullableHeap};
|
||||||
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
|
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::trace::RootedVec;
|
||||||
use dom::bindings::xmlname::namespace_from_domstring;
|
use dom::bindings::xmlname::namespace_from_domstring;
|
||||||
use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers};
|
use dom::characterdata::{CharacterData, LayoutCharacterDataHelpers};
|
||||||
|
@ -804,9 +804,10 @@ impl Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn summarize(&self) -> NodeInfo {
|
pub fn summarize(&self) -> NodeInfo {
|
||||||
|
let USVString(baseURI) = self.BaseURI();
|
||||||
NodeInfo {
|
NodeInfo {
|
||||||
uniqueId: self.unique_id(),
|
uniqueId: self.unique_id(),
|
||||||
baseURI: String::from(self.BaseURI()),
|
baseURI: baseURI,
|
||||||
parent: self.GetParentNode().map_or("".to_owned(), |node| node.unique_id()),
|
parent: self.GetParentNode().map_or("".to_owned(), |node| node.unique_id()),
|
||||||
nodeType: self.NodeType(),
|
nodeType: self.NodeType(),
|
||||||
namespaceURI: String::new(), //FIXME
|
namespaceURI: String::new(), //FIXME
|
||||||
|
@ -1860,8 +1861,8 @@ impl NodeMethods for Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-node-baseuri
|
// https://dom.spec.whatwg.org/#dom-node-baseuri
|
||||||
fn BaseURI(&self) -> DOMString {
|
fn BaseURI(&self) -> USVString {
|
||||||
DOMString::from(self.owner_doc().base_url().as_str())
|
USVString(String::from(self.owner_doc().base_url().as_str()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-node-ownerdocument
|
// https://dom.spec.whatwg.org/#dom-node-ownerdocument
|
||||||
|
|
|
@ -13,10 +13,10 @@ interface Document : Node {
|
||||||
[SameObject]
|
[SameObject]
|
||||||
readonly attribute DOMImplementation implementation;
|
readonly attribute DOMImplementation implementation;
|
||||||
[Constant]
|
[Constant]
|
||||||
readonly attribute DOMString URL;
|
readonly attribute USVString URL;
|
||||||
readonly attribute Element? activeElement;
|
readonly attribute Element? activeElement;
|
||||||
[Constant]
|
[Constant]
|
||||||
readonly attribute DOMString documentURI;
|
readonly attribute USVString documentURI;
|
||||||
readonly attribute DOMString compatMode;
|
readonly attribute DOMString compatMode;
|
||||||
readonly attribute DOMString characterSet;
|
readonly attribute DOMString characterSet;
|
||||||
readonly attribute DOMString charset; // legacy alias of .characterSet
|
readonly attribute DOMString charset; // legacy alias of .characterSet
|
||||||
|
|
|
@ -26,7 +26,7 @@ interface Node : EventTarget {
|
||||||
readonly attribute DOMString nodeName;
|
readonly attribute DOMString nodeName;
|
||||||
|
|
||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute DOMString baseURI;
|
readonly attribute USVString baseURI;
|
||||||
|
|
||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute Document? ownerDocument;
|
readonly attribute Document? ownerDocument;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue