diff --git a/xpfe/AppCores/src/nsBrowserAppCore.cpp b/xpfe/AppCores/src/nsBrowserAppCore.cpp index 52f8c5b5ccf7..c6b2c6d0be6f 100644 --- a/xpfe/AppCores/src/nsBrowserAppCore.cpp +++ b/xpfe/AppCores/src/nsBrowserAppCore.cpp @@ -329,8 +329,7 @@ nsBrowserAppCore::Stop() PRInt32 newWind(char* urlName) { nsresult rv; - nsString controllerCID; - + char * urlstr=nsnull; char * progname = nsnull; char * width=nsnull, *height=nsnull; @@ -365,13 +364,7 @@ newWind(char* urlName) { goto done; } - /* - * XXX: Currently, the CID for the "controller" is passed in as an argument - * to CreateTopLevelWindow(...). Once XUL supports "controller" - * components this will be specified in the XUL description... - */ - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow, + appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, newWindow, nsnull, nsnull, 615, 480); NS_RELEASE(url); @@ -1357,7 +1350,6 @@ nsBrowserAppCore::HandleUnknownContentType(nsIDocumentLoader* loader, if ( NS_SUCCEEDED(rv) ) { // Open "Save to disk" dialog. - nsString controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; nsIWebShellWindow *newWindow; // Make url for dialog xul. @@ -1370,7 +1362,7 @@ nsBrowserAppCore::HandleUnknownContentType(nsIDocumentLoader* loader, rv = appShell->CreateTopLevelWindow( nsnull, url, - controllerCID, + PR_TRUE, newWindow, nsnull, dialog, @@ -1487,8 +1479,7 @@ NS_IMETHODIMP nsBrowserAppCore::NewWindow() { nsresult rv; - nsString controllerCID; - + char * urlstr = nsnull; nsIAppShellService* appShell = nsnull; @@ -1525,13 +1516,7 @@ nsBrowserAppCore::NewWindow() goto done; } - /* - * XXX: Currently, the CID for the "controller" is passed in as an argument - * to CreateTopLevelWindow(...). Once XUL supports "controller" - * components this will be specified in the XUL description... - */ - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow, + appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, newWindow, nsnull, nsnull, 615, 480); NS_RELEASE(url); @@ -1809,7 +1794,6 @@ nsBrowserAppCore::DoDialog() /* (adapted from nsToolkitCore. No one's using this function, are they!?) */ nsresult rv; - nsString controllerCID; nsIAppShellService *appShell; nsIWebShellWindow *window; @@ -1825,10 +1809,7 @@ nsBrowserAppCore::DoDialog() if (NS_FAILED(rv)) return rv; - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - - appShell->CreateDialogWindow(mWebShellWin, urlObj, controllerCID, window, + appShell->CreateDialogWindow(mWebShellWin, urlObj, PR_TRUE, window, nsnull, nsnull, 615, 480); nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); // window->Resize(300, 200, PR_TRUE); (until Resize gets moved into nsIWebShellWindow) diff --git a/xpfe/AppCores/src/nsDOMPropsCore.cpp b/xpfe/AppCores/src/nsDOMPropsCore.cpp index 223ceb4d693e..d683c3c15e1a 100644 --- a/xpfe/AppCores/src/nsDOMPropsCore.cpp +++ b/xpfe/AppCores/src/nsDOMPropsCore.cpp @@ -431,7 +431,6 @@ NS_IMETHODIMP nsDOMPropsCore::ShowProperties(const nsString& aUrl, nsIDOMWindow* aParent, nsIDOMNode* aNode) { nsresult rv; - nsString controllerCID; nsIAppShellService *appShell; nsCOMPtr urlObj; @@ -444,15 +443,13 @@ nsDOMPropsCore::ShowProperties(const nsString& aUrl, nsIDOMWindow* aParent, nsID if (NS_FAILED(rv)) return rv; - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; nsIWebShellWindow *newWindow; nsPropertiesDialog *dialog = new nsPropertiesDialog(aNode); nsCOMPtr parent = DOMWindowToWebShellWindow(aParent); - rv = appShell->CreateTopLevelWindow(parent, urlObj, controllerCID, newWindow, + rv = appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, newWindow, nsnull, dialog, 450, 240); nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); diff --git a/xpfe/AppCores/src/nsEditorAppCore.cpp b/xpfe/AppCores/src/nsEditorAppCore.cpp index 8db63702ac0d..5460b16ca46e 100755 --- a/xpfe/AppCores/src/nsEditorAppCore.cpp +++ b/xpfe/AppCores/src/nsEditorAppCore.cpp @@ -1227,8 +1227,6 @@ nsEditorAppCore::EndBatchChanges() static PRInt32 MakeNewWindow(char* urlName) { nsresult rv; - nsString controllerCID; - char * urlstr=nsnull; //char * progname = nsnull; //char * width=nsnull, *height=nsnull; @@ -1263,13 +1261,7 @@ static PRInt32 MakeNewWindow(char* urlName) goto done; } - /* - * XXX: Currently, the CID for the "controller" is passed in as an argument - * to CreateTopLevelWindow(...). Once XUL supports "controller" - * components this will be specified in the XUL description... - */ - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow, + appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, newWindow, nsnull, nsnull, 615, 480); NS_RELEASE(url); diff --git a/xpfe/AppCores/src/nsPrefsCore.cpp b/xpfe/AppCores/src/nsPrefsCore.cpp index c6a393a546c2..bace7a3e52c8 100644 --- a/xpfe/AppCores/src/nsPrefsCore.cpp +++ b/xpfe/AppCores/src/nsPrefsCore.cpp @@ -618,7 +618,6 @@ NS_IMETHODIMP nsPrefsCore::ShowWindow(nsIDOMWindow* aCurrentFrontWin) { // (code adapted from nsToolkitCore::ShowModal. yeesh.) nsresult rv; - nsString controllerCID; nsIAppShellService *appShell; nsIWebShellWindow *window; @@ -638,12 +637,9 @@ NS_IMETHODIMP nsPrefsCore::ShowWindow(nsIDOMWindow* aCurrentFrontWin) //nsIXULWindowCallbacks *cb = new nsFindDialogCallbacks( aURL, aContentType ); nsIXULWindowCallbacks *cb = nsnull; - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - nsCOMPtr parent; DOMWindowToWebShellWindow(aCurrentFrontWin, &parent); - appShell->CreateDialogWindow(parent, urlObj, controllerCID, window, + appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window, nsnull, cb, 504, 436); nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); diff --git a/xpfe/AppCores/src/nsToolkitCore.cpp b/xpfe/AppCores/src/nsToolkitCore.cpp index 6dad8ce95d37..5f3c4c176f59 100644 --- a/xpfe/AppCores/src/nsToolkitCore.cpp +++ b/xpfe/AppCores/src/nsToolkitCore.cpp @@ -21,6 +21,7 @@ #include "nsAppCoresManager.h" #include "nsAppShellCIDs.h" #include "nsIAppShellService.h" +#include "nsIEventQueueService.h" #include "nsIDOMBaseAppCore.h" #include "nsIDOMWindow.h" #include "nsIScriptGlobalObject.h" @@ -37,11 +38,15 @@ #include "nsIDOMXULDocument.h" #include "nsIDocument.h" #include "nsIDOMElement.h" +#include "nsXPComCIID.h" class nsIScriptContext; static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID); +static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); +static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); + static NS_DEFINE_IID(kIDOMBaseAppCoreIID, NS_IDOMBASEAPPCORE_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIToolkitCoreIID, NS_IDOMTOOLKITCORE_IID); @@ -137,7 +142,6 @@ NS_IMETHODIMP nsToolkitCore::ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent) { nsresult rv; - nsString controllerCID; nsIAppShellService *appShell; nsIWebShellWindow *window; @@ -153,12 +157,9 @@ nsToolkitCore::ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent) { if (NS_FAILED(rv)) return rv; - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - nsCOMPtr parent; DOMWindowToWebShellWindow(aParent, &parent); - appShell->CreateDialogWindow(parent, urlObj, controllerCID, window, + appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window, nsnull, nsnull, 615, 480); nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); @@ -172,7 +173,6 @@ NS_IMETHODIMP nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) { nsresult rv; - nsString controllerCID; nsIAppShellService *appShell; nsIWebShellWindow *window; @@ -188,12 +188,9 @@ nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) { if (NS_FAILED(rv)) return rv; - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - nsCOMPtr parent; DOMWindowToWebShellWindow(aParent, &parent); - appShell->CreateTopLevelWindow(parent, urlObj, controllerCID, window, + appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, window, nsnull, nsnull, 615, 480); nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); @@ -287,7 +284,6 @@ nsToolkitCore::ShowWindowWithArgs(const nsString& aUrl, const nsString& aArgs) { nsresult rv; - nsString controllerCID; nsIAppShellService *appShell; nsIWebShellWindow *window; @@ -303,14 +299,11 @@ nsToolkitCore::ShowWindowWithArgs(const nsString& aUrl, if (NS_FAILED(rv)) return rv; - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - nsCOMPtr parent; DOMWindowToWebShellWindow(aParent, &parent); nsCOMPtr cb; cb = nsDontQueryInterface( new nsArgCallbacks( aArgs ) ); - appShell->CreateTopLevelWindow(parent, urlObj, controllerCID, window, + appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, window, nsnull, cb, 615, 650); nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); @@ -324,7 +317,6 @@ NS_IMETHODIMP nsToolkitCore::ShowModalDialog(const nsString& aUrl, nsIDOMWindow* aParent) { nsresult rv; - nsString controllerCID; nsIAppShellService *appShell; nsIWebShellWindow *window; @@ -340,12 +332,24 @@ nsToolkitCore::ShowModalDialog(const nsString& aUrl, nsIDOMWindow* aParent) { if (NS_FAILED(rv)) return rv; - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; + // First push a nested event queue for event processing from netlib + // onto our UI thread queue stack. + nsIEventQueueService *eQueueService; + nsCOMPtr innerQueue; + if (NS_FAILED(rv = nsServiceManager::GetService(kEventQueueServiceCID, + kIEventQueueServiceIID, + (nsISupports **)&eQueueService))) { + NS_ERROR("Unable to obtain queue service."); + return rv; + } + +#ifdef XP_WIN32 // XXX: Won't work with any other platforms yet. + eQueueService->PushThreadEventQueue(); +#endif // XP_WIN32 nsCOMPtr parent; DOMWindowToWebShellWindow(aParent, &parent); - appShell->CreateDialogWindow(parent, urlObj, controllerCID, window, + appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window, nsnull, nsnull, 615, 480); nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); @@ -358,11 +362,15 @@ nsToolkitCore::ShowModalDialog(const nsString& aUrl, nsIDOMWindow* aParent) { // arguably this should be done by the new window, within ShowModal... if (NS_SUCCEEDED(gotParent)) parentWindowWidgetThing->Enable(PR_FALSE); - window->ShowModal(); + window->ShowModal(); // XXX This method pops the queue itself. Ugh. There should really be one + // call for all of this. if (NS_SUCCEEDED(gotParent)) parentWindowWidgetThing->Enable(PR_TRUE); } + // Release the event queue + nsServiceManager::ReleaseService(kEventQueueServiceCID, eQueueService); + return rv; }