mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Attach nsGlobalWindow's title property to the primary content document's title property. b=41984, r=jst
This commit is contained in:
parent
3bf37c3125
commit
1f402e7d0a
@ -978,37 +978,50 @@ GlobalWindowImpl::SetLocation(jsval aLocation)
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::GetTitle(nsAWritableString& aTitle)
|
||||
{
|
||||
aTitle.Truncate();
|
||||
if (mDocShell) {
|
||||
aTitle.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
if (docShellAsItem) {
|
||||
// See if we're a chrome shell.
|
||||
PRInt32 type;
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
docShellAsItem->GetItemType(&type);
|
||||
if(type == nsIDocShellTreeItem::typeChrome) {
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
|
||||
if(docShellAsWin) {
|
||||
nsXPIDLString title;
|
||||
docShellAsWin->GetTitle(getter_Copies(title));
|
||||
|
||||
aTitle.Assign(title);
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
if (treeOwner) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> primaryContent;
|
||||
treeOwner->GetPrimaryContentShell(getter_AddRefs(primaryContent));
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(primaryContent));
|
||||
if (docShellAsWin) {
|
||||
nsXPIDLString title;
|
||||
docShellAsWin->GetTitle(getter_Copies(title));
|
||||
aTitle.Assign(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::SetTitle(const nsAReadableString& aTitle)
|
||||
{
|
||||
if(mDocShell) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
if(docShellAsItem) {
|
||||
// See if we're a chrome shell.
|
||||
PRInt32 type;
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
docShellAsItem->GetItemType(&type);
|
||||
if(type == nsIDocShellTreeItem::typeChrome) {
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
|
||||
if(docShellAsWin) {
|
||||
docShellAsWin->SetTitle(nsPromiseFlatString(aTitle));
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
if (treeOwner) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> primaryContent;
|
||||
treeOwner->GetPrimaryContentShell(getter_AddRefs(primaryContent));
|
||||
nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(primaryContent));
|
||||
if (docShellAsWin) {
|
||||
docShellAsWin->SetTitle(nsPromiseFlatString(aTitle));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user