Bug 118704. Get the document title from the DOM instead of storing it as a string in the document. r+sr=jst

This commit is contained in:
Robert O'Callahan 2008-08-16 21:01:46 +12:00
parent 8a93e089c6
commit 78a2558a52

View File

@ -112,6 +112,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsISelectionListener.h"
#include "nsISelectionPrivate.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIDOMHTMLElement.h"
@ -1153,7 +1154,9 @@ nsPrintEngine::GetDocumentTitleAndURL(nsIDocument* aDoc,
*aTitle = nsnull;
*aURLStr = nsnull;
const nsAString &docTitle = aDoc->GetDocumentTitle();
nsAutoString docTitle;
nsCOMPtr<nsIDOMNSDocument> doc = do_QueryInterface(aDoc);
doc->GetTitle(docTitle);
if (!docTitle.IsEmpty()) {
*aTitle = ToNewUnicode(docTitle);
}