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))
                        {
                        rv = 
localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
                        if(NS_SUCCEEDED(rv))
                                rv = 
localFile->AppendRelativeNativePath(DEFAULTS_PROFILE_DIR_NAME);
                        }
                }
        else if(strcmp(prop, NS_APP_USER_PROFILES_ROOT_DIR) == 0)
                rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile));
        else if(strcmp(prop, NS_APP_RES_DIR) == 0)
                {
                rv = CloneMozBinDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))
                        rv = localFile->AppendRelativeNativePath(RES_DIR_NAME);
                }
        else if(strcmp(prop, NS_APP_CHROME_DIR) == 0)
                {
                rv = CloneMozBinDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))
                        rv = 
localFile->AppendRelativeNativePath(CHROME_DIR_NAME);
                }
        else if(strcmp(prop, NS_APP_PLUGINS_DIR) == 0)
                {
                rv = CloneMozBinDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))
                        rv = 
localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
                }
        else if(strcmp(prop, NS_APP_SEARCH_DIR) == 0)
                {
                rv = CloneMozBinDirectory(getter_AddRefs(localFile));
                if(NS_SUCCEEDED(rv))
                        rv = 
localFile->AppendRelativeNativePath(SEARCH_DIR_NAME);
                }
  else if(strcmp(prop, NS_APP_COMPONENTS_DIR) == 0)
  {
    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
    if(NS_SUCCEEDED(rv))
      rv = localFile->AppendRelativeNativePath(COMPONENTS_DIR_NAME);
  }
  else if (strcmp(prop, NS_GRE_DIR) == 0)
    {
      rv = GRE_GetGREDirectory(getter_AddRefs(localFile));
    }

        if(localFile && NS_SUCCEEDED(rv))
                return localFile->QueryInterface(NS_GET_IID(nsIFile), 
(void**)_retval);

        return rv;
        }
_______________________________________________
mozilla-embedding mailing list
mozilla-embedding@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to