fixes bug 296163 "PAC files containing non-ASCII text (comments) fail to load." r=biesi a=asa

This commit is contained in:
darin%meer.net 2005-06-20 17:47:38 +00:00
Родитель 08464ff71a
Коммит 12c1b15b09
1 изменённых файлов: 4 добавлений и 9 удалений

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

@ -373,16 +373,11 @@ nsPACMan::OnStreamComplete(nsIStreamLoader *loader,
NS_WARNING("failed to instantiate PAC component");
}
if (NS_SUCCEEDED(status)) {
// We assume that the PAC text is ASCII. We've had this assumption
// forever, so no reason to change this now.
// We assume that the PAC text is ASCII (or ISO-Latin-1). We've had this
// assumption forever, and some real-world PAC scripts actually have some
// non-ASCII text in comment blocks (see bug 296163).
const char *text = (const char *) data;
if (!nsCRT::IsAscii(text, dataLen)) {
NS_WARNING("PAC text is not ASCII");
status = NS_ERROR_UNEXPECTED;
}
else {
status = mPAC->Init(pacURI, NS_ConvertASCIItoUTF16(text, dataLen));
}
status = mPAC->Init(pacURI, NS_ConvertASCIItoUTF16(text, dataLen));
}
}