diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-02-11 07:11:26 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-02-11 07:11:26 +0800 |
commit | 4fefe275e3f86d25eb58461e085e86728b2c5425 (patch) | |
tree | b1b227af9a9046ce0393b63a27e013da6ef187b2 | |
parent | da3e75ecba1dbc62ee1f6c9e1970f4c140fbef0d (diff) | |
download | gsoc2013-epiphany-4fefe275e3f86d25eb58461e085e86728b2c5425.tar gsoc2013-epiphany-4fefe275e3f86d25eb58461e085e86728b2c5425.tar.gz gsoc2013-epiphany-4fefe275e3f86d25eb58461e085e86728b2c5425.tar.bz2 gsoc2013-epiphany-4fefe275e3f86d25eb58461e085e86728b2c5425.tar.lz gsoc2013-epiphany-4fefe275e3f86d25eb58461e085e86728b2c5425.tar.xz gsoc2013-epiphany-4fefe275e3f86d25eb58461e085e86728b2c5425.tar.zst gsoc2013-epiphany-4fefe275e3f86d25eb58461e085e86728b2c5425.zip |
Add check for nsIWalletService.h.
2005-02-11 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
Add check for nsIWalletService.h.
* embed/mozilla/mozilla-embed-single.cpp:
Make sure the wallet store is secured.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 55 |
4 files changed, 74 insertions, 2 deletions
@@ -1,3 +1,13 @@ +2005-02-11 Christian Persch <chpe@cvs.gnome.org> + + * configure.ac: + + Add check for nsIWalletService.h. + + * embed/mozilla/mozilla-embed-single.cpp: + + Make sure the wallet store is secured. + 2005-02-10 Christian Persch <chpe@cvs.gnome.org> * src/ephy-tab.c: (ephy_tab_finalize), (ephy_tab_title_cb), @@ -15,3 +15,7 @@ Stuff to do when dropping support for mozilla < 1.7: - use dependent strings - use gtk_moz_embed_set_app_components +================ + +- Rename "Unicode" to "Other languages/scripts" in Fonts prefs. + diff --git a/configure.ac b/configure.ac index d3a506962..605ea8c51 100644 --- a/configure.ac +++ b/configure.ac @@ -471,11 +471,14 @@ dnl https://bugzilla.mozilla.org/show_bug.cgi?id=271068 if test "x$flavour" = "xmozilla"; then AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/nsIPassword.h], - [AC_DEFINE(HAVE_NSIPASSWORD_H, 1, + [AC_DEFINE([HAVE_NSIPASSWORD_H],[1], [Define if mozilla nsIPassword header is available])]) + AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/wallet/nsIWalletService.h], + [AC_DEFINE([HAVE_NSIWALLETSERVICE_H],[1], + [Define if nsIWalletService.h is available])]) elif test "x$flavour" = "xtoolkit"; then AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/passwordmgr/nsIPassword.h], - [AC_DEFINE(HAVE_NSIPASSWORD_H, 1, + [AC_DEFINE([HAVE_NSIPASSWORD_H],[1], [Define if mozilla nsIPassword header is available])]) fi diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 06e830319..53d1d40e8 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -85,6 +85,11 @@ #include <nsIFontEnumerator.h> #include <nsNetCID.h> #include <nsIIDNService.h> +#endif /* ALLOW_PRIVATE_API */ + +#ifdef HAVE_NSIWALLETSERVICE_H +#include <nsIDOMWindowInternal.h> +#include <wallet/nsIWalletService.h> #endif #include <stdlib.h> @@ -189,6 +194,28 @@ mozilla_embed_single_get_type (void) return type; } +#ifdef HAVE_NSIWALLETSERVICE_H + +class DummyWindow : public nsIDOMWindowInternal +{ +public: + DummyWindow () { LOG ("DummyWindow ctor"); }; + virtual ~DummyWindow () { LOG ("DummyWindow dtor"); }; + + NS_DECL_ISUPPORTS + NS_FORWARD_SAFE_NSIDOMWINDOW(mFake); + NS_FORWARD_SAFE_NSIDOMWINDOW2(mFake2); + NS_FORWARD_SAFE_NSIDOMWINDOWINTERNAL(mFakeInt); +private: + nsCOMPtr<nsIDOMWindow> mFake; + nsCOMPtr<nsIDOMWindow2> mFake2; + nsCOMPtr<nsIDOMWindowInternal> mFakeInt; +}; + +NS_IMPL_ISUPPORTS3(DummyWindow, nsIDOMWindow, nsIDOMWindow2, nsIDOMWindowInternal) + +#endif /* HAVE_NSIWALLETSERVICE_H */ + static gboolean mozilla_set_default_prefs (MozillaEmbedSingle *mes) { @@ -245,6 +272,34 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes) pref->SetBoolPref("network.protocol-handler.external.ftp", have_gnome_url_handler ("ftp")); +#ifdef HAVE_NSIWALLETSERVICE_H + PRBool isEnabled = PR_FALSE; + rv = pref->GetBoolPref ("wallet.crypto", &isEnabled); + if (NS_FAILED (rv) || !isEnabled) + { + nsCOMPtr<nsIWalletService> wallet (do_GetService (NS_WALLETSERVICE_CONTRACTID)); + NS_ENSURE_TRUE (wallet, TRUE); + + /* We cannot set nsnull as callback data here, since that will crash + * in case wallet needs to get the prompter from it (missing null check + * in wallet code). Therefore we create a dummy impl which will just + * always fail. There is no way to safely set nsnull after we're done, + * so we'll just leak our dummy window. + */ + DummyWindow *win = new DummyWindow(); + if (!win) return TRUE; + + nsCOMPtr<nsIDOMWindowInternal> domWinInt (do_QueryInterface (win)); + NS_ENSURE_TRUE (domWinInt, TRUE); + + NS_ADDREF (win); + wallet->WALLET_InitReencryptCallback (domWinInt); + + /* Now set the pref. This will encrypt the existing data. */ + pref->SetBoolPref ("wallet.crypto", PR_TRUE); + } +#endif /* HAVE_NSIWALLETSERVICE_H */ + return TRUE; } |