Bug 539887 - Make document.written meta charset affect the charset of document.opened documents in the HTML5 parser. r=bnewman.

This commit is contained in:
Henri Sivonen
2010-03-09 14:39:32 +02:00
parent 81c7345b10
commit b70fd25289
28 changed files with 169 additions and 28 deletions

View File

@@ -201,9 +201,13 @@ nsHtml5TreeOpExecutor::FlushPendingNotifications(mozFlushType aType)
{
}
NS_IMETHODIMP
nsHtml5TreeOpExecutor::SetDocumentCharset(nsACString& aCharset)
void
nsHtml5TreeOpExecutor::SetDocumentCharsetAndSource(nsACString& aCharset, PRInt32 aCharsetSource)
{
if (mDocument) {
mDocument->SetDocumentCharacterSetSource(aCharsetSource);
mDocument->SetDocumentCharacterSet(aCharset);
}
if (mDocShell) {
// the following logic to get muCV is copied from
// nsHTMLDocument::StartDocumentLoad
@@ -220,7 +224,9 @@ nsHtml5TreeOpExecutor::SetDocumentCharset(nsACString& aCharset)
// parent and parentContentViewer
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
do_QueryInterface(mDocShell);
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
if (!docShellAsItem) {
return;
}
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
docShellAsItem->GetSameTypeParent(getter_AddRefs(parentAsItem));
nsCOMPtr<nsIDocShell> parent(do_QueryInterface(parentAsItem));
@@ -237,10 +243,6 @@ nsHtml5TreeOpExecutor::SetDocumentCharset(nsACString& aCharset)
muCV->SetPrevDocCharacterSet(aCharset);
}
}
if (mDocument) {
mDocument->SetDocumentCharacterSet(aCharset);
}
return NS_OK;
}
nsISupports*