summaryrefslogtreecommitdiff
path: root/src/libs/xpcom18a4/xpcom/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/xpcom18a4/xpcom/components')
-rw-r--r--src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp15
-rw-r--r--src/libs/xpcom18a4/xpcom/components/nsNativeComponentLoader.cpp48
2 files changed, 62 insertions, 1 deletions
diff --git a/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp b/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp
index 681030a0..ec3cb3f5 100644
--- a/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp
+++ b/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp
@@ -2375,7 +2375,7 @@ nsComponentManagerImpl::GetServiceByContractID(const char* aContractID,
mon.Enter();
-#ifdef XPCOM_CHECK_PENDING_CIDS
+#ifdef XPCOM_CHECK_PENDING_CIDS
if (entry)
RemovePendingCID(entry->mCid);
#endif
@@ -3722,8 +3722,21 @@ NS_GetServiceManager(nsIServiceManager* *result)
if (nsComponentManagerImpl::gComponentManager == nsnull)
{
+#ifdef VBOX
+ // While XPCOM might need initialization, we're not in a position
+ // to pass the right values to this call. This is actually triggered
+ // on object destruction, so there is no point in re-initializing,
+ // and actually the attempt would lead to nested calls to
+ // xptiInterfaceInfoManager::BuildFileSearchPath, which it detects
+ // as unsafe in debug builds. Just fail, no real problem.
+#ifdef DEBUG
+ printf("NS_GetServiceManager: no current instance, suppressed XPCOM initialization!\n");
+#endif
+ rv = NS_ERROR_SERVICE_NOT_AVAILABLE;
+#else /* !VBOX */
// XPCOM needs initialization.
rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
+#endif /* !VBOX */
}
if (NS_FAILED(rv))
diff --git a/src/libs/xpcom18a4/xpcom/components/nsNativeComponentLoader.cpp b/src/libs/xpcom18a4/xpcom/components/nsNativeComponentLoader.cpp
index 1ccd862c..a3fd5df8 100644
--- a/src/libs/xpcom18a4/xpcom/components/nsNativeComponentLoader.cpp
+++ b/src/libs/xpcom18a4/xpcom/components/nsNativeComponentLoader.cpp
@@ -674,6 +674,7 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when,
*registered = PR_FALSE;
+#ifndef VBOX
/* this should be a pref or registry entry, or something */
static const char *ValidDllExtensions[] = {
".dll", /* Windows */
@@ -749,6 +750,53 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when,
// Skip invalid extensions
return NS_OK;
+#else /* VBOX */
+ /* VBox: Only one valid suffix exist, so dispense with the the list. */
+# ifdef RT_OS_DARWIN
+# ifdef VBOX_IN_32_ON_64_MAIN_API
+ static const char s_szSuff[] = "-x86.dylib";
+# else
+ static const char s_szSuff[] = ".dylib";
+ static const char s_szSuffInvalid[] = "-x86.dylib";
+# endif
+# elif defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
+# ifdef VBOX_IN_32_ON_64_MAIN_API
+ static const char s_szSuff[] = "-x86.dll";
+#else
+ static const char s_szSuff[] = ".dll";
+ static const char s_szSuffInvalid[] = "-x86.dll";
+# endif
+# else
+# ifdef VBOX_IN_32_ON_64_MAIN_API
+ static const char s_szSuff[] = "-x86.so";
+#else
+ static const char s_szSuff[] = ".so";
+ static const char s_szSuffInvalid[] = "-x86.so";
+# endif
+# endif
+
+ nsCAutoString strLeafName;
+ rv = component->GetNativeLeafName(strLeafName);
+ if (NS_FAILED(rv))
+ return rv;
+ size_t cchLeafName = strLeafName.Length();
+ if ( cchLeafName <= sizeof(s_szSuff)
+ || PL_strcasecmp(strLeafName.get() + cchLeafName - sizeof(s_szSuff) + 1, s_szSuff))
+ {
+ PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("Skipping '%s'...", strLeafName.get()));
+ return NS_OK; /* skip */
+ }
+# ifndef VBOX_IN_32_ON_64_MAIN_API
+ if ( cchLeafName >= sizeof(s_szSuffInvalid)
+ && !PL_strcasecmp(strLeafName.get() + cchLeafName - sizeof(s_szSuffInvalid) + 1, s_szSuffInvalid))
+ {
+ PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("Skipping '%s' (#2)...", strLeafName.get()));
+ return NS_OK; /* skip */
+ }
+# endif
+ PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("... '%s'", strLeafName.get()));
+#endif /* VBOX */
+
nsXPIDLCString persistentDescriptor;
// what I want to do here is QI for a Component Registration Manager. Since this
// has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.