Bug 1320925 - Backout changeset b80531102366 (bug 1254098) a=backout

MozReview-Commit-ID: 1tX0Keg66Dc
This commit is contained in:
Valentin Gosu 2017-02-07 21:07:30 +01:00
Родитель 067250e70a
Коммит 2f7cc13432
1 изменённых файлов: 16 добавлений и 2 удалений

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

@ -3245,8 +3245,22 @@ nsStandardURL::Init(uint32_t urlType,
mOriginCharset.Truncate();
//if charset override is absent, use UTF8 as url encoding
if (charset != nullptr && *charset != '\0' && !IsUTFCharset(charset)) {
if (charset == nullptr || *charset == '\0') {
// check if baseURI provides an origin charset and use that.
if (baseURI)
baseURI->GetOriginCharset(mOriginCharset);
// URI can't be encoded in UTF-16, UTF-16BE, UTF-16LE, UTF-32,
// UTF-32-LE, UTF-32LE, UTF-32BE (yet?). Truncate mOriginCharset if
// it starts with "utf" (since an empty mOriginCharset implies
// UTF-8, this is safe even if mOriginCharset is UTF-8).
if (mOriginCharset.Length() > 3 &&
IsUTFCharset(mOriginCharset.get())) {
mOriginCharset.Truncate();
}
}
else if (!IsUTFCharset(charset)) {
mOriginCharset = charset;
}