the-Forbidden wrote:
I've been playing around with it, and I've focused the problem down to the application I was working on and how it handled the windows; there was a separate window opening up when the Security Certificate dialog came up. It looks like this is how Mozilla does the security warnings, by opening a new window, instead of a simple modal dialog on top of the screen as IE does it. Anyway, after some tweaking, I was able to get the certificate dialog to appear.

Here is my new problem: The window that asks if I want to accept the security certificate doesn't work. I can click the radio buttons between the different options, but if I click any of the buttons like OK or Examine Certificate, the dialog locks up; I can close the window, but the certificate doesn't get installed. Is there some code that has to be added in order to get such dialogs to work, or is there some place to put code that might interfere with the normal dialog operation that has to go. I don't have the code with me (its at work, and my newsgroup connection is at home), but its MFC-based and uses DDX.

the-Forbidden

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
Niky Williams wrote:
the-Forbidden wrote:
I'm new to Mozilla's Gecko, and I'm trying to incorporate it into a Visual C++ project, using the Mozilla ActivaX control in place of the IE WebControl; one problem is that it doesn't handle secure webpages.
The issue is probably in the GetFile method of the local file provider. It needs to support NS_APP_PROFILE_DEFAULTS_50_DIR
here is one that works for SSL

NS_IMETHODIMP
winEmbedFileLocProvider::GetFile(const char *prop, PRBool *persistant, nsIFile **_retval)
        {
        nsCOMPtr<nsILocalFile>  localFile;
        nsresult rv = NS_ERROR_FAILURE;

        *_retval = nsnull;
        *persistant = PR_TRUE;

        if(strcmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0)
                rv = GetProductDirectory(getter_AddRefs(localFile));
        else if(strcmp(prop, NS_APP_APPLICATION_REGISTRY_FILE) == 0)
                {
                rv = GetProductDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))
                        rv = localFile->AppendNative(APP_REGISTRY_NAME);
                }
        else if(strcmp(prop, NS_APP_DEFAULTS_50_DIR) == 0)
                {
                rv = CloneMozBinDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))
                        rv = 
localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
                }
        else if(strcmp(prop, NS_APP_PREF_DEFAULTS_50_DIR) == 0)
                {
                rv = CloneMozBinDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))
                        {
                        rv = 
localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
                        if(NS_SUCCEEDED(rv))
                                rv = 
localFile->AppendRelativeNativePath(DEFAULTS_PREF_DIR_NAME);
                        }
                }
        else if(strcmp(prop, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR) == 0 ||
     strcmp(prop, NS_APP_USER_PROFILE_50_DIR) == 0 ||
                strcmp(prop, NS_APP_PROFILE_DEFAULTS_50_DIR) == 0)
                {
                rv = CloneMozBinDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))

I had a similar problem with my modals as well...they would not communicate with the main window or close out. The problem that I was having was two fold.

First, make sure to implement nsIWebBrowserChrome::DestroyBrowserWindow () as that seems to be what is called when you click any of the buttons on your modals. If you don't have code there to close out that window (Destroy the nsIBaseWindow gotten from your nsIWebBrowser and do a DestroyWindow () on your HWND) it will appear to just lock up.

Secondly, my other problem was that I didn't have the "Gecko event loop" implemented properly. I'm using straight C++, but I think the same rule applies to your MFC app. After I got the above working, my modal boxes would not seem to communicate to the main window (when clicking the buttons) and just close out...until I had the event loop implemented properly. I'm not sure if this will help you any, but it sounds similar to the issues I was having. The code below shows my event loop that I start after I've created an instance of my gecko object, I'm not sure if there is a better way to do this, but it works for me...I think I got this from the WinEmbed example. I believe this should make the connections between the modals (children) and the main windows (parents) when you click the buttons on your modals. Someone please correct me if I'm wrong:

        //Temp vars
        MSG msg;
        HANDLE hEvent;  

        //Creating event
        hEvent = CreateEvent (NULL, TRUE, FALSE, NULL);

        //Looping while true
        while (iEventFlag != 0)
        {
                //Process pending messages
                if (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
                {
                        if (!GetMessage (&msg, NULL, 0, 0))
                        {
                                //WM_QUIT
                                iEventFlag = 0;
                                break;
                        }

                        PRBool wasHandled = PR_FALSE;
                        NS_HandleEmbeddingEvent (msg, wasHandled);
                        if (wasHandled)
                                continue;               

                        TranslateMessage (&msg);
                        DispatchMessage (&msg);     
                }       

                //Do idle stuff
                MsgWaitForMultipleObjects (1, &hEvent, FALSE, 100, 
QS_ALLEVENTS);           
        }

        //Closing event handle
        CloseHandle (hEvent);
        
        return (msg.wParam);

Niky Williams
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to