Bug 659763 - Make document.open("text/plain") work with the new parser. r=Olli.Pettay.

This commit is contained in:
Henri Sivonen
2011-11-01 17:27:36 +02:00
parent 282d41d3e8
commit e68cae07f7
2 changed files with 6 additions and 2 deletions

View File

@@ -239,7 +239,7 @@ nsHtml5Parser::Parse(nsIURI* aURL, // legacy parameter; ignored
NS_IMETHODIMP
nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
void* aKey,
const nsACString& aContentType, // ignored
const nsACString& aContentType,
bool aLastCall,
nsDTDMode aMode) // ignored
{
@@ -270,6 +270,10 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
mTreeBuilder->setScriptingEnabled(mExecutor->IsScriptEnabled());
mTokenizer->start();
mExecutor->Start();
if (!aContentType.EqualsLiteral("text/html")) {
mTreeBuilder->StartPlainText();
mTokenizer->StartPlainText();
}
/*
* If you move the following line, be very careful not to cause
* WillBuildModel to be called before the document has had its