From 37eb127da891708c83e02c8dbb1ea1a6b3c28e9f Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Mon, 19 Apr 1999 21:08:12 +0000 Subject: [PATCH] Altering the window.open call so that it can supply info for a webshell to be created asynchronously. git-svn-id: svn://10.0.0.236/trunk@28075 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/dom/src/base/nsGlobalWindow.cpp | 33 +++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 5b4ade9b667..0b668e94734 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -1478,16 +1478,38 @@ GlobalWindowImpl::Open(JSContext *cx, /* XXX check for existing window of same name. If exists, set url and * update chrome */ + PRBool couldCreate = PR_TRUE; if (NS_OK == mWebShell->GetContainer(webShellContainer) && nsnull != webShellContainer) { // Check for existing window of same name. webShellContainer->FindWebShellWithName(name.GetUnicode(), newWebShell); if (nsnull == newWebShell) { - // No window of that name so create a new one. - webShellContainer->NewWebShell(mChrome, PR_FALSE, newWebShell); + // The web shell container may wish to perform an asynchronous instantiation + // of the web shell and of the new container. Supply the container with + // sufficient information to perform the web shell linkage on its own, + // without having to supply a new web shell now. + webShellContainer->CanCreateNewWebShell(couldCreate); + if (couldCreate) + { + // No window of that name, and we are allowed to create a new one now. + webShellContainer->NewWebShell(mChrome, PR_FALSE, newWebShell); + } + else + { + // Supply all the information required so that the new web shell + // container can perform the linkage on its own at a later date. + webShellContainer->SetNewWebShellInfo(name, + mAbsURL, + mWebShell, + mChrome, + &newWebShell); + } } + if (nsnull != newWebShell) { - newWebShell->SetName(name.GetUnicode()); - newWebShell->LoadURL(mAbsURL.GetUnicode()); + if (couldCreate) { + newWebShell->SetName(name.GetUnicode()); + newWebShell->LoadURL(mAbsURL.GetUnicode()); + } if (NS_OK == newWebShell->GetContainer(newContainer) && nsnull != newContainer) { newContainer->QueryInterface(kIBrowserWindowIID, (void**)&newWindow); @@ -1531,7 +1553,8 @@ GlobalWindowImpl::Open(JSContext *cx, } /* Set opener */ - newGlobalObject->SetOpenerWindow(this); + if (couldCreate) + newGlobalObject->SetOpenerWindow(this); }