aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-02-21 17:03:03 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-02-21 17:03:03 +0800
commitdf999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4 (patch)
treebedc576b86da4aae293c503ee901a62c1d5b758e /embed
parent07ae00de7bf0ec13db06253330395054a24e7283 (diff)
downloadgsoc2013-epiphany-df999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4.tar
gsoc2013-epiphany-df999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4.tar.gz
gsoc2013-epiphany-df999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4.tar.bz2
gsoc2013-epiphany-df999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4.tar.lz
gsoc2013-epiphany-df999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4.tar.xz
gsoc2013-epiphany-df999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4.tar.zst
gsoc2013-epiphany-df999fb1fdf4c7eb1159b3174ca7b8ab04a0cfd4.zip
Actually remove nsUnicharUtils.*
2004-02-21 Marco Pesenti Gritti <marco@gnome.org> * embed/mozilla/Makefile.am: Actually remove nsUnicharUtils.* * embed/mozilla/mozilla-embed-persist.cpp: Use our helper to construct tmp file name: fix security issue. * src/window-commands.c: (save_temp_source): Cosmetic change
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;