From 43677165c94609018dc9150e1e2fa1a4c5e904f5 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Wed, 26 Mar 2008 22:25:35 +0000 Subject: 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 --- embed/mozilla/EphyBrowser.cpp | 274 ++++++++++++++++++++++++++ embed/mozilla/EphyBrowser.h | 10 + embed/mozilla/EphyDirectoryProvider.cpp | 2 +- embed/mozilla/Makefile.am | 9 + embed/mozilla/ephyAddCertException.h | 99 ---------- embed/mozilla/ephyAddCertException.idl | 8 - embed/mozilla/ephyAddCertException.js | 105 ---------- embed/mozilla/ephyAddCertException.xpt | Bin 211 -> 0 bytes embed/mozilla/ephyIAddCertExceptionParams.h | 123 ++++++++++++ embed/mozilla/ephyIAddCertExceptionParams.idl | 8 + embed/mozilla/epiphany.xpt | Bin 0 -> 228 bytes embed/mozilla/mozilla-embed-single.cpp | 2 +- 12 files changed, 426 insertions(+), 214 deletions(-) delete mode 100644 embed/mozilla/ephyAddCertException.h delete mode 100644 embed/mozilla/ephyAddCertException.idl delete mode 100644 embed/mozilla/ephyAddCertException.js delete mode 100644 embed/mozilla/ephyAddCertException.xpt create mode 100644 embed/mozilla/ephyIAddCertExceptionParams.h create mode 100644 embed/mozilla/ephyIAddCertExceptionParams.idl create mode 100644 embed/mozilla/epiphany.xpt (limited to 'embed') 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 #include #include @@ -64,6 +65,8 @@ #include #include #include +#include +#include #include #include #include @@ -111,8 +114,160 @@ #include "EventContext.h" #include "GeckoPrintService.h" +#ifdef HAVE_GECKO_1_9 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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 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(NS_Alloc (1 * sizeof (nsIID*))); + if (!iids) + return NS_ERROR_OUT_OF_MEMORY; + + iids[0] = static_cast(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 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 originalTarget; + rv = nsEvent->GetOriginalTarget (getter_AddRefs (originalTarget)); + NS_ENSURE_SUCCESS (rv, rv); + + nsCOMPtr node (do_QueryInterface (originalTarget)); + if (!node) + return NS_OK; + + nsCOMPtr document; + rv = node->GetOwnerDocument (getter_AddRefs (document)); + NS_ENSURE_SUCCESS (rv, rv); + + nsCOMPtr 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 docElement (do_QueryInterface (document)); + + nsCOMPtr buttonElement; + rv = document->GetElementById (NS_LITERAL_STRING("exceptionDialogButton"), + getter_AddRefs (buttonElement)); + if (NS_FAILED (rv) || !buttonElement) + return NS_OK; + + nsCOMPtr 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 docView (do_QueryInterface (document)); + NS_ENSURE_TRUE (docView, NS_OK); + + nsCOMPtr view; + rv = docView->GetDefaultView (getter_AddRefs (view)); + NS_ENSURE_SUCCESS (rv, NS_OK); + + nsCOMPtr window (do_QueryInterface (view)); + NS_ENSURE_TRUE (window, NS_OK); + + nsCOMPtr windowInternal (do_QueryInterface (window)); + NS_ENSURE_TRUE (windowInternal, NS_OK); + + nsCOMPtr domLocation; + rv = windowInternal->GetLocation (getter_AddRefs (domLocation)); + if (NS_FAILED (rv)) + return NS_OK; + + nsCOMPtr domNSLocation (do_QueryInterface (domLocation)); + NS_ENSURE_TRUE (domNSLocation, NS_OK); + + nsString locationHref; + domLocation->GetHref (locationHref); + + nsRefPtr params (new EphyAddCertExceptionParams (locationHref, PR_TRUE)); + if (!params) + return NS_ERROR_OUT_OF_MEMORY; + + nsCOMPtr 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(static_cast(params)); + nsCOMPtr 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 array (do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID)); + nsCOMPtr 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 - 24 # David Hyatt - 25 # Peter Annema - 26 # Dean Tessman - 27 # Kevin Puetz - 28 # Ben Goodger - 29 # Pierre Chanial - 30 # Jason Eager - 31 # Joe Hewitt - 32 # Alec Flett - 33 # Asaf Romano - 34 # Jason Barnabe - 35 # Peter Parente - 36 # Giorgio Maone - 37 # Tom Germeau - 38 # Jesse Ruderman - 39 # Joe Hughes - 40 # Pamela Greene - 41 # Michael Ventnor - 42 # Simon Bünzli - 43 # Johnathan Nightingale - 44 # Ehsan Akhgari - 45 # Dão Gottwald - 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 deleted file mode 100644 index d66b58832..000000000 Binary files a/embed/mozilla/ephyAddCertException.xpt and /dev/null differ 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 new file mode 100644 index 000000000..ee2a81154 Binary files /dev/null and b/embed/mozilla/epiphany.xpt differ 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 { -- cgit v1.2.3