зеркало из https://github.com/mozilla/gecko-dev.git
teach RunModalDialog to use extant windows; use one in NetSupportDialog (fixes bug 7858). remove AppShellService interface references
This commit is contained in:
Родитель
dbf66fa37f
Коммит
582ad47b3f
|
@ -761,7 +761,7 @@ nsEditorShell::CreateWindowWithURL(const char* urlStr)
|
|||
if (NS_FAILED(rv) || !url)
|
||||
goto done;
|
||||
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
done:
|
||||
|
|
|
@ -761,7 +761,7 @@ nsEditorShell::CreateWindowWithURL(const char* urlStr)
|
|||
if (NS_FAILED(rv) || !url)
|
||||
goto done;
|
||||
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
done:
|
||||
|
|
|
@ -278,7 +278,7 @@ nsMessenger::Open3PaneWindow()
|
|||
appShell->CreateTopLevelWindow(nsnull, // parent
|
||||
url,
|
||||
PR_TRUE,
|
||||
*getter_AddRefs(newWindow), // result widget
|
||||
getter_AddRefs(newWindow), // result widget
|
||||
nsnull, // observer
|
||||
nsnull, // callbacks
|
||||
200, // width
|
||||
|
|
|
@ -202,7 +202,7 @@ int main(int argc, char *argv[])
|
|||
kIAppShellServiceIID,
|
||||
(nsISupports**)&appShell);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 200, 200);
|
||||
|
||||
// Create the Event Queue for this thread...
|
||||
|
|
|
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
|||
kIAppShellServiceIID,
|
||||
(nsISupports**)&appShell);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 200, 200);
|
||||
|
||||
// Create the Event Queue for this thread...
|
||||
|
|
|
@ -173,7 +173,7 @@ nsPrefMigrationProgressDialog::CreateProfileProgressDialog()
|
|||
rv = appShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
*getter_AddRefs(newWindow),
|
||||
getter_AddRefs(newWindow),
|
||||
nsnull,
|
||||
this, // callbacks??
|
||||
0,
|
||||
|
|
|
@ -411,7 +411,7 @@ newWind(char* urlName)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
NS_RELEASE(url);
|
||||
|
@ -478,23 +478,15 @@ nsBrowserAppCore::WalletEditor(nsIDOMWindow* aWin)
|
|||
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aWin, &parent);
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
|
||||
window = nsnull;
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, &window,
|
||||
nsnull, cb, 504, 436);
|
||||
if (window != nsnull) {
|
||||
appShell->RunModalDialog(&window, nsnull, parent, nsnull, cb, 504, 436);
|
||||
NS_RELEASE(window);
|
||||
}
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
|
||||
if (window != nsnull) {
|
||||
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||
nsresult gotParent;
|
||||
gotParent = parent ? parent->GetWidget(*getter_AddRefs(parentWindowWidgetThing)) :
|
||||
NS_ERROR_FAILURE;
|
||||
// Windows OS is the only one that needs the parent disabled, or cares
|
||||
// arguably this should be done by the new window, within ShowModal...
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||
window->ShowModal();
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -537,23 +529,14 @@ nsBrowserAppCore::SignonViewer(nsIDOMWindow* aWin)
|
|||
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aWin, &parent);
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
|
||||
window = nsnull;
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, &window,
|
||||
nsnull, cb, 504, 436);
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
|
||||
if (window != nsnull) {
|
||||
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||
nsresult gotParent;
|
||||
gotParent = parent ? parent->GetWidget(*getter_AddRefs(parentWindowWidgetThing)) :
|
||||
NS_ERROR_FAILURE;
|
||||
// Windows OS is the only one that needs the parent disabled, or cares
|
||||
// arguably this should be done by the new window, within ShowModal...
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||
window->ShowModal();
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
appShell->RunModalDialog(&window, nsnull, parent, nsnull, cb, 504, 436);
|
||||
NS_RELEASE(window);
|
||||
}
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -596,23 +579,16 @@ nsBrowserAppCore::CookieViewer(nsIDOMWindow* aWin)
|
|||
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aWin, &parent);
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
|
||||
window = nsnull;
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, &window,
|
||||
nsnull, cb, 504, 436);
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
|
||||
if (window != nsnull) {
|
||||
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||
nsresult gotParent;
|
||||
gotParent = parent ? parent->GetWidget(*getter_AddRefs(parentWindowWidgetThing)) :
|
||||
NS_ERROR_FAILURE;
|
||||
// Windows OS is the only one that needs the parent disabled, or cares
|
||||
// arguably this should be done by the new window, within ShowModal...
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||
window->ShowModal();
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
appShell->RunModalDialog(&window, nsnull, parent, nsnull, cb, 504, 436);
|
||||
NS_RELEASE(window);
|
||||
}
|
||||
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -698,23 +674,15 @@ nsBrowserAppCore::WalletPreview(nsIDOMWindow* aWin, nsIDOMWindow* aForm)
|
|||
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aWin, &parent);
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
|
||||
window = nsnull;
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, &window,
|
||||
nsnull, cb, 504, 436);
|
||||
if (window != nsnull) {
|
||||
appShell->RunModalDialog(&window, nsnull, parent, nsnull, cb, 504, 436);
|
||||
NS_RELEASE(window);
|
||||
}
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
|
||||
if (window != nsnull) {
|
||||
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||
nsresult gotParent;
|
||||
gotParent = parent ? parent->GetWidget(*getter_AddRefs(parentWindowWidgetThing)) :
|
||||
NS_ERROR_FAILURE;
|
||||
// Windows OS is the only one that needs the parent disabled, or cares
|
||||
// arguably this should be done by the new window, within ShowModal...
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||
window->ShowModal();
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1462,7 +1430,7 @@ nsBrowserAppCore::NewWindow()
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
NS_RELEASE(url);
|
||||
|
||||
|
@ -1731,7 +1699,7 @@ nsBrowserAppCore::DoDialog()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = appShell->RunModalDialog(mWebShellWin, urlObj, window, nsnull, nsnull, 300, 200);
|
||||
rv = appShell->RunModalDialog(&window, urlObj, mWebShellWin, nsnull, nsnull, 300, 200);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
NS_RELEASE(window);
|
||||
return rv;
|
||||
|
|
|
@ -469,7 +469,7 @@ nsDOMPropsCore::ShowProperties(const nsString& aUrl, nsIDOMWindow* aParent, nsID
|
|||
nsCOMPtr<nsIWebShellWindow> parent = DOMWindowToWebShellWindow(aParent);
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
rv = appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
rv = appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, dialog, 450, 240);
|
||||
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
|
|
|
@ -172,7 +172,8 @@ nsToolkitCore::ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
|
|||
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aParent, &parent);
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
|
||||
window = nsnull;
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, &window,
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
if (window != nsnull)
|
||||
|
@ -212,7 +213,7 @@ nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) {
|
|||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aParent, &parent);
|
||||
nsCOMPtr<nsIWebShellWindow> window;
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, *getter_AddRefs(window),
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, getter_AddRefs(window),
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
if (window)
|
||||
|
@ -337,7 +338,7 @@ nsToolkitCore::ShowWindowWithArgs(const nsString& aUrl,
|
|||
cb = nsDontQueryInterface<nsArgCallbacks>( new nsArgCallbacks( aArgs ) );
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> window;
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, *getter_AddRefs(window),
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, getter_AddRefs(window),
|
||||
nsnull, cb, 615, 650);
|
||||
|
||||
if (window)
|
||||
|
@ -378,7 +379,7 @@ nsToolkitCore::ShowModalDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
|
|||
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aParent, &parent);
|
||||
rv = appShell->RunModalDialog(parent, urlObj, window, nsnull, nsnull, 615, 480);
|
||||
rv = appShell->RunModalDialog(&window, urlObj, parent, nsnull, nsnull, 615, 480);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
NS_RELEASE(window);
|
||||
return rv;
|
||||
|
|
|
@ -52,18 +52,19 @@ public:
|
|||
NS_IMETHOD CreateTopLevelWindow(nsIWebShellWindow * aParent,
|
||||
nsIURI* aUrl,
|
||||
PRBool showWindow,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow** aResult, nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight) = 0;
|
||||
NS_IMETHOD CreateDialogWindow( nsIWebShellWindow * aParent,
|
||||
nsIURI* aUrl,
|
||||
PRBool showWindow,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow** aResult, nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight) = 0;
|
||||
NS_IMETHOD RunModalDialog( nsIWebShellWindow * aParent,
|
||||
NS_IMETHOD RunModalDialog( nsIWebShellWindow **aWindow,
|
||||
nsIURI* aUrl,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow * aParent,
|
||||
nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight) = 0;
|
||||
NS_IMETHOD CloseTopLevelWindow(nsIWebShellWindow* aWindow) = 0;
|
||||
|
|
|
@ -100,18 +100,19 @@ public:
|
|||
NS_IMETHOD CreateTopLevelWindow(nsIWebShellWindow * aParent,
|
||||
nsIURI* aUrl,
|
||||
PRBool showWindow,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow** aResult, nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight);
|
||||
NS_IMETHOD CreateDialogWindow( nsIWebShellWindow * aParent,
|
||||
nsIURI* aUrl,
|
||||
PRBool showWindow,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow** aResult, nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight);
|
||||
NS_IMETHOD RunModalDialog( nsIWebShellWindow * aParent,
|
||||
NS_IMETHOD RunModalDialog( nsIWebShellWindow **aWindow,
|
||||
nsIURI* aUrl,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow * aParent,
|
||||
nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight);
|
||||
NS_IMETHOD CloseTopLevelWindow(nsIWebShellWindow* aWindow);
|
||||
|
@ -478,14 +479,14 @@ nsAppShellService::Shutdown(void)
|
|||
NS_IMETHODIMP
|
||||
nsAppShellService::CreateTopLevelWindow(nsIWebShellWindow *aParent,
|
||||
nsIURI* aUrl, PRBool showWindow,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow** aResult, nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
|
||||
{
|
||||
nsresult rv;
|
||||
nsWebShellWindow* window;
|
||||
|
||||
aResult = nsnull;
|
||||
*aResult = nsnull;
|
||||
window = new nsWebShellWindow();
|
||||
if (nsnull == window) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -498,7 +499,7 @@ nsAppShellService::CreateTopLevelWindow(nsIWebShellWindow *aParent,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// this does the AddRef of the return value
|
||||
rv = window->QueryInterface(kIWebShellWindowIID, (void **) &aResult);
|
||||
rv = window->QueryInterface(kIWebShellWindowIID, (void **) aResult);
|
||||
|
||||
// the addref resulting from this is the owning addref for this window
|
||||
RegisterTopLevelWindow(window);
|
||||
|
@ -526,14 +527,14 @@ nsAppShellService::CloseTopLevelWindow(nsIWebShellWindow* aWindow)
|
|||
NS_IMETHODIMP
|
||||
nsAppShellService::CreateDialogWindow(nsIWebShellWindow * aParent,
|
||||
nsIURI* aUrl, PRBool showWindow,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver* anObserver,
|
||||
nsIWebShellWindow** aResult, nsIStreamObserver* anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
|
||||
{
|
||||
nsresult rv;
|
||||
nsWebShellWindow* window;
|
||||
|
||||
aResult = nsnull;
|
||||
*aResult = nsnull;
|
||||
window = new nsWebShellWindow();
|
||||
if (nsnull == window) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -544,7 +545,7 @@ nsAppShellService::CreateDialogWindow(nsIWebShellWindow * aParent,
|
|||
anObserver, aCallbacks,
|
||||
aInitialWidth, aInitialHeight);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = window->QueryInterface(kIWebShellWindowIID, (void **) &aResult);
|
||||
rv = window->QueryInterface(kIWebShellWindowIID, (void **) aResult);
|
||||
RegisterTopLevelWindow(window);
|
||||
if (showWindow)
|
||||
window->Show(PR_TRUE);
|
||||
|
@ -561,22 +562,25 @@ nsAppShellService::CreateDialogWindow(nsIWebShellWindow * aParent,
|
|||
complications creeping in to the modal window story: there's a lot of setup.
|
||||
See the code..
|
||||
|
||||
Note that the window created is returned in aResult. By the time this function
|
||||
exits, that window has been partially destroyed. We return it anyway, in the
|
||||
hopes that it may be queried for results, somehow. This may be a mistake.
|
||||
It is returned addrefed (by the QueryInterface to nsIWebShellWindow in
|
||||
CreateDialogWindow).
|
||||
If a window is passed in via the first parameter, that window will be
|
||||
the one displayed modally. If no window is passed in (if *aWindow is null)
|
||||
the window created will be returned in *aWindow. Note that by the time
|
||||
this function exits, that window has been partially destroyed. We return it
|
||||
anyway, in the hopes that it may be queried for results, somehow.
|
||||
This may be a mistake. It is returned addrefed (by the QueryInterface
|
||||
to nsIWebShellWindow in CreateDialogWindow).
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsAppShellService::RunModalDialog(
|
||||
nsIWebShellWindow *aParent, nsIURI* aUrl,
|
||||
nsIWebShellWindow*& aResult, nsIStreamObserver *anObserver,
|
||||
nsIWebShellWindow **aWindow,
|
||||
nsIURI* aUrl,
|
||||
nsIWebShellWindow * aParent,
|
||||
nsIStreamObserver *anObserver,
|
||||
nsIXULWindowCallbacks *aCallbacks,
|
||||
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
|
||||
{
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsresult rv;
|
||||
nsIWebShellWindow *theWindow;
|
||||
|
||||
#ifdef XP_PC // XXX: Won't work with any other platforms yet.
|
||||
// First push a nested event queue for event processing from netlib
|
||||
|
@ -590,8 +594,12 @@ nsAppShellService::RunModalDialog(
|
|||
eQueueService->PushThreadEventQueue();
|
||||
#endif
|
||||
|
||||
rv = CreateDialogWindow(aParent, aUrl, PR_TRUE, aResult, anObserver, aCallbacks,
|
||||
aInitialWidth, aInitialHeight);
|
||||
if (aWindow && *aWindow) {
|
||||
theWindow = *aWindow; // and rv is already some success indication
|
||||
NS_ADDREF(theWindow);
|
||||
} else
|
||||
rv = CreateDialogWindow(aParent, aUrl, PR_TRUE, &theWindow, anObserver,
|
||||
aCallbacks, aInitialWidth, aInitialHeight);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||
|
@ -601,9 +609,18 @@ nsAppShellService::RunModalDialog(
|
|||
// Windows OS wants the parent disabled for modality
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||
aResult->ShowModal();
|
||||
theWindow->ShowModal();
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
|
||||
// return the used window if possible, or otherwise get rid of it
|
||||
if (aWindow)
|
||||
if (*aWindow)
|
||||
NS_RELEASE(theWindow); // we borrowed it, now let it go
|
||||
else
|
||||
*aWindow = theWindow; // and it's addrefed from Create...
|
||||
else
|
||||
NS_RELEASE(theWindow); // can't return it; let it go
|
||||
}
|
||||
|
||||
// Release the event queue
|
||||
|
|
|
@ -1006,7 +1006,7 @@ nsIWebShellWindow* FindWebShellWindow(nsIXULWindowCallbacks* inCallbacks)
|
|||
nsnull,
|
||||
urlObj, // nsIURI* of chrome
|
||||
PR_TRUE,
|
||||
aWindow,
|
||||
*aWindow,
|
||||
nsnull,
|
||||
inCallbacks, // callbacks
|
||||
windowWidth, windowHeight);
|
||||
|
|
|
@ -302,6 +302,9 @@ nsNetSupportDialog::nsNetSupportDialog()
|
|||
|
||||
nsNetSupportDialog::~nsNetSupportDialog()
|
||||
{
|
||||
// just making sure I understand what I'm doing...
|
||||
NS_ASSERTION( !mWebShellWindow, "webshell window still exists in ~nsNetSupportDialog" );
|
||||
|
||||
NS_IF_RELEASE( mWebShell );
|
||||
NS_IF_RELEASE( mWebShellWindow );
|
||||
NS_IF_RELEASE( mOKButton );
|
||||
|
@ -428,50 +431,53 @@ nsresult nsNetSupportDialog::ConstructAfterJavaScript(nsIWebShell *aWebShell)
|
|||
|
||||
nsresult nsNetSupportDialog::DoDialog( nsString& inXULURL )
|
||||
{
|
||||
nsresult result;
|
||||
nsresult result;
|
||||
nsIWebShellWindow *dialogWindow;
|
||||
|
||||
// Create the Application Shell instance...
|
||||
NS_WITH_SERVICE(nsIAppShellService, appShellService, kAppShellServiceCID, &result);
|
||||
|
||||
if ( !NS_SUCCEEDED ( result ) )
|
||||
return result;
|
||||
if ( !NS_SUCCEEDED ( result ) )
|
||||
return result;
|
||||
|
||||
nsIURI* dialogURL;
|
||||
nsIURI* dialogURL;
|
||||
#ifndef NECKO
|
||||
result = NS_NewURL(&dialogURL, inXULURL );
|
||||
result = NS_NewURL(&dialogURL, inXULURL );
|
||||
#else
|
||||
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
|
||||
if (NS_FAILED(result)) return result;
|
||||
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &result);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
nsIURI *uri = nsnull;
|
||||
const char *uriStr = inXULURL.GetBuffer();
|
||||
result = service->NewURI(uriStr, nsnull, &uri);
|
||||
if (NS_FAILED(result)) return result;
|
||||
nsIURI *uri = nsnull;
|
||||
const char *uriStr = inXULURL.GetBuffer();
|
||||
result = service->NewURI(uriStr, nsnull, &uri);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&dialogURL);
|
||||
NS_RELEASE(uri);
|
||||
result = uri->QueryInterface(nsIURI::GetIID(), (void**)&dialogURL);
|
||||
NS_RELEASE(uri);
|
||||
#endif // NECKO
|
||||
if (!NS_SUCCEEDED (result) )
|
||||
{
|
||||
appShellService->Release();
|
||||
return result;
|
||||
}
|
||||
if (!NS_SUCCEEDED (result) )
|
||||
{
|
||||
appShellService->Release();
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE( mWebShellWindow );
|
||||
appShellService->RunModalDialog( nsnull, dialogURL, mWebShellWindow, nsnull, this, 300, 200);
|
||||
result = appShellService->CreateDialogWindow(nsnull, dialogURL, PR_TRUE,
|
||||
&dialogWindow, nsnull, this, 300, 200);
|
||||
mWebShellWindow = dialogWindow;
|
||||
|
||||
// cleanup
|
||||
if ( mOKButton )
|
||||
RemoveEventListener( mOKButton );
|
||||
if ( mCancelButton )
|
||||
RemoveEventListener( mCancelButton );
|
||||
dialogURL->Release();
|
||||
if (NS_SUCCEEDED(result))
|
||||
appShellService->RunModalDialog(&dialogWindow, dialogURL, nsnull,
|
||||
nsnull, this, 300, 200);
|
||||
|
||||
// save pointer to window for later access, just in case. note this is dangerous, since
|
||||
// the window has been closed and partially destroyed at this point. but here we are.
|
||||
// it seems necessary to first release any old window we may be holding, since this is
|
||||
// a service, and can therefore remain active between actual invocations.
|
||||
// cleanup
|
||||
if ( mOKButton )
|
||||
RemoveEventListener( mOKButton );
|
||||
if ( mCancelButton )
|
||||
RemoveEventListener( mCancelButton );
|
||||
dialogURL->Release();
|
||||
NS_RELEASE( mWebShellWindow );
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Event Handlers which should be called using XPConnect eventually
|
||||
|
|
|
@ -1124,7 +1124,7 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont
|
|||
return rv;
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_FALSE, *getter_AddRefs(newWindow),
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_FALSE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 200, 300);
|
||||
// Move the window to aXPos and aYPos
|
||||
nsCOMPtr<nsIBrowserWindow> browserWindow = do_QueryInterface(newWindow);
|
||||
|
@ -1251,7 +1251,7 @@ nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible,
|
|||
if ((aChromeMask & NS_CHROME_OPEN_AS_CHROME) != 0) {
|
||||
// Just do a nice normal create of a web shell and
|
||||
// return it immediately.
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, nsnull, PR_FALSE, *getter_AddRefs(newWindow),
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, nsnull, PR_FALSE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIBrowserWindow> browser(do_QueryInterface(newWindow));
|
||||
|
@ -1294,7 +1294,7 @@ nsWebShellWindow::NewWebShell(PRUint32 aChromeMask, PRBool aVisible,
|
|||
#endif // NECKO
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, urlObj, PR_FALSE, *getter_AddRefs(newWindow),
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, urlObj, PR_FALSE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
nsIAppShell *subshell;
|
||||
|
|
|
@ -627,7 +627,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> profWindow;
|
||||
rv = profAppShell->CreateTopLevelWindow(nsnull, profURL, PR_TRUE, *getter_AddRefs(profWindow),
|
||||
rv = profAppShell->CreateTopLevelWindow(nsnull, profURL, PR_TRUE, getter_AddRefs(profWindow),
|
||||
nsnull, nsnull, profWinWidth, profWinHeight);
|
||||
|
||||
NS_RELEASE(profURL);
|
||||
|
@ -656,7 +656,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
if ( !useArgs ) {
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
rv = appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, widthVal, heightVal);
|
||||
} else {
|
||||
nsIDOMToolkitCore* toolkit = nsnull;
|
||||
|
|
|
@ -660,7 +660,7 @@ nsFindComponent::Find(nsISupports *aContext, PRBool *aDidFind)
|
|||
rv = mAppShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
*getter_AddRefs(newWindow),
|
||||
getter_AddRefs(newWindow),
|
||||
nsnull,
|
||||
dialog,
|
||||
0,
|
||||
|
|
|
@ -210,21 +210,12 @@ NS_IMETHODIMP nsPrefWindow::showWindow(
|
|||
nsIXULWindowCallbacks *cb = nsnull;
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(currentFrontWin, &parent);
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
|
||||
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, &window,
|
||||
nsnull, cb, 504, 436);
|
||||
if (window)
|
||||
if (window != nsnull)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> parentWindowWidgetThing;
|
||||
nsresult gotParent
|
||||
= parent ? parent->GetWidget(*getter_AddRefs(parentWindowWidgetThing)) :
|
||||
NS_ERROR_FAILURE;
|
||||
// Windows OS is the only one that needs the parent disabled, or cares
|
||||
// arguably this should be done by the new window, within ShowModal...
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_FALSE);
|
||||
window->ShowModal();
|
||||
if (NS_SUCCEEDED(gotParent))
|
||||
parentWindowWidgetThing->Enable(PR_TRUE);
|
||||
appShell->RunModalDialog(&window, nsnull, parent, nsnull, cb, 504, 436);
|
||||
NS_RELEASE(window);
|
||||
}
|
||||
return rv;
|
||||
} // nsPrefWindow::showWindow()
|
||||
|
|
|
@ -1006,7 +1006,7 @@ nsIWebShellWindow* FindWebShellWindow(nsIXULWindowCallbacks* inCallbacks)
|
|||
nsnull,
|
||||
urlObj, // nsIURI* of chrome
|
||||
PR_TRUE,
|
||||
aWindow,
|
||||
*aWindow,
|
||||
nsnull,
|
||||
inCallbacks, // callbacks
|
||||
windowWidth, windowHeight);
|
||||
|
|
|
@ -228,7 +228,7 @@ nsUnknownContentTypeHandler::HandleUnknownContentType( nsIURI *aURL,
|
|||
rv = mAppShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
*getter_AddRefs(newWindow),
|
||||
getter_AddRefs(newWindow),
|
||||
nsnull,
|
||||
dialog,
|
||||
0, 0 );
|
||||
|
|
|
@ -169,7 +169,7 @@ nsDownloadProgressDialog::Show() {
|
|||
rv = appShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
*getter_AddRefs(newWindow),
|
||||
getter_AddRefs(newWindow),
|
||||
nsnull,
|
||||
this,
|
||||
0,
|
||||
|
|
|
@ -237,7 +237,7 @@ nsInstallProgressDialog::Open()
|
|||
rv = appShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
*getter_AddRefs(mWindow),
|
||||
getter_AddRefs(newWindow),
|
||||
nsnull,
|
||||
this, // callbacks??
|
||||
0,
|
||||
|
|
|
@ -369,7 +369,7 @@ nsXPInstallManager::BeforeJavascriptEvaluation()
|
|||
rv = appShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
*getter_AddRefs(newWindow),
|
||||
getter_AddRefs(newWindow),
|
||||
nsnull,
|
||||
this, // callbacks??
|
||||
0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче