From fcbfe8e3e855ef9927d4bd5c863b2c7a7517e87f Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Fri, 21 Sep 2001 04:33:47 +0000 Subject: [PATCH] Backing out part of last checkin that wasn't supposed to be checked in. --- dom/public/idl/base/nsIDOMWindowInternal.idl | 1 + dom/src/base/nsGlobalWindow.cpp | 26 ++++++++++++++++++++ dom/src/base/nsGlobalWindow.h | 1 + 3 files changed, 28 insertions(+) diff --git a/dom/public/idl/base/nsIDOMWindowInternal.idl b/dom/public/idl/base/nsIDOMWindowInternal.idl index c1dc37053ef2..a7c1f75a45f9 100644 --- a/dom/public/idl/base/nsIDOMWindowInternal.idl +++ b/dom/public/idl/base/nsIDOMWindowInternal.idl @@ -78,6 +78,7 @@ interface nsIDOMWindowInternal : nsIDOMWindow // XXX: The setter that takes a string argument needs to be special // cased! readonly attribute nsIDOMLocation location; + attribute DOMString title; attribute long innerWidth; attribute long innerHeight; diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 7937d5ca4ba6..04dc307aba0a 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -1130,6 +1130,32 @@ NS_IMETHODIMP GlobalWindowImpl::SetName(const nsAReadableString& aName) return result; } +NS_IMETHODIMP +GlobalWindowImpl::GetTitle(nsAWritableString& aTitle) +{ + aTitle = mTitle; + return NS_OK; +} + +NS_IMETHODIMP +GlobalWindowImpl::SetTitle(const nsAReadableString& aTitle) +{ + mTitle = aTitle; + if(mDocShell) { + // See if we're a chrome shell. + PRInt32 type; + nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); + docShellAsItem->GetItemType(&type); + if(type == nsIDocShellTreeItem::typeChrome) { + nsCOMPtr docShellAsWin(do_QueryInterface(mDocShell)); + if(docShellAsWin) { + docShellAsWin->SetTitle(PromiseFlatString(mTitle).get()); + } + } + } + return NS_OK; +} + NS_IMETHODIMP GlobalWindowImpl::GetInnerWidth(PRInt32* aInnerWidth) { FlushPendingNotifications(); diff --git a/dom/src/base/nsGlobalWindow.h b/dom/src/base/nsGlobalWindow.h index e760bd5c4353..39852a913747 100644 --- a/dom/src/base/nsGlobalWindow.h +++ b/dom/src/base/nsGlobalWindow.h @@ -252,6 +252,7 @@ protected: PRPackedBool mIsDocumentLoaded; // true between onload and onunload events nsString mStatus; nsString mDefaultStatus; + nsString mTitle; nsIScriptGlobalObjectOwner* mGlobalObjectOwner; // Weak Reference nsIDocShell* mDocShell; // Weak Reference