Popup arbitrary XUL lives!

This commit is contained in:
hyatt%netscape.com 1999-05-18 10:29:48 +00:00
parent 05c0e4129e
commit d76b5444cc

View File

@ -995,18 +995,16 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont
nsCOMPtr<nsIBrowserWindow> browserWindow = do_QueryInterface(newWindow); nsCOMPtr<nsIBrowserWindow> browserWindow = do_QueryInterface(newWindow);
browserWindow->MoveTo(aXPos, aYPos); browserWindow->MoveTo(aXPos, aYPos);
// Get the webshell // (2) Get the webshell
nsCOMPtr<nsIWebShell> newShell; nsCOMPtr<nsIWebShell> newShell;
newWindow->GetWebShell(*getter_AddRefs(newShell)); newWindow->GetWebShell(*getter_AddRefs(newShell));
// (2) Set the opener property to link the popup to the parent.
nsCOMPtr<nsIDOMWindow> domWindow; nsCOMPtr<nsIDOMWindow> domWindow;
if (NS_FAILED(rv = ConvertWebShellToDOMWindow(newShell, getter_AddRefs(domWindow)))) { if (NS_FAILED(rv = ConvertWebShellToDOMWindow(newShell, getter_AddRefs(domWindow)))) {
NS_ERROR("Unable to retrieve the DOM window from the new web shell."); NS_ERROR("Unable to retrieve the DOM window from the new web shell.");
return rv; return rv;
} }
domWindow->SetOpener(aWindow);
// (3) We need to create a new document that clones the original document's popup // (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 // 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, // context (window object) but everything else about it is the same (namespaces, URLs,
@ -1076,12 +1074,15 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont
nsCOMPtr<nsIDOMFocusListener> blurListener = do_QueryInterface(popupListener); nsCOMPtr<nsIDOMFocusListener> blurListener = do_QueryInterface(popupListener);
nsCOMPtr<nsIDOMEventTarget> targetWindow = do_QueryInterface(domWindow); nsCOMPtr<nsIDOMEventTarget> targetWindow = do_QueryInterface(domWindow);
targetWindow->AddEventListener("blur", blurListener, PR_FALSE, PR_FALSE); 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); newWindow->Show(PR_TRUE);
domWindow->Focus(); domWindow->Focus();
// (9) Do some layout. // (10) Do some layout.
nsCOMPtr<nsIXULChildDocument> popupChild = do_QueryInterface(popupDocument); nsCOMPtr<nsIXULChildDocument> popupChild = do_QueryInterface(popupDocument);
popupChild->LayoutPopupDocument(); popupChild->LayoutPopupDocument();