aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/Makefile.am4
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp25
2 files changed, 11 insertions, 18 deletions
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index 1340ef216..8e33860c4 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -94,6 +94,4 @@ libephymozillaembed_la_SOURCES = \
mozilla-embed-single.cpp \
mozilla-embed-single.h \
mozilla-notifiers.cpp \
- mozilla-notifiers.h \
- nsUnicharUtils.cpp \
- nsUnicharUtils.h
+ mozilla-notifiers.h
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index 7a20863ef..7de40e6d3 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -25,6 +25,7 @@
#include "mozilla-embed-persist.h"
#include "mozilla-embed.h"
#include "ephy-embed-shell.h"
+#include "ephy-file-helpers.h"
#include "EphyBrowser.h"
#include "EphyHeaderSniffer.h"
#include "MozDownload.h"
@@ -162,21 +163,15 @@ impl_save (EphyEmbedPersist *persist)
g_assert (browser != NULL || uri != NULL);
/* Get a temp filename to save to */
- nsCOMPtr<nsIProperties> dirService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
- NS_ENSURE_TRUE (dirService, FALSE);
-
- nsCOMPtr<nsIFile> tmpFile;
- dirService->Get("TmpD", NS_GET_IID(nsIFile), getter_AddRefs(tmpFile));
- if (!tmpFile) return FALSE;
-
- /* FIXME: make this filename non-guessable */
- static short unsigned int tmpRandom = 0;
- nsAutoString tmpNo;
- tmpNo.AppendInt(tmpRandom++);
- nsAutoString saveFile(NS_LITERAL_STRING("-sav"));
- saveFile += tmpNo;
- saveFile += NS_LITERAL_STRING("tmp");
- tmpFile->Append(saveFile);
+ char *tmp_filename, *base;
+ base = g_build_filename (g_get_tmp_dir (), "sav-XXXXXX", NULL);
+ tmp_filename = ephy_file_tmp_filename (base, "html");
+ if (tmp_filename == NULL) return FALSE;
+ g_free (base);
+
+ nsCOMPtr<nsILocalFile> tmpFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ tmpFile->InitWithNativePath (nsDependentCString (tmp_filename));
+ g_free (tmp_filename);
/* Get the uri to save to */
nsCOMPtr<nsIURI> inURI;