1 const ONLY_NONASCII = Components.interfaces.nsINetUtil.ESCAPE_URL_ONLY_NONASCII;
2 const SKIP_CONTROL = Components.interfaces.nsINetUtil.ESCAPE_URL_SKIP_CONTROL;
7 ["foo%20bar", "foo bar", 0],
8 ["foo%2zbar", "foo%2zbar", 0],
10 ["%zzfoo", "%zzfoo", 0],
11 ["foo%z", "foo%z", 0],
12 ["foo%00bar", "foo\x00bar", 0],
13 ["foo%ffbar", "foo\xffbar", 0],
14 ["%00%1b%20%61%7f%80%ff", "%00%1b%20%61%7f\x80\xff", ONLY_NONASCII],
15 ["%00%1b%20%61%7f%80%ff", "%00%1b a%7f\x80\xff", SKIP_CONTROL],
16 ["%00%1b%20%61%7f%80%ff", "%00%1b%20%61%7f\x80\xff", ONLY_NONASCII|SKIP_CONTROL]
20 var util = Components.classes["@mozilla.org/network/util;1"]
21 .getService(Components.interfaces.nsINetUtil);
23 for (var i = 0; i < tests.length; ++i) {
24 dump("Test " + i + " (" + tests[i][0] + ", " + tests[i][2] + ")\n");
25 do_check_eq(util.unescapeString(tests[i][0], tests[i][2]),
28 dump(tests.length + " tests passed\n");