aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/MozRegisterComponents.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-03-06 06:07:52 +0800
committerChristian Persch <chpe@src.gnome.org>2006-03-06 06:07:52 +0800
commit75c4ac43b7158e6dfffc341b59449febeaaa50f4 (patch)
treef7df2e2b37123277dc9e1e0225807196f5137967 /embed/mozilla/MozRegisterComponents.cpp
parent600ddc54f68e4244f672e882167965e7d4311d26 (diff)
downloadgsoc2013-epiphany-75c4ac43b7158e6dfffc341b59449febeaaa50f4.tar
gsoc2013-epiphany-75c4ac43b7158e6dfffc341b59449febeaaa50f4.tar.gz
gsoc2013-epiphany-75c4ac43b7158e6dfffc341b59449febeaaa50f4.tar.bz2
gsoc2013-epiphany-75c4ac43b7158e6dfffc341b59449febeaaa50f4.tar.lz
gsoc2013-epiphany-75c4ac43b7158e6dfffc341b59449febeaaa50f4.tar.xz
gsoc2013-epiphany-75c4ac43b7158e6dfffc341b59449febeaaa50f4.tar.zst
gsoc2013-epiphany-75c4ac43b7158e6dfffc341b59449febeaaa50f4.zip
Back the xpinstall change out; it breaks on gecko 1.8.
2006-03-05 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/MozRegisterComponents.cpp: Back the xpinstall change out; it breaks on gecko 1.8.
Diffstat (limited to 'embed/mozilla/MozRegisterComponents.cpp')
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp85
1 files changed, 30 insertions, 55 deletions
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index 0c46f12f0..03867c699 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -53,8 +53,6 @@
#include <nsCOMPtr.h>
#include <nsILocalFile.h>
#include <nsNetCID.h>
-#include <nsIScriptNameSpaceManager.h>
-#include <nsCURILoader.h>
#include <glib/gmessages.h>
@@ -78,43 +76,42 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSKeyPairDialogs)
NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSSecurityWarningDialogs)
#endif
-#define XPINSTALL_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX "application/x-xpinstall"
/* class information */
NS_DECL_CLASSINFO(EphySidebar)
-static nsresult
-RegisterCategories (void)
+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);
+
nsresult rv;
- nsCOMPtr<nsICategoryManager> catMan =
- do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS (rv, rv);
+ char *oldval = nsnull;
+ rv = cm->AddCategoryEntry ("content-policy",
+ EPHY_CONTENT_POLICY_CONTRACTID,
+ EPHY_CONTENT_POLICY_CONTRACTID,
+ PR_TRUE, PR_TRUE, &oldval);
+ if (oldval)
+ nsMemory::Free (oldval);
+ return rv;
+}
- rv = catMan->AddCategoryEntry ("content-policy",
- EPHY_CONTENT_POLICY_CONTRACTID,
- EPHY_CONTENT_POLICY_CONTRACTID,
- PR_FALSE /* don't persist */,
- PR_TRUE /* replace */,
- nsnull);
-
- rv |= catMan->AddCategoryEntry (JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
- "sidebar",
- NS_SIDEBAR_CONTRACTID,
- PR_FALSE /* don't persist */,
- PR_TRUE /* replace */,
- nsnull);
-
- /* Unregister the XPI install trigger, so we can just download .xpi files */
- rv |= catMan->DeleteCategoryEntry (JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
- "InstallVersion",
- PR_FALSE /* don't persist */);
- rv |= catMan->DeleteCategoryEntry (JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
- "InstallTrigger",
- PR_FALSE /* don't persist */);
- NS_ENSURE_SUCCESS (rv, rv);
+static NS_METHOD
+RegisterSidebar(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);
- return rv;
+ return cm->AddCategoryEntry("JavaScript global property",
+ "sidebar", NS_SIDEBAR_CONTRACTID,
+ PR_FALSE, PR_TRUE, nsnull);
}
static const nsModuleComponentInfo sAppComps[] = {
@@ -191,13 +188,14 @@ static const nsModuleComponentInfo sAppComps[] = {
EPHY_CONTENT_POLICY_CID,
EPHY_CONTENT_POLICY_CONTRACTID,
EphyContentPolicyConstructor,
+ RegisterContentPolicy
},
{
EPHY_SIDEBAR_CLASSNAME,
EPHY_SIDEBAR_CID,
NS_SIDEBAR_CONTRACTID,
EphySidebarConstructor,
- nsnull /* no register func */,
+ RegisterSidebar,
nsnull /* no unregister func */,
nsnull /* no factory destructor */,
NS_CI_INTERFACE_GETTER_NAME(EphySidebar),
@@ -328,29 +326,6 @@ mozilla_register_components (void)
}
}
- rv = RegisterCategories();
- ret = NS_SUCCEEDED (rv);
-
- /* Unregister xpinstall content handler */
- nsCID *cidPtr = nsnull;
- rv = cr->ContractIDToCID (XPINSTALL_CONTRACTID, &cidPtr);
- if (NS_SUCCEEDED (rv) && cidPtr)
- {
- nsCOMPtr<nsIFactory> factory;
- rv = cm->GetClassObject (*cidPtr, NS_GET_IID (nsIFactory),
- getter_AddRefs (factory));
- if (NS_SUCCEEDED (rv))
- {
- rv = cr->UnregisterFactory (*cidPtr, factory);
- }
-
- nsMemory::Free (cidPtr);
- }
- if (NS_FAILED (rv))
- {
- g_warning ("Failed to unregister xpinstall content handler!\n");
- }
-
#if defined(HAVE_MOZILLA_PSM) && !defined(HAVE_GECKO_1_8)
/* Workaround for http://bugzilla.gnome.org/show_bug.cgi?id=164670 */
rv = reregister_secure_browser_ui (cm, cr);