Deprecate window.title b=264102 r=jst sr=peterv

This commit is contained in:
neil%parkwaycc.co.uk 2004-10-24 22:57:06 +00:00
Родитель d97bc68618
Коммит 1dbdacbc2f
2 изменённых файлов: 21 добавлений и 12 удалений

Просмотреть файл

@ -84,6 +84,7 @@
#include "nsIHTMLDocument.h"
#include "nsIDOMCrypto.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocumentEvent.h"
@ -5489,25 +5490,35 @@ NS_IMPL_RELEASE_INHERITED(nsGlobalChromeWindow, GlobalWindowImpl)
// nsGlobalChromeWindow implementation
static void TitleConsoleWarning()
{
nsCOMPtr<nsIConsoleService> console(do_GetService("@mozilla.org/consoleservice;1"));
if (console)
console->LogStringMessage(NS_LITERAL_STRING("Deprecated property window.title used. Please use document.title instead.").get());
}
NS_IMETHODIMP
nsGlobalChromeWindow::GetTitle(nsAString& aTitle)
{
aTitle = mTitle;
return NS_OK;
NS_ERROR("nsIDOMChromeWindow::GetTitle is deprecated, use nsIDOMNSDocument instead");
TitleConsoleWarning();
nsresult rv;
nsCOMPtr<nsIDOMNSDocument> nsdoc(do_QueryInterface(mDocument, &rv));
NS_ENSURE_SUCCESS(rv, rv);
return nsdoc->GetTitle(aTitle);
}
NS_IMETHODIMP
nsGlobalChromeWindow::SetTitle(const nsAString& aTitle)
{
mTitle = aTitle;
if(mDocShell) {
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
if(docShellAsWin) {
docShellAsWin->SetTitle(PromiseFlatString(mTitle).get());
}
}
NS_ERROR("nsIDOMChromeWindow::SetTitle is deprecated, use nsIDOMNSDocument instead");
TitleConsoleWarning();
return NS_OK;
nsresult rv;
nsCOMPtr<nsIDOMNSDocument> nsdoc(do_QueryInterface(mDocument, &rv));
NS_ENSURE_SUCCESS(rv, rv);
return nsdoc->SetTitle(aTitle);
}
NS_IMETHODIMP

Просмотреть файл

@ -363,8 +363,6 @@ public:
protected:
nsresult GetMainWidget(nsIWidget** aMainWidget);
nsString mTitle;
};
/*