diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 2d009dd4159..c5d435d5156 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -987,7 +987,7 @@ impl<'a> NodeHelpers for &'a Node { fn summarize(self) -> NodeInfo { NodeInfo { uniqueId: self.get_unique_id(), - baseURI: self.GetBaseURI().unwrap_or("".to_owned()), + baseURI: self.BaseURI(), parent: self.GetParentNode().map(|node| node.r().get_unique_id()).unwrap_or("".to_owned()), nodeType: self.NodeType(), namespaceURI: "".to_owned(), //FIXME @@ -1950,9 +1950,8 @@ impl<'a> NodeMethods for &'a Node { } // https://dom.spec.whatwg.org/#dom-node-baseuri - fn GetBaseURI(self) -> Option { - // FIXME (#1824) implement. - None + fn BaseURI(self) -> DOMString { + self.owner_doc().URL() } // https://dom.spec.whatwg.org/#dom-node-ownerdocument diff --git a/components/script/dom/webidls/Node.webidl b/components/script/dom/webidls/Node.webidl index 2bc3624157a..70561bb1b72 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 DOMString baseURI; [Pure] readonly attribute Document? ownerDocument; diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index ca40eed366e..9cc668a4f88 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -13117,6 +13117,10 @@ "path": "dom/nodes/Node-appendChild.html", "url": "/dom/nodes/Node-appendChild.html" }, + { + "path": "dom/nodes/Node-baseURI.html", + "url": "/dom/nodes/Node-baseURI.html" + }, { "path": "dom/nodes/Node-childNodes.html", "url": "/dom/nodes/Node-childNodes.html" @@ -31931,4 +31935,4 @@ "rev": "87398b8448f699e3e324148795891658f2fa16dd", "url_base": "/", "version": 2 -} \ No newline at end of file +} diff --git a/tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini b/tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini index 0709e4b7387..a9ce512b7d8 100644 --- a/tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini +++ b/tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini @@ -5,7 +5,7 @@ expected: FAIL [The fallback base URL of a document containing no base element is the document's address.] - expected: FAIL + expected: PASS [The fallback base URL of a document whose address is about:blank is the document base URL of the creator document.] expected: TIMEOUT diff --git a/tests/wpt/web-platform-tests/dom/nodes/Node-baseURI.html b/tests/wpt/web-platform-tests/dom/nodes/Node-baseURI.html new file mode 100644 index 00000000000..1672b6ecd22 --- /dev/null +++ b/tests/wpt/web-platform-tests/dom/nodes/Node-baseURI.html @@ -0,0 +1,32 @@ + +Node.baseURI + + +
+