diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index 1553e8b5b0a..8ecffe60b33 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -13,6 +13,7 @@ use dom::urlhelper::UrlHelper; use dom::urlsearchparams::URLSearchParams; use std::borrow::ToOwned; use std::default::Default; +use url::quirks::domain_to_unicode; use url::{Host, Url}; // https://url.spec.whatwg.org/#url @@ -100,6 +101,10 @@ impl URL { USVString("".to_owned()) } } + + pub fn DomainToUnicode(_: GlobalRef, origin: USVString) -> USVString { + USVString(domain_to_unicode(&origin.0)) + } } impl URLMethods for URL { diff --git a/components/script/dom/webidls/URL.webidl b/components/script/dom/webidls/URL.webidl index 6843bd8b6c2..dc4c71f512e 100644 --- a/components/script/dom/webidls/URL.webidl +++ b/components/script/dom/webidls/URL.webidl @@ -7,7 +7,7 @@ Exposed=(Window,Worker)*/] interface URL { static USVString domainToASCII(USVString domain); - // static USVString domainToUnicode(USVString domain); + static USVString domainToUnicode(USVString domain); [SetterThrows] /*stringifier*/ attribute USVString href; diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index f0412365099..7033fdde433 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -36028,7 +36028,16 @@ "local_changes": { "deleted": [], "deleted_reftests": {}, - "items": {}, + "items": { + "testharness": { + "url/url-domainToUnicode.html": [ + { + "path": "url/url-domainToUnicode.html", + "url": "/url/url-domainToUnicode.html" + } + ] + } + }, "reftest_nodes": {} }, "reftest_nodes": { diff --git a/tests/wpt/metadata/url/interfaces.html.ini b/tests/wpt/metadata/url/interfaces.html.ini deleted file mode 100644 index 0a2550533c1..00000000000 --- a/tests/wpt/metadata/url/interfaces.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[interfaces.html] - type: testharness - [URL interface: operation domainToUnicode(ScalarValueString)] - expected: FAIL - - [URL interface: operation domainToUnicode(USVString)] - expected: FAIL - diff --git a/tests/wpt/web-platform-tests/url/url-domainToUnicode.html b/tests/wpt/web-platform-tests/url/url-domainToUnicode.html new file mode 100644 index 00000000000..1bd5536799a --- /dev/null +++ b/tests/wpt/web-platform-tests/url/url-domainToUnicode.html @@ -0,0 +1,21 @@ + + +