diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-04-18 18:24:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-04-18 18:24:48 +0800 |
commit | 4718a00482f6b2c952dd1cc6cd5abf20eda3365b (patch) | |
tree | b353ce120bb60f1d2ea21f8c32b3fb8e2e707300 | |
parent | 9bdc474dcf39663bf28d5d7458d23aa71345a936 (diff) | |
download | gsoc2013-epiphany-4718a00482f6b2c952dd1cc6cd5abf20eda3365b.tar gsoc2013-epiphany-4718a00482f6b2c952dd1cc6cd5abf20eda3365b.tar.gz gsoc2013-epiphany-4718a00482f6b2c952dd1cc6cd5abf20eda3365b.tar.bz2 gsoc2013-epiphany-4718a00482f6b2c952dd1cc6cd5abf20eda3365b.tar.lz gsoc2013-epiphany-4718a00482f6b2c952dd1cc6cd5abf20eda3365b.tar.xz gsoc2013-epiphany-4718a00482f6b2c952dd1cc6cd5abf20eda3365b.tar.zst gsoc2013-epiphany-4718a00482f6b2c952dd1cc6cd5abf20eda3365b.zip |
Don't override nsWebBrowserContentPolicy contract ID, just register our
2004-04-18 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EphyContentPolicy.h:
* embed/mozilla/MozRegisterComponents.cpp:
Don't override nsWebBrowserContentPolicy contract ID, just register our own
content policy with the category manager.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | embed/mozilla/EphyContentPolicy.h | 2 | ||||
-rw-r--r-- | embed/mozilla/MozRegisterComponents.cpp | 46 |
3 files changed, 47 insertions, 11 deletions
@@ -1,8 +1,16 @@ 2004-04-18 Christian Persch <chpe@cvs.gnome.org> + * embed/mozilla/EphyContentPolicy.h: + * embed/mozilla/MozRegisterComponents.cpp: + + Don't override nsWebBrowserContentPolicy contract ID, just register our own + content policy with the category manager. + +2004-04-18 Christian Persch <chpe@cvs.gnome.org> + * embed/mozilla/MozDownload.cpp: - Don't gunzip downloads (backported from HEAD). + Don't gunzip downloads (backported from HEAD), fixes bug #131778. 2004-04-16 Christian Persch <chpe@cvs.gnome.org> diff --git a/embed/mozilla/EphyContentPolicy.h b/embed/mozilla/EphyContentPolicy.h index 3742b8d53..171fb5c2c 100644 --- a/embed/mozilla/EphyContentPolicy.h +++ b/embed/mozilla/EphyContentPolicy.h @@ -27,7 +27,7 @@ #include "nsISupports.h" #include "nsIContentPolicy.h" -#define EPHY_CONTENT_POLICY_CONTRACTID "@mozilla.org/embedding/browser/content-policy;1" +#define EPHY_CONTENT_POLICY_CONTRACTID "@gnome.org/projects/epiphany/epiphany-content-policy;1" #define EPHY_CONTENT_POLICY_CLASSNAME "Epiphany Content Policy Class" #define EPHY_CONTENT_POLICY_CID \ diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp index 692fc1710..308098460 100644 --- a/embed/mozilla/MozRegisterComponents.cpp +++ b/embed/mozilla/MozRegisterComponents.cpp @@ -44,14 +44,12 @@ #endif #include <nsIGenericFactory.h> #include <nsIComponentRegistrar.h> +#include <nsICategoryManager.h> #include <nsCOMPtr.h> #include <nsILocalFile.h> #include <nsNetCID.h> -#if MOZILLA_SNAPSHOT > 13 -#include <nsDocShellCID.h> -#endif -#include <glib.h> +#include <glib/gmessages.h> NS_GENERIC_FACTORY_CONSTRUCTOR(EphyAboutRedirector) NS_GENERIC_FACTORY_CONSTRUCTOR(MozDownload) @@ -74,6 +72,22 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSClientAuthDialogs) NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSDialogs) NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSKeyPairDialogs) #endif + +static NS_METHOD +RegisterContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath, + const char *registryLocation, const char *componentType, + const nsModuleComponentInfo *info) +{ + nsCOMPtr<nsICategoryManager> cm = + do_GetService(NS_CATEGORYMANAGER_CONTRACTID); + NS_ENSURE_TRUE (cm, NS_ERROR_FAILURE); + + nsXPIDLCString oldval; + return cm->AddCategoryEntry("content-policy", + EPHY_CONTENT_POLICY_CONTRACTID, + EPHY_CONTENT_POLICY_CONTRACTID, + PR_TRUE, PR_TRUE, getter_Copies (oldval)); +} static const nsModuleComponentInfo sAppComps[] = { #if MOZILLA_SNAPSHOT < 12 @@ -208,12 +222,11 @@ static const nsModuleComponentInfo sAppComps[] = { EPHY_CONTENT_POLICY_CLASSNAME, EPHY_CONTENT_POLICY_CID, EPHY_CONTENT_POLICY_CONTRACTID, - EphyContentPolicyConstructor - } + EphyContentPolicyConstructor, + RegisterContentPolicy + }, }; -static const int sNumAppComps = sizeof(sAppComps) / sizeof(nsModuleComponentInfo); - static const nsModuleComponentInfo sFtpComps = { G_FTP_PROTOCOL_CLASSNAME, G_FTP_PROTOCOL_CID, @@ -237,7 +250,11 @@ mozilla_register_components (void) NS_GetComponentRegistrar(getter_AddRefs(cr)); NS_ENSURE_TRUE (cr, FALSE); - for (int i = 0; i < sNumAppComps; i++) + nsCOMPtr<nsIComponentManager> cm; + NS_GetComponentManager (getter_AddRefs (cm)); + NS_ENSURE_TRUE (cm, FALSE); + + for (guint i = 0; i < G_N_ELEMENTS (sAppComps); i++) { nsCOMPtr<nsIGenericFactory> componentFactory; rv = NS_NewGenericFactory(getter_AddRefs(componentFactory), @@ -260,6 +277,17 @@ mozilla_register_components (void) ret = FALSE; } + + if (sAppComps[i].mRegisterSelfProc) + { + rv = sAppComps[i].mRegisterSelfProc (cm, nsnull, nsnull, nsnull, &sAppComps[i]); + + if (NS_FAILED (rv)) + { + g_warning ("Failed to register-self for %s\n", sAppComps[i].mDescription); + ret = FALSE; + } + } } return ret; |