summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/url/script-tests/mailto.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/url/script-tests/mailto.js')
-rw-r--r--LayoutTests/fast/url/script-tests/mailto.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/LayoutTests/fast/url/script-tests/mailto.js b/LayoutTests/fast/url/script-tests/mailto.js
new file mode 100644
index 0000000..7786d7f
--- /dev/null
+++ b/LayoutTests/fast/url/script-tests/mailto.js
@@ -0,0 +1,31 @@
+description("Tests mailto: URL canonicalization");
+
+cases = [
+ ["addr1", "addr1"],
+ ["addr1@foo.com", "addr1@foo.com"],
+
+ // Trailing whitespace is stripped.
+ ["addr1 \t ", "addr1"],
+ ["addr1?to=jon", "addr1?to=jon"],
+ ["addr1,addr2", "addr1,addr2"],
+ ["addr1, addr2", "addr1, addr2"],
+ ["addr1%2caddr2", "addr1%2caddr2"],
+
+ // U+10300 input as UTF-16 surrogate pair, expected as escaped UTF-8
+ ["\uD800\uDF00", "%F0%90%8C%80"],
+ ["addr1?", "addr1?"],
+
+ // Null character should be escaped to %00
+ // Not sure how to test null characters in JavaScript. They appear to get
+ // stripped out.
+ // ["addr1\\0addr2?foo", "addr1%00addr2?foo"],
+];
+
+for (var i = 0; i < cases.length; ++i) {
+ shouldBe("canonicalize('mailto:" + cases[i][0] + "')",
+ "'mailto:" + cases[i][1] + "'");
+}
+ // Invalid -- UTF-8 encoded surrogate value.
+shouldBeFalse("canonicalize('mailto:\xed\xa0\x80') == 'mailto:%EF%BF%BD'");
+
+var successfullyParsed = true;