Bug 741218 - Don't crash when loading a page with content-type application/json; r=hsivonen

This commit is contained in:
Ms2ger 2012-04-03 09:25:38 +02:00
parent 2ded0a7107
commit 93421f3fbd
4 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
Content-Type: application/json

View File

@ -13,3 +13,4 @@ load 495543.svg
load 564461.xhtml
load 601422.html
load 631421.html
load 741218.json

View File

@ -584,14 +584,15 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
}
bool html = contentType.EqualsLiteral(TEXT_HTML);
bool xhtml = !html && contentType.Equals("application/xhtml+xml");
bool xhtml = !html && contentType.EqualsLiteral(APPLICATION_XHTML_XML);
bool plainText = !html && !xhtml && (contentType.EqualsLiteral(TEXT_PLAIN) ||
contentType.EqualsLiteral(TEXT_CSS) ||
contentType.EqualsLiteral(APPLICATION_JAVASCRIPT) ||
contentType.EqualsLiteral(APPLICATION_XJAVASCRIPT) ||
contentType.EqualsLiteral(TEXT_ECMASCRIPT) ||
contentType.EqualsLiteral(APPLICATION_ECMASCRIPT) ||
contentType.EqualsLiteral(TEXT_JAVASCRIPT));
contentType.EqualsLiteral(TEXT_JAVASCRIPT) ||
contentType.EqualsLiteral(APPLICATION_JSON));
if (!(html || xhtml || plainText || viewSource)) {
MOZ_NOT_REACHED("Channel with bad content type.");
return NS_ERROR_INVALID_ARG;