aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-10-15 18:02:04 +0800
committerChristian Persch <chpe@src.gnome.org>2005-10-15 18:02:04 +0800
commit6c9506d12f519b416ab8d7b04b7f16799abe595c (patch)
tree5ef65a22eeb904d214feb7e8b21b40601ce05740 /embed
parent0beb9543055b4149b0fee9bf2418ef2048eae4f9 (diff)
downloadgsoc2013-epiphany-6c9506d12f519b416ab8d7b04b7f16799abe595c.tar
gsoc2013-epiphany-6c9506d12f519b416ab8d7b04b7f16799abe595c.tar.gz
gsoc2013-epiphany-6c9506d12f519b416ab8d7b04b7f16799abe595c.tar.bz2
gsoc2013-epiphany-6c9506d12f519b416ab8d7b04b7f16799abe595c.tar.lz
gsoc2013-epiphany-6c9506d12f519b416ab8d7b04b7f16799abe595c.tar.xz
gsoc2013-epiphany-6c9506d12f519b416ab8d7b04b7f16799abe595c.tar.zst
gsoc2013-epiphany-6c9506d12f519b416ab8d7b04b7f16799abe595c.zip
Add EPHY_EMBED_PERSIST_NO_CERTDIALOGS flag.
2005-10-15 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed-persist.h: Add EPHY_EMBED_PERSIST_NO_CERTDIALOGS flag. * embed/mozilla/Makefile.am: A embed/mozilla/EphyBadCertRejector.cpp: A embed/mozilla/EphyBadCertRejector.h: A class implementing nsIBadCertListener which always rejects. * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/EphyHeaderSniffer.h: * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozDownload.h: For gecko 1.8, implement nsIInterfaceRequestor for EphyHeaderSniffer and MozDownload, and make GetInterface hand out a EphyBadCertRejector if the EPHY_EMBED_PERSIST_NO_CERTDIALOGS flag is set.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-persist.h3
-rw-r--r--embed/mozilla/EphyBadCertRejector.cpp68
-rw-r--r--embed/mozilla/EphyBadCertRejector.h37
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp45
-rw-r--r--embed/mozilla/EphyHeaderSniffer.h10
-rw-r--r--embed/mozilla/Makefile.am6
-rw-r--r--embed/mozilla/MozDownload.cpp45
-rw-r--r--embed/mozilla/MozDownload.h5
8 files changed, 214 insertions, 5 deletions
diff --git a/embed/ephy-embed-persist.h b/embed/ephy-embed-persist.h
index 005327b1c..8e60841a3 100644
--- a/embed/ephy-embed-persist.h
+++ b/embed/ephy-embed-persist.h
@@ -49,7 +49,8 @@ typedef enum
EPHY_EMBED_PERSIST_NO_VIEW = 1 << 2,
EPHY_EMBED_PERSIST_ASK_DESTINATION = 1 << 3,
EPHY_EMBED_PERSIST_DO_CONVERSION = 1 << 4,
- EPHY_EMBED_PERSIST_FROM_CACHE = 1 << 5
+ EPHY_EMBED_PERSIST_FROM_CACHE = 1 << 5,
+ EPHY_EMBED_PERSIST_NO_CERTDIALOGS = 1 << 6
} EphyEmbedPersistFlags;
struct _EphyEmbedPersist
diff --git a/embed/mozilla/EphyBadCertRejector.cpp b/embed/mozilla/EphyBadCertRejector.cpp
new file mode 100644
index 000000000..2ae56de30
--- /dev/null
+++ b/embed/mozilla/EphyBadCertRejector.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2005 Christian Persch
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include "mozilla-config.h"
+#include "config.h"
+
+#include "EphyBadCertRejector.h"
+
+NS_IMPL_THREADSAFE_ISUPPORTS1 (EphyBadCertRejector, nsIBadCertListener)
+
+/* boolean confirmUnknownIssuer (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert, out short certAddType); */
+NS_IMETHODIMP
+EphyBadCertRejector::ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo,
+ nsIX509Cert *cert,
+ PRInt16 *certAddType,
+ PRBool *_retval)
+{
+ *certAddType = nsIBadCertListener::UNINIT_ADD_FLAG;
+ *_retval = PR_FALSE;
+ return NS_OK;
+}
+
+/* boolean confirmMismatchDomain (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */
+NS_IMETHODIMP
+EphyBadCertRejector::ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo,
+ const nsACString & targetURL,
+ nsIX509Cert *cert,
+ PRBool *_retval)
+{
+ *_retval = PR_FALSE;
+ return NS_OK;
+}
+
+/* boolean confirmCertExpired (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert); */
+NS_IMETHODIMP
+EphyBadCertRejector::ConfirmCertExpired(nsIInterfaceRequestor *socketInfo,
+ nsIX509Cert *cert,
+ PRBool *_retval)
+{
+ *_retval = PR_FALSE;
+ return NS_OK;
+}
+
+/* void notifyCrlNextupdate (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */
+NS_IMETHODIMP
+EphyBadCertRejector::NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo,
+ const nsACString & targetURL,
+ nsIX509Cert *cert)
+{
+ return NS_OK;
+}
diff --git a/embed/mozilla/EphyBadCertRejector.h b/embed/mozilla/EphyBadCertRejector.h
new file mode 100644
index 000000000..b00963d8b
--- /dev/null
+++ b/embed/mozilla/EphyBadCertRejector.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2005 Christian Persch
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef EPHY_BAD_CERT_DENIER_H
+#define EPHY_BAD_CERT_DENIER_H
+
+#include <nsIBadCertListener.h>
+#include <stdio.h>
+
+class EphyBadCertRejector : public nsIBadCertListener
+{
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIBADCERTLISTENER
+
+ EphyBadCertRejector () { printf ("BadCertRejector ctor [%p]\n", (void*) this); }
+ ~EphyBadCertRejector () { printf ("BadCertRejector dtor [%p]\n", (void*) this); }
+};
+
+#endif
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index 8eaac238b..de18a5ff4 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -66,6 +66,10 @@
#include <nsIMIMEHeaderParam.h>
#include <nsIWindowWatcher.h>
+#ifdef HAVE_GECKO_1_8
+#include "EphyBadCertRejector.h"
+#endif
+
EphyHeaderSniffer::EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmbedPersist *aEmbedPersist,
nsIFile* aFile, nsIURI* aURL, nsIDOMDocument* aDocument, nsIInputStream* aPostData,
EphyEmbedSingle *single)
@@ -101,7 +105,16 @@ EphyHeaderSniffer::~EphyHeaderSniffer()
}
}
-NS_IMPL_ISUPPORTS2(EphyHeaderSniffer, nsIWebProgressListener, nsIAuthPrompt)
+#ifdef HAVE_GECKO_1_8
+NS_IMPL_ISUPPORTS3 (EphyHeaderSniffer,
+ nsIWebProgressListener,
+ nsIInterfaceRequestor,
+ nsIAuthPrompt)
+#else
+NS_IMPL_ISUPPORTS2 (EphyHeaderSniffer,
+ nsIWebProgressListener,
+ nsIAuthPrompt)
+#endif
NS_IMETHODIMP
EphyHeaderSniffer::HandleContent ()
@@ -202,6 +215,36 @@ EphyHeaderSniffer::OnSecurityChange (nsIWebProgress *aWebProgress, nsIRequest *a
return NS_OK;
}
+#ifdef HAVE_GECKO_1_8
+
+/* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
+NS_IMETHODIMP
+EphyHeaderSniffer::GetInterface(const nsIID & uuid, void * *result)
+{
+ if (uuid.Equals (NS_GET_IID (nsIBadCertListener)) &&
+ mEmbedPersist)
+ {
+ EphyEmbedPersistFlags flags;
+
+ g_object_get (mEmbedPersist, "flags", &flags, NULL);
+
+ if (flags & EPHY_EMBED_PERSIST_NO_CERTDIALOGS)
+ {
+ EphyBadCertRejector *badCertRejector = new EphyBadCertRejector ();
+ if (!badCertRejector) return NS_ERROR_OUT_OF_MEMORY;
+
+ *result = NS_STATIC_CAST(nsIBadCertListener*, badCertRejector);
+ NS_ADDREF (badCertRejector);
+
+ return NS_OK;
+ }
+ }
+
+ return NS_ERROR_NO_INTERFACE;
+}
+
+#endif /* HAVE_GECKO_1_8 */
+
static void
filechooser_response_cb (GtkWidget *dialog,
gint response,
diff --git a/embed/mozilla/EphyHeaderSniffer.h b/embed/mozilla/EphyHeaderSniffer.h
index 2289156c8..1b8a53979 100644
--- a/embed/mozilla/EphyHeaderSniffer.h
+++ b/embed/mozilla/EphyHeaderSniffer.h
@@ -54,7 +54,14 @@
#include <nsEmbedString.h>
#define MOZILLA_INTERNAL_API 1
+#ifdef HAVE_GECKO_1_8
+#include <nsIInterfaceRequestor.h>
+#endif
+
class EphyHeaderSniffer : public nsIWebProgressListener,
+#ifdef HAVE_GECKO_1_8
+ public nsIInterfaceRequestor,
+#endif
public nsIAuthPrompt
{
public:
@@ -66,6 +73,9 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBPROGRESSLISTENER
NS_FORWARD_SAFE_NSIAUTHPROMPT(mAuthPrompt)
+#ifdef HAVE_GECKO_1_8
+ NS_DECL_NSIINTERFACEREQUESTOR
+#endif
nsresult InitiateDownload (nsILocalFile *aDestFile);
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index 86ee39abd..c27dd0965 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -68,6 +68,12 @@ libephymozillaembed_la_SOURCES += \
GtkNSSSecurityWarningDialogs.h
endif
+if HAVE_GECKO_1_8
+libephymozillaembed_la_SOURCES += \
+ EphyBadCertRejector.cpp \
+ EphyBadCertRejector.h
+endif
+
mozilla_include_subdirs = \
caps \
chardet \
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 787cc7c5c..3219dc9c5 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -72,6 +72,10 @@
#include <stdlib.h>
+#ifdef HAVE_GECKO_1_8
+#include "EphyBadCertRejector.h"
+#endif
+
const char* const persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1";
MozDownload::MozDownload() :
@@ -93,9 +97,16 @@ MozDownload::~MozDownload()
}
#ifdef HAVE_GECKO_1_8
-NS_IMPL_ISUPPORTS3(MozDownload, nsIWebProgressListener, nsIWebProgressListener2, nsITransfer)
+NS_IMPL_ISUPPORTS4 (MozDownload,
+ nsIWebProgressListener,
+ nsIWebProgressListener2,
+ nsITransfer,
+ nsIInterfaceRequestor)
#else
-NS_IMPL_ISUPPORTS3(MozDownload, nsIWebProgressListener, nsIDownload, nsITransfer)
+NS_IMPL_ISUPPORTS3 (MozDownload,
+ nsIWebProgressListener,
+ nsIDownload,
+ nsITransfer)
#endif
#ifdef HAVE_GECKO_1_8
@@ -583,6 +594,36 @@ MozDownload::OnSecurityChange (nsIWebProgress *aWebProgress, nsIRequest *aReques
return NS_OK;
}
+#ifdef HAVE_GECKO_1_8
+
+/* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
+NS_IMETHODIMP
+MozDownload::GetInterface(const nsIID & uuid, void * *result)
+{
+ if (uuid.Equals (NS_GET_IID (nsIBadCertListener)) &&
+ mEmbedPersist)
+ {
+ EphyEmbedPersistFlags flags;
+
+ g_object_get (mEmbedPersist, "flags", &flags, NULL);
+
+ if (flags & EPHY_EMBED_PERSIST_NO_CERTDIALOGS)
+ {
+ nsIBadCertListener *badCertRejector = new EphyBadCertRejector ();
+ if (!badCertRejector) return NS_ERROR_OUT_OF_MEMORY;
+
+ *result = badCertRejector;
+ NS_ADDREF (badCertRejector);
+
+ return NS_OK;
+ }
+ }
+
+ return NS_ERROR_NO_INTERFACE;
+}
+
+#endif /* HAVE_GECKO_1_8 */
+
void
MozDownload::Cancel()
{
diff --git a/embed/mozilla/MozDownload.h b/embed/mozilla/MozDownload.h
index 007045564..509b28339 100644
--- a/embed/mozilla/MozDownload.h
+++ b/embed/mozilla/MozDownload.h
@@ -55,6 +55,7 @@
#ifdef HAVE_GECKO_1_8
#include <nsICancelable.h>
#include <nsITransfer.h>
+#include <nsIInterfaceRequestor.h>
#else
#include <nsIDownload.h>
#endif
@@ -98,7 +99,8 @@ nsresult BuildDownloadPath (const char *defaultFileName, nsILocalFile **_retval)
class MozDownload :
#ifdef HAVE_GECKO_1_8
- public nsITransfer
+ public nsITransfer,
+ public nsIInterfaceRequestor
#else
public nsIDownload,
public nsIWebProgressListener
@@ -113,6 +115,7 @@ public:
#ifdef HAVE_GECKO_1_8
NS_DECL_NSIWEBPROGRESSLISTENER2
NS_DECL_NSITRANSFER
+ NS_DECL_NSIINTERFACEREQUESTOR
nsresult GetMIMEInfo (nsIMIMEInfo **aMIMEInfo);
nsresult GetTargetFile (nsILocalFile **aFile);