Fix for bug 44608. Added nsIDocShellTreeOwner::ExitModalLoop() and nsIWebBrowserChrome::ExitModalEventLoop(). r=rpotts,a=valeski

git-svn-id: svn://10.0.0.236/trunk@74129 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
vidur%netscape.com
2000-07-12 23:56:14 +00:00
parent fb9119fcee
commit ffd0cb1a4e
11 changed files with 74 additions and 6 deletions

View File

@@ -70,7 +70,13 @@ interface nsIDocShellTreeOwner : nsISupports
Shows the window as a modal window.
*/
void showModal();
/*
Exit a modal loop if we're in one
@param aStatus - the result code to return from showModal
*/
void exitModalLoop(in nsresult aStatus);
/*
Tells the implementer of this interface to create a new window. This is
a new logical window. Meaning in some implementations the result may not

View File

@@ -457,6 +457,12 @@ CWebBrowserContainer::ShowModal()
return NS_OK;
}
NS_IMETHODIMP
CWebBrowserContainer::ExitModalLoop(nsresult aStatus)
{
// Ignore request to exit modal loop
return NS_OK;
}
NS_IMETHODIMP CWebBrowserContainer::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
@@ -728,6 +734,13 @@ CWebBrowserContainer::ShowAsModal(void)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CWebBrowserContainer::ExitModalEventLoop(nsresult aStatus)
{
// Ignore request to exit modal loop
return NS_OK;
}
NS_IMETHODIMP
CWebBrowserContainer::SetPersistence(PRBool aPersistX, PRBool aPersistY,

View File

@@ -520,6 +520,12 @@ NS_IMETHODIMP GtkMozEmbedChrome::ShowAsModal(void)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP GtkMozEmbedChrome::ExitModalEventLoop(nsresult aStatus)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::ExitModalLoop\n"));
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsIURIContentListener
NS_IMETHODIMP GtkMozEmbedChrome::OnStartURIOpen(nsIURI *aURI, const char *aWindowTarget, PRBool *aAbortOpen)

View File

@@ -224,6 +224,11 @@ NS_IMETHODIMP CWebBrowserChrome::ShowAsModal(void)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP CWebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
{
NS_ERROR("Haven't Implemented this yet");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CWebBrowserChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,

View File

@@ -206,6 +206,14 @@ NS_IMETHODIMP nsDocShellTreeOwner::ShowModal()
return mWebBrowserChrome->ShowAsModal();
}
NS_IMETHODIMP nsDocShellTreeOwner::ExitModalLoop(nsresult aStatus)
{
if(mTreeOwner)
return mTreeOwner->ExitModalLoop(aStatus);
return mWebBrowserChrome->ExitModalEventLoop(aStatus);
}
NS_IMETHODIMP nsDocShellTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
{

View File

@@ -124,6 +124,13 @@ interface nsIWebBrowserChrome : nsISupports
*/
void showAsModal();
/**
Exit a modal event loop if we're in one. The implementation
should also exit out of the loop if the window is destroyed.
@param aStatus - the result code to return from showAsModal
*/
void exitModalEventLoop(in nsresult aStatus);
/*
Sets the persistence of different dimensions of the window.
*/

View File

@@ -191,6 +191,12 @@ NS_IMETHODIMP nsWebBrowserChrome::ShowAsModal()
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsWebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
{
NS_ERROR("Haven't Implemented this yet");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsWebBrowserChrome::SetPersistence(PRBool aPersistX, PRBool aPersistY,
PRBool aPersistCX, PRBool aPersistCY,

View File

@@ -181,6 +181,11 @@ NS_IMETHODIMP nsChromeTreeOwner::ShowModal()
return mXULWindow->ShowModal();
}
NS_IMETHODIMP nsChromeTreeOwner::ExitModalLoop(nsresult aStatus)
{
return mXULWindow->ExitModalLoop(aStatus);
}
NS_IMETHODIMP nsChromeTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
{

View File

@@ -183,6 +183,11 @@ NS_IMETHODIMP nsContentTreeOwner::ShowModal()
return mXULWindow->ShowModal();
}
NS_IMETHODIMP nsContentTreeOwner::ExitModalLoop(nsresult aStatus)
{
return mXULWindow->ExitModalLoop(aStatus);
}
NS_IMETHODIMP nsContentTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem)
{
@@ -300,6 +305,11 @@ NS_IMETHODIMP nsContentTreeOwner::ShowAsModal()
return ShowModal();
}
NS_IMETHODIMP nsContentTreeOwner::ExitModalEventLoop(nsresult aStatus)
{
return ExitModalLoop(aStatus);
}
NS_IMETHODIMP
nsContentTreeOwner::SetPersistence(PRBool aPersistX, PRBool aPersistY,
PRBool aPersistCX, PRBool aPersistCY,

View File

@@ -68,7 +68,7 @@ static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
nsXULWindow::nsXULWindow() : mChromeTreeOwner(nsnull),
mContentTreeOwner(nsnull), mPrimaryContentTreeOwner(nsnull),
mContinueModalLoop(PR_FALSE), mChromeLoaded(PR_FALSE),
mContinueModalLoop(PR_FALSE), mModalStatus(NS_OK), mChromeLoaded(PR_FALSE),
mShowAfterLoad(PR_FALSE), mIntrinsicallySized(PR_FALSE),
mCenterAfterLoad(PR_FALSE), mZlevel(nsIXULWindow::normalZ)
@@ -243,7 +243,7 @@ NS_IMETHODIMP nsXULWindow::ShowModal()
window->SetModal(PR_FALSE);
appShell->Spindown();
return NS_OK;
return mModalStatus;
}
//*****************************************************************************
@@ -306,7 +306,7 @@ NS_IMETHODIMP nsXULWindow::Destroy()
// a convenience, the hide prevents user interaction with the partially
// destroyed window. This is especially necessary when the eldest window
// in a stack of modal windows is destroyed first. It happens.
ExitModalLoop();
ExitModalLoop(NS_OK);
mWindow->Show(PR_FALSE);
mDOMWindow = nsnull;
@@ -963,11 +963,12 @@ NS_IMETHODIMP nsXULWindow::SizeShellTo(nsIDocShellTreeItem* aShellItem,
return NS_OK;
}
NS_IMETHODIMP nsXULWindow::ExitModalLoop()
NS_IMETHODIMP nsXULWindow::ExitModalLoop(nsresult aStatus)
{
if (mContinueModalLoop) // was a modal window
EnableParent(PR_TRUE);
mContinueModalLoop = PR_FALSE;
mModalStatus = aStatus;
return NS_OK;
}

View File

@@ -79,7 +79,7 @@ protected:
PRBool aPrimary, const PRUnichar* aID);
NS_IMETHOD SizeShellTo(nsIDocShellTreeItem* aShellItem, PRInt32 aCX,
PRInt32 aCY);
NS_IMETHOD ExitModalLoop();
NS_IMETHOD ExitModalLoop(nsresult aStatus);
NS_IMETHOD GetNewWindow(PRInt32 aChromeFlags,
nsIDocShellTreeItem** aDocShellTreeItem);
NS_IMETHOD CreateNewChromeWindow(PRInt32 aChromeFlags,
@@ -102,6 +102,7 @@ protected:
nsCOMPtr<nsIWeakReference> mParentWindow;
nsVoidArray mContentShells;
PRBool mContinueModalLoop;
nsresult mModalStatus;
PRBool mDebuting; // being made visible right now
PRBool mChromeLoaded; // True when chrome has loaded
PRBool mShowAfterLoad;