From 437fcbc26d2cf6313f64bb619c81558dba2f214e Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Tue, 3 Oct 2000 13:35:30 +0000 Subject: [PATCH] Fixes window.title property so that the frame window's titlebar is changed when the property changes. b=50682, r=mscott, a=mscott git-svn-id: svn://10.0.0.236/trunk@80259 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/src/base/nsGlobalWindow.cpp | 42 +++++-------------------- mozilla/dom/src/base/nsGlobalWindow.h | 1 + 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index f45b9398d19..c482982a42a 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -1056,54 +1056,26 @@ GlobalWindowImpl::SetLocation(jsval aLocation) NS_IMETHODIMP GlobalWindowImpl::GetTitle(nsAWritableString& aTitle) { - aTitle.Truncate(); - - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - if (docShellAsItem) { - // See if we're a chrome shell. - PRInt32 type; - docShellAsItem->GetItemType(&type); - if(type == nsIDocShellTreeItem::typeChrome) { - nsCOMPtr treeOwner; - GetTreeOwner(getter_AddRefs(treeOwner)); - if (treeOwner) { - nsCOMPtr primaryContent; - treeOwner->GetPrimaryContentShell(getter_AddRefs(primaryContent)); - nsCOMPtr docShellAsWin(do_QueryInterface(primaryContent)); - if (docShellAsWin) { - nsXPIDLString title; - docShellAsWin->GetTitle(getter_Copies(title)); - aTitle.Assign(title); - } - } - } - } - + aTitle = mTitle; return NS_OK; } NS_IMETHODIMP GlobalWindowImpl::SetTitle(const nsAReadableString& aTitle) { - nsCOMPtr docShellAsItem(do_QueryInterface(mDocShell)); - if(docShellAsItem) { + 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 treeOwner; - GetTreeOwner(getter_AddRefs(treeOwner)); - if (treeOwner) { - nsCOMPtr primaryContent; - treeOwner->GetPrimaryContentShell(getter_AddRefs(primaryContent)); - nsCOMPtr docShellAsWin(do_QueryInterface(primaryContent)); - if (docShellAsWin) { - docShellAsWin->SetTitle(nsPromiseFlatString(aTitle).get()); - } + nsCOMPtr docShellAsWin(do_QueryInterface(mDocShell)); + if(docShellAsWin) { + docShellAsWin->SetTitle(nsPromiseFlatString(mTitle)); } } } - return NS_OK; } diff --git a/mozilla/dom/src/base/nsGlobalWindow.h b/mozilla/dom/src/base/nsGlobalWindow.h index aef5b7cc9ad..8361db6b91d 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.h +++ b/mozilla/dom/src/base/nsGlobalWindow.h @@ -248,6 +248,7 @@ protected: PRBool mFirstDocumentLoad; nsString mStatus; nsString mDefaultStatus; + nsString mTitle; nsIScriptGlobalObjectOwner* mGlobalObjectOwner; // Weak Reference nsIDocShell* mDocShell; // Weak Reference