filePicker->AppendFilter(wildCardExtension.GetUnicode(), wildCardExtension.GetUnicode());
filePicker->AppendFilter(wildCardExtension.get(), wildCardExtension.get());
nsUnknownContentTypeHandler::PromptForSaveToFile(nsISupports * aWindowContext, const PRUnichar * aDefaultFile, const PRUnichar * aSuggestedFileExtension, nsILocalFile ** aNewFile){  nsresult rv = NS_OK;  nsCOMPtr<nsIFilePicker> filePicker = do_CreateInstance("@mozilla.org/filepicker;1", &rv);  if (filePicker)  {    nsCOMPtr<nsIStringBundleService> stringService = do_GetService(kStringBundleServiceCID);    nsCOMPtr<nsIStringBundle> stringBundle;    NS_ENSURE_TRUE(stringService, NS_ERROR_FAILURE);    NS_ENSURE_SUCCESS(stringService->CreateBundle(HELPERAPP_DIALOG_URL, getter_AddRefs(stringBundle)),                     NS_ERROR_FAILURE);    nsXPIDLString windowTitle;    stringBundle->GetStringFromName(NS_LITERAL_STRING("saveDialogTitle").get(), getter_Copies(windowTitle));    nsCOMPtr<nsIDOMWindowInternal> parent( do_GetInterface( aWindowContext ) );    filePicker->Init(parent, windowTitle, nsIFilePicker::modeSave);    filePicker->SetDefaultString(aDefaultFile);    nsAutoString wildCardExtension (NS_LITERAL_STRING("*").get());    if (aSuggestedFileExtension) {      wildCardExtension.Append(aSuggestedFileExtension);      filePicker->AppendFilter(wildCardExtension.GetUnicode(), wildCardExtension.GetUnicode());    }    filePicker->AppendFilters(nsIFilePicker::filterAll);    nsCOMPtr<nsILocalFile> startDir;    // Pull in the user's preferences and get the default download directory.    nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));    if ( prefs )     {      rv = prefs->GetFileXPref( "browser.download.dir", getter_AddRefs( startDir ) );      if ( NS_SUCCEEDED(rv) && startDir )       {        PRBool isValid = PR_FALSE;        startDir->Exists( &isValid );        if ( isValid )  // Set file picker so startDir is used.          filePicker->SetDisplayDirectory( startDir );      }    }    PRInt16 dialogResult;    filePicker->Show(&dialogResult);    if (dialogResult == nsIFilePicker::returnCancel)      rv = NS_ERROR_FAILURE;    else              {      // be sure to save the directory the user chose as the new browser.download.dir      rv = filePicker->GetFile(aNewFile);      if (*aNewFile)      {        nsCOMPtr<nsIFile> newDirectory;        (*aNewFile)->GetParent(getter_AddRefs(newDirectory));        nsCOMPtr<nsILocalFile> newLocalDirectory (do_QueryInterface(newDirectory));        if (newLocalDirectory)         prefs->SetFileXPref( "browser.download.dir", newLocalDirectory);      }    }  }  return rv;}