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 dc6ff15cba
commit 34ec811b55
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

View File

@ -182,7 +182,7 @@ class nsHtml5Parser : public nsIParser,
*
* @param aSourceBuffer the argument of document.write (empty for .close())
* @param aKey a key unique to the script element that caused this call
* @param aContentType ignored (for interface compat only)
* @param aContentType "text/html" for HTML mode, else text/plain mode
* @param aLastCall true if .close() false if .write()
* @param aMode ignored (for interface compat only)
*/