nsHtml5Parser::SetDocumentCharset(const nsACString& aCharset, PRInt32 aCharsetSource) { 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, aCharsetSource); }
nsHtml5Parser::SetDocumentCharset(const nsACString& aCharset, PRInt32 aCharsetSource) { NS_PRECONDITION(!mExecutor->HasStarted(), "Document charset set too late."); NS_PRECONDITION(mStreamParser, "Setting charset on a script-only parser."); nsCAutoString trimmed; trimmed.Assign(aCharset); trimmed.Trim(" \t\r\n\f"); mStreamParser->SetDocumentCharset(trimmed, aCharsetSource); mExecutor->SetDocumentCharsetAndSource(trimmed, aCharsetSource); }