diff options
author | Christian Persch <chpe@src.gnome.org> | 2008-03-27 06:25:35 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2008-03-27 06:25:35 +0800 |
commit | 43677165c94609018dc9150e1e2fa1a4c5e904f5 (patch) | |
tree | db580bc55d9d8af9120ab31b31786778702a7480 /embed | |
parent | 8e162912682fb133ecdd5dbba3afd27620804c1d (diff) | |
download | gsoc2013-epiphany-43677165c94609018dc9150e1e2fa1a4c5e904f5.tar gsoc2013-epiphany-43677165c94609018dc9150e1e2fa1a4c5e904f5.tar.gz gsoc2013-epiphany-43677165c94609018dc9150e1e2fa1a4c5e904f5.tar.bz2 gsoc2013-epiphany-43677165c94609018dc9150e1e2fa1a4c5e904f5.tar.lz gsoc2013-epiphany-43677165c94609018dc9150e1e2fa1a4c5e904f5.tar.xz gsoc2013-epiphany-43677165c94609018dc9150e1e2fa1a4c5e904f5.tar.zst gsoc2013-epiphany-43677165c94609018dc9150e1e2fa1a4c5e904f5.zip |
Next try to get cert exception addition working. This too isn't not working correctly though; it fails to get any properties from my |arguments| object.
svn path=/trunk/; revision=8135
Diffstat (limited to 'embed')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 274 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.h | 10 | ||||
-rw-r--r-- | embed/mozilla/EphyDirectoryProvider.cpp | 2 | ||||
-rw-r--r-- | embed/mozilla/Makefile.am | 9 | ||||
-rw-r--r-- | embed/mozilla/ephyAddCertException.h | 99 | ||||
-rw-r--r-- | embed/mozilla/ephyAddCertException.idl | 8 | ||||
-rw-r--r-- | embed/mozilla/ephyAddCertException.js | 105 | ||||
-rw-r--r-- | embed/mozilla/ephyAddCertException.xpt | bin | 211 -> 0 bytes | |||
-rw-r--r-- | embed/mozilla/ephyIAddCertExceptionParams.h | 123 | ||||
-rw-r--r-- | embed/mozilla/ephyIAddCertExceptionParams.idl | 8 | ||||
-rw-r--r-- | embed/mozilla/epiphany.xpt | bin | 0 -> 228 bytes | |||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 2 |
12 files changed, 426 insertions, 214 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 3445e6d74..1a7afc901 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -22,6 +22,7 @@ #include "mozilla-config.h" #include "config.h" +#include <string.h> #include <unistd.h> #include <nsStringAPI.h> @@ -64,6 +65,8 @@ #include <nsIDOMViewCSS.h> #include <nsIDOMWindow2.h> #include <nsIDOMXMLDocument.h> +#include <nsIDOMLocation.h> +#include <nsIDOMNSLocation.h> #include <nsIHistoryEntry.h> #include <nsIInterfaceRequestor.h> #include <nsIInterfaceRequestorUtils.h> @@ -111,8 +114,160 @@ #include "EventContext.h" #include "GeckoPrintService.h" +#ifdef HAVE_GECKO_1_9 +#include <ephyIAddCertExceptionParams.h> +#include <nsAutoPtr.h> +#include <nsComponentManagerUtils.h> +#include <nsIArray.h> +#include <nsIClassInfo.h> +#include <nsIDialogParamBlock.h> +#include <nsIMutableArray.h> +#include <nsIProgrammingLanguage.h> +#include <nsISupportsArray.h> +#include <nsIWindowWatcher.h> +#endif + #include "EphyBrowser.h" + +#ifdef HAVE_GECKO_1_9 + +class EphyAddCertExceptionParams : public ephyIAddCertExceptionParams, + public nsIDialogParamBlock, + public nsIClassInfo + +{ + public: + NS_DECL_ISUPPORTS + NS_DECL_EPHYIADDCERTEXCEPTIONPARAMS + NS_FORWARD_SAFE_NSIDIALOGPARAMBLOCK (mParamBlock) + NS_DECL_NSICLASSINFO + + EphyAddCertExceptionParams (const nsAString& aLocation, PRBool aPrefetch = PR_TRUE) + : mParamBlock (do_CreateInstance (NS_DIALOGPARAMBLOCK_CONTRACTID)), + mLocation (aLocation), + mPrefetch (aPrefetch), + mExceptionAdded (PR_FALSE) { g_print ("%s\n", G_STRFUNC); } + + private: + ~EphyAddCertExceptionParams () { g_print ("%s\n", G_STRFUNC); } + + nsCOMPtr<nsIDialogParamBlock> mParamBlock; + nsString mLocation; + PRBool mPrefetch; + PRBool mExceptionAdded; +}; + +NS_IMPL_ISUPPORTS3 (EphyAddCertExceptionParams, ephyIAddCertExceptionParams, nsIDialogParamBlock, nsIClassInfo) + +/* nsISupports getHelperForLanguage (in PRUint32 language); */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetHelperForLanguage(PRUint32 language, nsISupports **_retval) +{ + g_print ("%s\n", G_STRFUNC); + *_retval = nsnull; + return NS_OK; +} + +/* readonly attribute string contractID; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetContractID(char * *aContractID) +{ + g_print ("%s\n", G_STRFUNC); + *aContractID = nsnull; + return NS_OK; +} + +/* readonly attribute string classDescription; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetClassDescription(char * *aClassDescription) +{ + g_print ("%s\n", G_STRFUNC); + *aClassDescription = nsnull; + return NS_OK; +} + +/* readonly attribute nsCIDPtr classID; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetClassID(nsCID * *aClassID) +{ + g_print ("%s\n", G_STRFUNC); + return NS_ERROR_FAILURE; +} + +/* readonly attribute PRUint32 implementationLanguage; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetImplementationLanguage(PRUint32 *aImplementationLanguage) +{ + g_print ("%s\n", G_STRFUNC); + *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; + return NS_OK; +} + +/* readonly attribute PRUint32 flags; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetFlags(PRUint32 *aFlags) +{ + g_print ("%s\n", G_STRFUNC); + *aFlags = 0; + return NS_OK; +} + +/* [notxpcom] readonly attribute nsCID classIDNoAlloc; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) +{ + g_print ("%s\n", G_STRFUNC); + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP EphyAddCertExceptionParams::GetInterfaces (PRUint32 *count, nsIID * **array) +{ + g_print ("%s\n", G_STRFUNC); + nsIID **iids = static_cast<nsIID**>(NS_Alloc (1 * sizeof (nsIID*))); + if (!iids) + return NS_ERROR_OUT_OF_MEMORY; + + iids[0] = static_cast<nsIID*>(NS_Alloc (sizeof (nsIID))); + if (!iids[0]) + return NS_ERROR_OUT_OF_MEMORY; + memcpy (iids[0], &NS_GET_IID (ephyIAddCertExceptionParams), sizeof (nsIID)); + + *count = 1; + *array = iids; + + g_print ("DONE %s\n", G_STRFUNC); + return NS_OK; +} + +/* readonly attribute boolean prefetchCert; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetPrefetchCert(PRBool *aPrefetchCert) +{ + g_print ("%s\n", G_STRFUNC); + *aPrefetchCert = mPrefetch; + return NS_OK; +} + +/* readonly attribute AString location; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetLocation(nsAString & aLocation) +{ + g_print ("%s\n", G_STRFUNC); + g_print ("mLocation=%s\n", NS_ConvertUTF16toUTF8(mLocation).get()); + aLocation.Assign (mLocation); + return NS_OK; +} + +/* attribute boolean exceptionAdded; */ +NS_IMETHODIMP EphyAddCertExceptionParams::GetExceptionAdded(PRBool *aExceptionAdded) +{ + g_print ("%s\n", G_STRFUNC); + *aExceptionAdded = mExceptionAdded; + return NS_OK; +} + +NS_IMETHODIMP EphyAddCertExceptionParams::SetExceptionAdded(PRBool aExceptionAdded) +{ + g_print ("%s\n", G_STRFUNC); + mExceptionAdded = aExceptionAdded; + return NS_OK; +} + +#endif /* HAVE_GECKO_1_9 */ + + NS_IMPL_ISUPPORTS1(EphyEventListener, nsIDOMEventListener) NS_IMETHODIMP @@ -474,6 +629,117 @@ EphyDOMScrollEventListener::HandleEvent (nsIDOMEvent * aEvent) return NS_OK; } +NS_IMETHODIMP +EphyCommandEventListener::HandleEvent (nsIDOMEvent *aDOMEvent) +{ + /* make sure the event is trusted */ + nsCOMPtr<nsIDOMNSEvent> nsEvent (do_QueryInterface (aDOMEvent)); + NS_ENSURE_TRUE (nsEvent, NS_ERROR_FAILURE); + PRBool isTrusted = PR_FALSE; + nsEvent->GetIsTrusted (&isTrusted); + if (!isTrusted) return NS_OK; + + nsresult rv; + nsCOMPtr<nsIDOMEventTarget> originalTarget; + rv = nsEvent->GetOriginalTarget (getter_AddRefs (originalTarget)); + NS_ENSURE_SUCCESS (rv, rv); + + nsCOMPtr<nsIDOMNode> node (do_QueryInterface (originalTarget)); + if (!node) + return NS_OK; + + nsCOMPtr<nsIDOMDocument> document; + rv = node->GetOwnerDocument (getter_AddRefs (document)); + NS_ENSURE_SUCCESS (rv, rv); + + nsCOMPtr<nsIDOM3Document> doc3 (do_QueryInterface (document)); + NS_ENSURE_TRUE (doc3, NS_ERROR_FAILURE); + + nsString documentURI; + rv = doc3->GetDocumentURI (documentURI); + NS_ENSURE_SUCCESS (rv, rv); + + if (!g_str_has_prefix (NS_ConvertUTF16toUTF8 (documentURI).get(), + "about:neterror?e=nssBadCert&")) + return NS_OK; + + nsCOMPtr<nsIDOMElement> docElement (do_QueryInterface (document)); + + nsCOMPtr<nsIDOMElement> buttonElement; + rv = document->GetElementById (NS_LITERAL_STRING("exceptionDialogButton"), + getter_AddRefs (buttonElement)); + if (NS_FAILED (rv) || !buttonElement) + return NS_OK; + + nsCOMPtr<nsIDOMNode> buttonNode (do_QueryInterface (buttonElement)); + NS_ENSURE_TRUE (buttonNode, NS_OK); + + g_print ("here1\n"); + /* Event was for this button? */ + if (!SameCOMIdentity (node, buttonNode)) + return NS_OK; + g_print ("here2\n"); + + nsCOMPtr<nsIDOMDocumentView> docView (do_QueryInterface (document)); + NS_ENSURE_TRUE (docView, NS_OK); + + nsCOMPtr<nsIDOMAbstractView> view; + rv = docView->GetDefaultView (getter_AddRefs (view)); + NS_ENSURE_SUCCESS (rv, NS_OK); + + nsCOMPtr<nsIDOMWindow> window (do_QueryInterface (view)); + NS_ENSURE_TRUE (window, NS_OK); + + nsCOMPtr<nsIDOMWindowInternal> windowInternal (do_QueryInterface (window)); + NS_ENSURE_TRUE (windowInternal, NS_OK); + + nsCOMPtr<nsIDOMLocation> domLocation; + rv = windowInternal->GetLocation (getter_AddRefs (domLocation)); + if (NS_FAILED (rv)) + return NS_OK; + + nsCOMPtr<nsIDOMNSLocation> domNSLocation (do_QueryInterface (domLocation)); + NS_ENSURE_TRUE (domNSLocation, NS_OK); + + nsString locationHref; + domLocation->GetHref (locationHref); + + nsRefPtr<EphyAddCertExceptionParams> params (new EphyAddCertExceptionParams (locationHref, PR_TRUE)); + if (!params) + return NS_ERROR_OUT_OF_MEMORY; + + nsCOMPtr<nsIWindowWatcher> ww (do_GetService (NS_WINDOWWATCHER_CONTRACTID)); + if (!ww) + return NS_ERROR_FAILURE; + + { + AutoJSContextStack stack; + if (NS_FAILED (stack.Init ())) + return NS_OK; + + nsISupports *arguments = static_cast<nsISupports*>(static_cast<ephyIAddCertExceptionParams*>(params)); + nsCOMPtr<nsIDOMWindow> dialog; + rv = ww->OpenWindow (window, + "chrome://pippki/content/exceptionDialog.xul", + "_blank", + "chrome,centerscreen,modal", + arguments, + getter_AddRefs (dialog)); + g_print ("done openwindow %x\n", rv); + if (NS_FAILED (rv)) + return rv; + } + + PRBool exceptionAdded; + params->GetExceptionAdded (&exceptionAdded); + g_print ("exceptionAdded %d\n", exceptionAdded); + if (exceptionAdded) + return domNSLocation->Reload (); + + + return NS_OK; +} + NS_IMPL_ISUPPORTS1(EphyContextMenuListener, nsIDOMContextMenuListener) NS_IMETHODIMP @@ -555,6 +821,7 @@ EphyBrowser::EphyBrowser () , mDOMScrollEventListener(nsnull) , mPopupBlockEventListener(nsnull) , mModalAlertListener(nsnull) +, mCommandEventListener(nsnull) , mContextMenuListener(nsnull) , mInitialized(PR_FALSE) { @@ -603,6 +870,9 @@ nsresult EphyBrowser::Init (EphyEmbed *embed) mModalAlertListener = new EphyModalAlertEventListener (this); if (!mModalAlertListener) return NS_ERROR_OUT_OF_MEMORY; + mCommandEventListener = new EphyCommandEventListener(this); + if (!mCommandEventListener) return NS_ERROR_OUT_OF_MEMORY; + mContextMenuListener = new EphyContextMenuListener(this); if (!mContextMenuListener) return NS_ERROR_OUT_OF_MEMORY; @@ -669,6 +939,8 @@ EphyBrowser::AttachListeners(void) mModalAlertListener, PR_TRUE, PR_FALSE); rv |= target->AddEventListener(NS_LITERAL_STRING ("DOMModalDialogClosed"), mModalAlertListener, PR_TRUE, PR_FALSE); + rv |= target->AddEventListener(NS_LITERAL_STRING ("command"), + mCommandEventListener, PR_FALSE, PR_FALSE); rv |= target->AddEventListener(NS_LITERAL_STRING ("contextmenu"), mContextMenuListener, PR_TRUE /* capture */, PR_FALSE); NS_ENSURE_SUCCESS (rv, rv); @@ -696,6 +968,8 @@ EphyBrowser::DetachListeners(void) mModalAlertListener, PR_TRUE); rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("DOMModalDialogClosed"), mModalAlertListener, PR_TRUE); + rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("command"), + mCommandEventListener, PR_FALSE); rv |= mEventTarget->RemoveEventListener(NS_LITERAL_STRING ("contextmenu"), mContextMenuListener, PR_TRUE /* capture */); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h index 75ad0e8c9..68f41b0af 100644 --- a/embed/mozilla/EphyBrowser.h +++ b/embed/mozilla/EphyBrowser.h @@ -107,6 +107,14 @@ public: EphyDOMScrollEventListener(EphyBrowser *aOwner) : EphyEventListener(aOwner) { }; }; +class EphyCommandEventListener : public EphyEventListener +{ +public: + NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); + + EphyCommandEventListener(EphyBrowser *aOwner) : EphyEventListener(aOwner) { }; +}; + class EphyContextMenuListener : public nsIDOMContextMenuListener { public: @@ -131,6 +139,7 @@ friend class EphyMiscDOMEventsListener; friend class EphyDOMScrollEventListener; friend class EphyPopupBlockEventListener; friend class EphyModalAlertEventListener; +friend class EphyCommandEventListener; friend class EphyContextMenuListener; public: EphyBrowser(); @@ -204,6 +213,7 @@ private: EphyDOMScrollEventListener *mDOMScrollEventListener; EphyPopupBlockEventListener *mPopupBlockEventListener; EphyModalAlertEventListener *mModalAlertListener; + EphyCommandEventListener *mCommandEventListener; EphyContextMenuListener *mContextMenuListener; PRBool mInitialized; #ifdef HAVE_MOZILLA_PSM diff --git a/embed/mozilla/EphyDirectoryProvider.cpp b/embed/mozilla/EphyDirectoryProvider.cpp index 0719f95b1..c1971a1a8 100644 --- a/embed/mozilla/EphyDirectoryProvider.cpp +++ b/embed/mozilla/EphyDirectoryProvider.cpp @@ -94,7 +94,7 @@ EphyDirectoryProvider::GetFiles (const char *prop, NS_ENSURE_SUCCESS (rv, rv); #ifdef HAVE_GECKO_1_9 - nsCOMPtr<nsIMutableArray> array (do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID)); + nsCOMPtr<nsIMutableArray> array (do_CreateInstance(NS_ARRAY_CONTRACTID)); if(!array) return NS_ERROR_OUT_OF_MEMORY; rv = array->AppendElement (manifestDir, PR_FALSE); diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index 8bcde308c..c669d399a 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -165,3 +165,12 @@ libephymozillaembed_la_CXXFLAGS = \ $(GECKO_CFLAGS) \ $(DEPENDENCIES_CFLAGS) \ $(AM_CXXFLAGS) + +if HAVE_GECKO_1_9 +xptdir = $(pkgdatadir)/components +xpt_DATA = epiphany.xpt + +noinst_DATA = \ + ephyIAddCertExceptionParams.idl \ + ephyIAddCertExceptionParams.h +endif diff --git a/embed/mozilla/ephyAddCertException.h b/embed/mozilla/ephyAddCertException.h deleted file mode 100644 index 04f84cebf..000000000 --- a/embed/mozilla/ephyAddCertException.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * DO NOT EDIT. THIS FILE IS GENERATED FROM ephyAddCertException.idl - */ - -#ifndef __gen_ephyAddCertException_h__ -#define __gen_ephyAddCertException_h__ - - -#ifndef __gen_nsISupports_h__ -#include "nsISupports.h" -#endif - -#ifndef __gen_nsIDOMWindow_h__ -#include "nsIDOMWindow.h" -#endif - -#ifndef __gen_nsIDOMDocument_h__ -#include "nsIDOMDocument.h" -#endif - -/* For IDL files that don't want to include root IDL files. */ -#ifndef NS_NO_VTABLE -#define NS_NO_VTABLE -#endif - -/* starting interface: ephyAddCertException */ -#define EPHYADDCERTEXCEPTION_IID_STR "cfdca027-c2c7-446a-8031-4d0041ab9f1e" - -#define EPHYADDCERTEXCEPTION_IID \ - {0xcfdca027, 0xc2c7, 0x446a, \ - { 0x80, 0x31, 0x4d, 0x00, 0x41, 0xab, 0x9f, 0x1e }} - -class NS_NO_VTABLE ephyAddCertException : public nsISupports { - public: - - NS_DECLARE_STATIC_IID_ACCESSOR(EPHYADDCERTEXCEPTION_IID) - - /* void showAddCertExceptionDialog (in nsIDOMDocument aDocument); */ - NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument) = 0; - -}; - - NS_DEFINE_STATIC_IID_ACCESSOR(ephyAddCertException, EPHYADDCERTEXCEPTION_IID) - -/* Use this macro when declaring classes that implement this interface. */ -#define NS_DECL_EPHYADDCERTEXCEPTION \ - NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument); - -/* Use this macro to declare functions that forward the behavior of this interface to another object. */ -#define NS_FORWARD_EPHYADDCERTEXCEPTION(_to) \ - NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument) { return _to ShowAddCertExceptionDialog(aDocument); } - -/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ -#define NS_FORWARD_SAFE_EPHYADDCERTEXCEPTION(_to) \ - NS_IMETHOD ShowAddCertExceptionDialog(nsIDOMDocument *aDocument) { return !_to ? NS_ERROR_NULL_POINTER : _to->ShowAddCertExceptionDialog(aDocument); } - -#if 0 -/* Use the code below as a template for the implementation class for this interface. */ - -/* Header file */ -class _MYCLASS_ : public ephyAddCertException -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_EPHYADDCERTEXCEPTION - - _MYCLASS_(); - -private: - ~_MYCLASS_(); - -protected: - /* additional members */ -}; - -/* Implementation file */ -NS_IMPL_ISUPPORTS1(_MYCLASS_, ephyAddCertException) - -_MYCLASS_::_MYCLASS_() -{ - /* member initializers and constructor code */ -} - -_MYCLASS_::~_MYCLASS_() -{ - /* destructor code */ -} - -/* void showAddCertExceptionDialog (in nsIDOMDocument aDocument); */ -NS_IMETHODIMP _MYCLASS_::ShowAddCertExceptionDialog(nsIDOMDocument *aDocument) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* End of implementation class template. */ -#endif - - -#endif /* __gen_ephyAddCertException_h__ */ diff --git a/embed/mozilla/ephyAddCertException.idl b/embed/mozilla/ephyAddCertException.idl deleted file mode 100644 index 3d04140b6..000000000 --- a/embed/mozilla/ephyAddCertException.idl +++ /dev/null @@ -1,8 +0,0 @@ -#include "nsISupports.idl" -#include "nsIDOMWindow.idl" -#include "nsIDOMDocument.idl" - -[uuid(cfdca027-c2c7-446a-8031-4d0041ab9f1e)] -interface ephyAddCertException : nsISupports { - void showAddCertExceptionDialog (in nsIDOMDocument aDocument); -}; diff --git a/embed/mozilla/ephyAddCertException.js b/embed/mozilla/ephyAddCertException.js deleted file mode 100644 index 874c1a50a..000000000 --- a/embed/mozilla/ephyAddCertException.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - 1 # -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - 2 # ***** BEGIN LICENSE BLOCK ***** - 3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1 - 4 # - 5 # The contents of this file are subject to the Mozilla Public License Version - 6 # 1.1 (the "License"); you may not use this file except in compliance with - 7 # the License. You may obtain a copy of the License at - 8 # http://www.mozilla.org/MPL/ - 9 # - 10 # Software distributed under the License is distributed on an "AS IS" basis, - 11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - 12 # for the specific language governing rights and limitations under the - 13 # License. - 14 # - 15 # The Original Code is mozilla.org code. - 16 # - 17 # The Initial Developer of the Original Code is - 18 # Netscape Communications Corporation. - 19 # Portions created by the Initial Developer are Copyright (C) 1998 - 20 # the Initial Developer. All Rights Reserved. - 21 # - 22 # Contributor(s): - 23 # Blake Ross <blake@cs.stanford.edu> - 24 # David Hyatt <hyatt@mozilla.org> - 25 # Peter Annema <disttsc@bart.nl> - 26 # Dean Tessman <dean_tessman@hotmail.com> - 27 # Kevin Puetz <puetzk@iastate.edu> - 28 # Ben Goodger <ben@netscape.com> - 29 # Pierre Chanial <chanial@noos.fr> - 30 # Jason Eager <jce2@po.cwru.edu> - 31 # Joe Hewitt <hewitt@netscape.com> - 32 # Alec Flett <alecf@netscape.com> - 33 # Asaf Romano <mozilla.mano@sent.com> - 34 # Jason Barnabe <jason_barnabe@fastmail.fm> - 35 # Peter Parente <parente@cs.unc.edu> - 36 # Giorgio Maone <g.maone@informaction.com> - 37 # Tom Germeau <tom.germeau@epigoon.com> - 38 # Jesse Ruderman <jruderman@gmail.com> - 39 # Joe Hughes <joe@retrovirus.com> - 40 # Pamela Greene <pamg.bugs@gmail.com> - 41 # Michael Ventnor <m.ventnor@gmail.com> - 42 # Simon Bünzli <zeniko@gmail.com> - 43 # Johnathan Nightingale <johnath@mozilla.com> - 44 # Ehsan Akhgari <ehsan.akhgari@gmail.com> - 45 # Dão Gottwald <dao@mozilla.com> - 46 # - 47 # Alternatively, the contents of this file may be used under the terms of - 48 # either the GNU General Public License Version 2 or later (the "GPL"), or - 49 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - 50 # in which case the provisions of the GPL or the LGPL are applicable instead - 51 # of those above. If you wish to allow use of your version of this file only - 52 # under the terms of either the GPL or the LGPL, and not to allow others to - 53 # use your version of this file under the terms of the MPL, indicate your - 54 # decision by deleting the provisions above and replace them with the notice - 55 # and other provisions required by the GPL or the LGPL. If you do not delete - 56 # the provisions above, a recipient may use your version of this file under - 57 # the terms of any one of the MPL, the GPL or the LGPL. -*/ - -var Cc = Components.classes; -var Ci = Components.interfaces; -var Cu = Components.utils; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -function ephyAddCertExceptionService() { } - -ephyAddCertExceptionService.prototype = { - - classDescription: "ephyAddCertException dialogue", - contractID: "@gnome.org/epiphany/add-cert-exception;1", - classID: Components.ID("{f32ede25-4135-4896-834a-303326c553d4}"), - QueryInterface: XPCOMUtils.generateQI([Ci.ephyAddCertException]), - - showAddCertExceptionDialog : function(aDocument) { - var params = { exceptionAdded : false }; - - try { - /* - switch (gPrefService.getIntPref("browser.ssl_override_behavior")) { - case 2 : // Pre-fetch & pre-populate - params.prefetchCert = true; - case 1 : // Pre-populate - params.location = aLocation.href; - }*/ - params.location = aDocument.location.href; - params.prefetchCert = true; - } catch (e) { - Cu.reportError("Couldn't get ssl_override pref: " + e); - } - - window.openDialog('chrome://pippki/content/exceptionDialog.xul', - '','chrome,centerscreen,modal', params); - - // If the user added the exception cert, attempt to reload the page - if (params.exceptionAdded) - aDocument.location.reload(); - } -}; - -var component = [ephyAddCertExceptionService]; -function NSGetModule(compMgr, fileSpec) { - return XPCOMUtils.generateModule(component); -} diff --git a/embed/mozilla/ephyAddCertException.xpt b/embed/mozilla/ephyAddCertException.xpt Binary files differdeleted file mode 100644 index d66b58832..000000000 --- a/embed/mozilla/ephyAddCertException.xpt +++ /dev/null diff --git a/embed/mozilla/ephyIAddCertExceptionParams.h b/embed/mozilla/ephyIAddCertExceptionParams.h new file mode 100644 index 000000000..a2a93bbfb --- /dev/null +++ b/embed/mozilla/ephyIAddCertExceptionParams.h @@ -0,0 +1,123 @@ +/* + * DO NOT EDIT. THIS FILE IS GENERATED FROM ephyIAddCertExceptionParams.idl + */ + +#ifndef __gen_ephyIAddCertExceptionParams_h__ +#define __gen_ephyIAddCertExceptionParams_h__ + + +#ifndef __gen_nsISupports_h__ +#include "nsISupports.h" +#endif + +/* For IDL files that don't want to include root IDL files. */ +#ifndef NS_NO_VTABLE +#define NS_NO_VTABLE +#endif + +/* starting interface: ephyIAddCertExceptionParams */ +#define EPHYIADDCERTEXCEPTIONPARAMS_IID_STR "2bac2eb2-cd10-4e3f-802e-dade8096d6c5" + +#define EPHYIADDCERTEXCEPTIONPARAMS_IID \ + {0x2bac2eb2, 0xcd10, 0x4e3f, \ + { 0x80, 0x2e, 0xda, 0xde, 0x80, 0x96, 0xd6, 0xc5 }} + +class NS_NO_VTABLE NS_SCRIPTABLE ephyIAddCertExceptionParams : public nsISupports { + public: + + NS_DECLARE_STATIC_IID_ACCESSOR(EPHYIADDCERTEXCEPTIONPARAMS_IID) + + /* readonly attribute boolean prefetchCert; */ + NS_SCRIPTABLE NS_IMETHOD GetPrefetchCert(PRBool *aPrefetchCert) = 0; + + /* readonly attribute AString location; */ + NS_SCRIPTABLE NS_IMETHOD GetLocation(nsAString & aLocation) = 0; + + /* attribute boolean exceptionAdded; */ + NS_SCRIPTABLE NS_IMETHOD GetExceptionAdded(PRBool *aExceptionAdded) = 0; + NS_SCRIPTABLE NS_IMETHOD SetExceptionAdded(PRBool aExceptionAdded) = 0; + +}; + + NS_DEFINE_STATIC_IID_ACCESSOR(ephyIAddCertExceptionParams, EPHYIADDCERTEXCEPTIONPARAMS_IID) + +/* Use this macro when declaring classes that implement this interface. */ +#define NS_DECL_EPHYIADDCERTEXCEPTIONPARAMS \ + NS_SCRIPTABLE NS_IMETHOD GetPrefetchCert(PRBool *aPrefetchCert); \ + NS_SCRIPTABLE NS_IMETHOD GetLocation(nsAString & aLocation); \ + NS_SCRIPTABLE NS_IMETHOD GetExceptionAdded(PRBool *aExceptionAdded); \ + NS_SCRIPTABLE NS_IMETHOD SetExceptionAdded(PRBool aExceptionAdded); + +/* Use this macro to declare functions that forward the behavior of this interface to another object. */ +#define NS_FORWARD_EPHYIADDCERTEXCEPTIONPARAMS(_to) \ + NS_SCRIPTABLE NS_IMETHOD GetPrefetchCert(PRBool *aPrefetchCert) { return _to GetPrefetchCert(aPrefetchCert); } \ + NS_SCRIPTABLE NS_IMETHOD GetLocation(nsAString & aLocation) { return _to GetLocation(aLocation); } \ + NS_SCRIPTABLE NS_IMETHOD GetExceptionAdded(PRBool *aExceptionAdded) { return _to GetExceptionAdded(aExceptionAdded); } \ + NS_SCRIPTABLE NS_IMETHOD SetExceptionAdded(PRBool aExceptionAdded) { return _to SetExceptionAdded(aExceptionAdded); } + +/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ +#define NS_FORWARD_SAFE_EPHYIADDCERTEXCEPTIONPARAMS(_to) \ + NS_SCRIPTABLE NS_IMETHOD GetPrefetchCert(PRBool *aPrefetchCert) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPrefetchCert(aPrefetchCert); } \ + NS_SCRIPTABLE NS_IMETHOD GetLocation(nsAString & aLocation) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLocation(aLocation); } \ + NS_SCRIPTABLE NS_IMETHOD GetExceptionAdded(PRBool *aExceptionAdded) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExceptionAdded(aExceptionAdded); } \ + NS_SCRIPTABLE NS_IMETHOD SetExceptionAdded(PRBool aExceptionAdded) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetExceptionAdded(aExceptionAdded); } + +#if 0 +/* Use the code below as a template for the implementation class for this interface. */ + +/* Header file */ +class _MYCLASS_ : public ephyIAddCertExceptionParams +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_EPHYIADDCERTEXCEPTIONPARAMS + + _MYCLASS_(); + +private: + ~_MYCLASS_(); + +protected: + /* additional members */ +}; + +/* Implementation file */ +NS_IMPL_ISUPPORTS1(_MYCLASS_, ephyIAddCertExceptionParams) + +_MYCLASS_::_MYCLASS_() +{ + /* member initializers and constructor code */ +} + +_MYCLASS_::~_MYCLASS_() +{ + /* destructor code */ +} + +/* readonly attribute boolean prefetchCert; */ +NS_IMETHODIMP _MYCLASS_::GetPrefetchCert(PRBool *aPrefetchCert) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute AString location; */ +NS_IMETHODIMP _MYCLASS_::GetLocation(nsAString & aLocation) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute boolean exceptionAdded; */ +NS_IMETHODIMP _MYCLASS_::GetExceptionAdded(PRBool *aExceptionAdded) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP _MYCLASS_::SetExceptionAdded(PRBool aExceptionAdded) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* End of implementation class template. */ +#endif + + +#endif /* __gen_ephyIAddCertExceptionParams_h__ */ diff --git a/embed/mozilla/ephyIAddCertExceptionParams.idl b/embed/mozilla/ephyIAddCertExceptionParams.idl new file mode 100644 index 000000000..60ee11423 --- /dev/null +++ b/embed/mozilla/ephyIAddCertExceptionParams.idl @@ -0,0 +1,8 @@ +#include "nsISupports.idl" + +[scriptable,uuid(2bac2eb2-cd10-4e3f-802e-dade8096d6c5)] +interface ephyIAddCertExceptionParams : nsISupports { + readonly attribute boolean prefetchCert; + readonly attribute AString location; + attribute boolean exceptionAdded; +}; diff --git a/embed/mozilla/epiphany.xpt b/embed/mozilla/epiphany.xpt Binary files differnew file mode 100644 index 000000000..ee2a81154 --- /dev/null +++ b/embed/mozilla/epiphany.xpt diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 4665917e7..84657d3a4 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -108,7 +108,7 @@ #ifndef HAVE_GECKO_1_9 #include "EphyDirectoryProvider.h" -#endif /* HAVE_GECKO_1_9 */; +#endif /* HAVE_GECKO_1_9 */ struct MozillaEmbedSinglePrivate { |