зеркало из https://github.com/mozilla/pjs.git
Bug 490916 - Trim space characters from encoding names in the HTML5 parser. r=jonas, a=jst.
This commit is contained in:
Родитель
c9dfa9e0d3
Коммит
75f24dbd2d
|
@ -69,6 +69,7 @@ nsHtml5MetaScanner::tryCharset(nsString* charset)
|
|||
}
|
||||
nsCAutoString encoding;
|
||||
CopyUTF16toUTF8(*charset, encoding);
|
||||
encoding.Trim(" \t\r\n\f");
|
||||
if (encoding.LowerCaseEqualsLiteral("utf-16") ||
|
||||
encoding.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
encoding.LowerCaseEqualsLiteral("utf-16le")) {
|
||||
|
|
|
@ -144,8 +144,11 @@ nsHtml5Parser::SetDocumentCharset(const nsACString& aCharset,
|
|||
NS_PRECONDITION(!mExecutor->HasStarted(),
|
||||
"Document charset set too late.");
|
||||
NS_PRECONDITION(mStreamParser, "Setting charset on a script-only parser.");
|
||||
mStreamParser->SetDocumentCharset(aCharset, aCharsetSource);
|
||||
mExecutor->SetDocumentCharsetAndSource((nsACString&)aCharset,
|
||||
nsCAutoString trimmed;
|
||||
trimmed.Assign(aCharset);
|
||||
trimmed.Trim(" \t\r\n\f");
|
||||
mStreamParser->SetDocumentCharset(trimmed, aCharsetSource);
|
||||
mExecutor->SetDocumentCharsetAndSource(trimmed,
|
||||
aCharsetSource);
|
||||
}
|
||||
|
||||
|
|
|
@ -768,7 +768,7 @@ nsHtml5StreamParser::internalEncodingDeclaration(nsString* aEncoding)
|
|||
|
||||
nsCAutoString newEncoding;
|
||||
CopyUTF16toUTF8(*aEncoding, newEncoding);
|
||||
// XXX spec says only UTF-16
|
||||
newEncoding.Trim(" \t\r\n\f");
|
||||
if (newEncoding.LowerCaseEqualsLiteral("utf-16") ||
|
||||
newEncoding.LowerCaseEqualsLiteral("utf-16be") ||
|
||||
newEncoding.LowerCaseEqualsLiteral("utf-16le")) {
|
||||
|
|
|
@ -81,6 +81,7 @@ _TEST_FILES = parser_datreader.js \
|
|||
file_bug594730-6.html \
|
||||
file_bug594730-7.html \
|
||||
file_bug594730-8.html \
|
||||
file_bug594730-9.html \
|
||||
test_bug599584.html \
|
||||
iframe_bug599584.html \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="
|
||||
Windows-1250
|
||||
">
|
||||
<script>parent.is("ø", "\u0159", "Decoded bytes should have matched the Unicode escape.");</script>
|
|
@ -22,6 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=594730
|
|||
<iframe src=file_bug594730-6.html></iframe>
|
||||
<iframe src=file_bug594730-7.html></iframe>
|
||||
<iframe src=file_bug594730-8.html></iframe>
|
||||
<iframe src=file_bug594730-9.html></iframe>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче