Bug 494217 - nsINetUtil::unescapeString drops high bytes of UTF-16 strings from JS

This fixes an issue where unescapeString will drop the high bytes of a UTF-16
string when unescaping, resulting in a loss of data.
r=bz
sr=bz
This commit is contained in:
Shawn Wilsher 2009-06-17 12:13:02 -07:00
Родитель e25711d0bd
Коммит 6a8d60b403
2 изменённых файлов: 5 добавлений и 3 удалений

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

@ -46,7 +46,7 @@ interface nsIPrefBranch;
/**
* nsINetUtil provides various network-related utility methods.
*/
[scriptable, uuid(57322c6f-f4ec-4e46-8253-b74be220de16)]
[scriptable, uuid(a50d5516-5c0a-4f08-b427-703ca0c44ac3)]
interface nsINetUtil : nsISupports
{
/**
@ -192,7 +192,7 @@ interface nsINetUtil : nsISupports
* unescaped
* @return unescaped string
*/
ACString unescapeString(in ACString aStr, in unsigned long aFlags);
ACString unescapeString(in AUTF8String aStr, in unsigned long aFlags);
/**
* Extract the charset parameter location and value from a content-type

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

@ -13,7 +13,9 @@ var tests = [
["foo%ffbar", "foo\xffbar", 0],
["%00%1b%20%61%7f%80%ff", "%00%1b%20%61%7f\x80\xff", ONLY_NONASCII],
["%00%1b%20%61%7f%80%ff", "%00%1b a%7f\x80\xff", SKIP_CONTROL],
["%00%1b%20%61%7f%80%ff", "%00%1b%20%61%7f\x80\xff", ONLY_NONASCII|SKIP_CONTROL]
["%00%1b%20%61%7f%80%ff", "%00%1b%20%61%7f\x80\xff", ONLY_NONASCII|SKIP_CONTROL],
// Test that we do not drop the high-bytes of a UTF-16 string.
["\u30a8\u30c9", "\xe3\x82\xa8\xe3\x83\x89", 0],
];
function run_test() {