From d76b5444ccb040a33a3726cead3e42241c1f2cf1 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Tue, 18 May 1999 10:29:48 +0000 Subject: [PATCH] Popup arbitrary XUL lives! --- xpfe/appshell/src/nsWebShellWindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 48cad970660b..6f8630559354 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -995,18 +995,16 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont nsCOMPtr browserWindow = do_QueryInterface(newWindow); browserWindow->MoveTo(aXPos, aYPos); - // Get the webshell + // (2) Get the webshell nsCOMPtr newShell; newWindow->GetWebShell(*getter_AddRefs(newShell)); - // (2) Set the opener property to link the popup to the parent. nsCOMPtr domWindow; if (NS_FAILED(rv = ConvertWebShellToDOMWindow(newShell, getter_AddRefs(domWindow)))) { NS_ERROR("Unable to retrieve the DOM window from the new web shell."); return rv; } - domWindow->SetOpener(aWindow); - + // (3) We need to create a new document that clones the original document's popup // content. This new document must use the different root and a different global script // context (window object) but everything else about it is the same (namespaces, URLs, @@ -1076,12 +1074,15 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont nsCOMPtr blurListener = do_QueryInterface(popupListener); nsCOMPtr targetWindow = do_QueryInterface(domWindow); targetWindow->AddEventListener("blur", blurListener, PR_FALSE, PR_FALSE); - - // (8) Show the window, and give the window the focus. + + // (8) Set up the opener property + domWindow->SetOpener(aWindow); + + // (9) Show the window, and give the window the focus. newWindow->Show(PR_TRUE); domWindow->Focus(); - // (9) Do some layout. + // (10) Do some layout. nsCOMPtr popupChild = do_QueryInterface(popupDocument); popupChild->LayoutPopupDocument();