diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index a90cf1166a3..be8ce9456e1 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -20,7 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * Harshal Pradhan * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -532,6 +532,14 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent, GetWindowTreeItem(aParent, getter_AddRefs(shelltree)); if (shelltree) shelltree->GetSameTypeRootTreeItem(getter_AddRefs(newDocShellItem)); + } else if (name.EqualsIgnoreCase("_parent")) { + nsCOMPtr shelltree; + GetWindowTreeItem(aParent, getter_AddRefs(shelltree)); + if (shelltree) + shelltree->GetSameTypeParent(getter_AddRefs(newDocShellItem)); + // If there is no real parent then _self acts as _parent + if (!newDocShellItem) + newDocShellItem = shelltree; } else { /* parent is being simultaneously torn down (probably because of the code that keeps an old docshell alive but disconnected while