diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /dom/tests/mochitest/dom-level0/idn_child.html | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/tests/mochitest/dom-level0/idn_child.html')
-rw-r--r-- | dom/tests/mochitest/dom-level0/idn_child.html | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/dom/tests/mochitest/dom-level0/idn_child.html b/dom/tests/mochitest/dom-level0/idn_child.html new file mode 100644 index 0000000000..7a44d790ea --- /dev/null +++ b/dom/tests/mochitest/dom-level0/idn_child.html @@ -0,0 +1,97 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>Child window on a site whose "base" domain contains IDN</title> + <script type="application/javascript"> +function run() +{ + var target = document.getElementById("location"); + target.textContent = location.hostname + ":" + (location.port || 80); +} + +function receiveMessage(evt) +{ + if (evt.origin !== "http://mochi.test:8888") + return; + + var message = evt.data + "-response"; + + var domain = document.domain; + if (/test$/.test(domain)) + { + if (domain !== "sub1.xn--exaple-kqf.test") + message += " wrong-initial-domain(" + domain + ")"; + } + else + { + if (domain !== "sub1.xn--hxajbheg2az3al.xn--jxalpdlp") + message += " wrong-initial-domain(" + domain + ")"; + } + + switch (location.search) + { + case "?idn-whitelist": + message += idnTest("παράδειγμα.δοκιμή"); + break; + + case "?punycode-whitelist": + message += punycodeTest("xn--hxajbheg2az3al.xn--jxalpdlp"); + break; + + case "?idn-nowhitelist": + message += idnTest("exaмple.test"); + break; + + case "?punycode-nowhitelist": + message += punycodeTest("xn--exaple-kqf.test"); + break; + + default: + message += " unexpected-query(" + location.search + ")"; + break; + } + + evt.source.postMessage(message, evt.origin); +} + +function idnTest(newDomain) +{ + var errors = ""; + + try + { + document.domain = newDomain; + } + catch (e) + { + errors += " error-thrown-setting-to-idn(" + String(e).split("").join(",") + ")"; + } + + return errors; +} + +function punycodeTest(newDomain) +{ + var errors = ""; + + try + { + document.domain = newDomain; + } + catch (e) + { + errors += " error-thrown-setting-to-punycode(" + String(e).split("").join(",") + ")"; + } + + return errors; +} + +window.addEventListener("message", receiveMessage); +window.addEventListener("load", run); + </script> +</head> +<body> +<h1 id="location">Somewhere!</h1> +</body> +</html> |