Bug 376844 - Single quotes in URLs should be escaped. Patch by Wladimir Palant <trev.moz@adblockplus.org>. r=benjamin, sr=cbiesinger.

This commit is contained in:
kherron@fmailbox.com 2007-06-17 05:29:08 -07:00
Родитель 29c5133e09
Коммит 46876b4cf8
2 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,24 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const testURLs = [
["http://example.com/<", "http://example.com/%3C"],
["http://example.com/>", "http://example.com/%3E"],
["http://example.com/'", "http://example.com/%27"],
["http://example.com/\"", "http://example.com/%22"],
["http://example.com/?<", "http://example.com/?%3C"],
["http://example.com/?>", "http://example.com/?%3E"],
["http://example.com/?'", "http://example.com/?%27"],
["http://example.com/?\"", "http://example.com/?%22"]
]
function run_test() {
var ioServ =
Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
for (var i = 0; i < testURLs.length; i++) {
var uri = ioServ.newURI(testURLs[i][0], null, null);
do_check_eq(uri.spec, testURLs[i][1]);
}
}

Просмотреть файл

@ -326,7 +326,7 @@ const int EscapeChars[256] =
{ {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */
0,1023, 0, 512,1023, 0,1023,1023,1023,1023,1023,1023,1023,1023, 953, 784, /* 2x !"#$%&'()*+,-./ */ 0,1023, 0, 512,1023, 0,1023, 0,1023,1023,1023,1023,1023,1023, 953, 784, /* 2x !"#$%&'()*+,-./ */
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008, 912, 0,1008, 0, 768, /* 3x 0123456789:;<=>? */ 1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008, 912, 0,1008, 0, 768, /* 3x 0123456789:;<=>? */
1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, /* 4x @ABCDEFGHIJKLMNO */ 1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, /* 4x @ABCDEFGHIJKLMNO */
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896, 896, 896, 896,1023, /* 5x PQRSTUVWXYZ[\]^_ */ 1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896, 896, 896, 896,1023, /* 5x PQRSTUVWXYZ[\]^_ */