VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp@ 101808

Last change on this file since 101808 was 101808, checked in by vboxsync, 15 months ago

libs/xpcom: Get rid of unused nsFastLoadService and nsFastLoadFile, bugref:10545

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 38.8 KB
Line 
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#include "nsXPCOM.h"
39#include "nsXPCOMPrivate.h"
40#include "nscore.h"
41#include "prlink.h"
42#include "nsCOMPtr.h"
43#include "nsObserverList.h"
44#include "nsObserverService.h"
45#include "nsProperties.h"
46#include "nsIProperties.h"
47#include "nsPersistentProperties.h"
48#include "nsScriptableInputStream.h"
49#include "nsBinaryStream.h"
50#include "nsStorageStream.h"
51
52#include "nsMemoryImpl.h"
53#include "nsDebugImpl.h"
54#include "nsTraceRefcntImpl.h"
55#include "nsErrorService.h"
56#include "nsByteBuffer.h"
57
58#include "nsSupportsArray.h"
59#include "nsArray.h"
60#include "nsSupportsPrimitives.h"
61#include "nsConsoleService.h"
62#include "nsExceptionService.h"
63
64#include "nsComponentManager.h"
65#include "nsCategoryManagerUtils.h"
66#include "nsIServiceManager.h"
67#include "nsGenericFactory.h"
68
69#include "nsEventQueueService.h"
70#include "nsEventQueue.h"
71#ifdef VBOX
72# include "nsEventQueueUtils.h"
73# include "nsProxyRelease.h"
74#endif /* VBOX */
75
76#include "nsIProxyObjectManager.h"
77#include "nsProxyEventPrivate.h" // access to the impl of nsProxyObjectManager for the generic factory registration.
78
79#include "xptinfo.h"
80#include "nsIInterfaceInfoManager.h"
81
82#include "nsTimerImpl.h"
83#include "TimerThread.h"
84
85#include "nsThread.h"
86#include "nsProcess.h"
87#include "nsEnvironment.h"
88
89#include "nsEmptyEnumerator.h"
90
91#include "nsILocalFile.h"
92#include "nsLocalFile.h"
93#if defined(XP_UNIX) || defined(XP_OS2)
94#include "nsNativeCharsetUtils.h"
95#endif
96#include "nsDirectoryService.h"
97#include "nsDirectoryServiceDefs.h"
98#include "nsCategoryManager.h"
99#include "nsICategoryManager.h"
100#include "nsStringStream.h"
101#include "nsMultiplexInputStream.h"
102
103#include "nsAtomService.h"
104#include "nsAtomTable.h"
105#include "nsTraceRefcnt.h"
106
107#include "nsVariant.h"
108
109#include "nsRecyclingAllocator.h"
110
111#include "SpecialSystemDirectory.h"
112
113#include "ipcdclient.h"
114#include "ipcService.h"
115#include "ipcConfig.h"
116#include "ipcCID.h"
117#include "ipcLockService.h"
118#include "ipcLockCID.h"
119#include "tmTransactionService.h"
120#include "ipcDConnectService.h"
121
122#include <locale.h>
123
124// Registry Factory creation function defined in nsRegistry.cpp
125// We hook into this function locally to create and register the registry
126// Since noone outside xpcom needs to know about this and nsRegistry.cpp
127// does not have a local include file, we are putting this definition
128// here rather than in nsIRegistry.h
129extern nsresult NS_RegistryGetFactory(nsIFactory** aFactory);
130extern nsresult NS_CategoryManagerGetFactory( nsIFactory** );
131
132#ifdef DEBUG
133extern void _FreeAutoLockStatics();
134#endif
135
136static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
137static NS_DEFINE_CID(kMemoryCID, NS_MEMORY_CID);
138static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
139
140NS_GENERIC_FACTORY_CONSTRUCTOR(nsProcess)
141NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsEventQueueServiceImpl, Init)
142
143#define NS_ENVIRONMENT_CLASSNAME "Environment Service"
144
145#include "nsXPCOM.h"
146// ds/nsISupportsPrimitives
147#define NS_SUPPORTS_ID_CLASSNAME "Supports ID"
148#define NS_SUPPORTS_CSTRING_CLASSNAME "Supports String"
149#define NS_SUPPORTS_STRING_CLASSNAME "Supports WString"
150#define NS_SUPPORTS_PRBOOL_CLASSNAME "Supports PRBool"
151#define NS_SUPPORTS_PRUINT8_CLASSNAME "Supports PRUint8"
152#define NS_SUPPORTS_PRUINT16_CLASSNAME "Supports PRUint16"
153#define NS_SUPPORTS_PRUINT32_CLASSNAME "Supports PRUint32"
154#define NS_SUPPORTS_PRUINT64_CLASSNAME "Supports PRUint64"
155#define NS_SUPPORTS_PRTIME_CLASSNAME "Supports PRTime"
156#define NS_SUPPORTS_CHAR_CLASSNAME "Supports Char"
157#define NS_SUPPORTS_PRINT16_CLASSNAME "Supports PRInt16"
158#define NS_SUPPORTS_PRINT32_CLASSNAME "Supports PRInt32"
159#define NS_SUPPORTS_PRINT64_CLASSNAME "Supports PRInt64"
160#define NS_SUPPORTS_FLOAT_CLASSNAME "Supports float"
161#define NS_SUPPORTS_DOUBLE_CLASSNAME "Supports double"
162#define NS_SUPPORTS_VOID_CLASSNAME "Supports void"
163#define NS_SUPPORTS_INTERFACE_POINTER_CLASSNAME "Supports interface pointer"
164
165NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsIDImpl)
166NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsStringImpl)
167NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsCStringImpl)
168NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRBoolImpl)
169NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint8Impl)
170NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint16Impl)
171NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint32Impl)
172NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRUint64Impl)
173NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRTimeImpl)
174NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsCharImpl)
175NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt16Impl)
176NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt32Impl)
177NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsPRInt64Impl)
178NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsFloatImpl)
179NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsDoubleImpl)
180NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsVoidImpl)
181NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsInterfacePointerImpl)
182
183NS_GENERIC_FACTORY_CONSTRUCTOR(nsArray)
184NS_GENERIC_FACTORY_CONSTRUCTOR(nsConsoleService)
185NS_GENERIC_FACTORY_CONSTRUCTOR(nsAtomService)
186NS_GENERIC_FACTORY_CONSTRUCTOR(nsExceptionService)
187NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerImpl)
188NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimerManager)
189NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryOutputStream)
190NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryInputStream)
191NS_GENERIC_FACTORY_CONSTRUCTOR(nsStorageStream)
192
193NS_GENERIC_FACTORY_CONSTRUCTOR(nsVariant)
194
195NS_GENERIC_FACTORY_CONSTRUCTOR(nsRecyclingAllocatorImpl)
196
197static NS_METHOD
198nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
199 const nsIID& aIID,
200 void* *aInstancePtr)
201{
202 NS_ENSURE_ARG_POINTER(aInstancePtr);
203 NS_ENSURE_TRUE(!outer, NS_ERROR_NO_AGGREGATION);
204
205 nsCOMPtr<nsIInterfaceInfoManager> iim(dont_AddRef(XPTI_GetInterfaceInfoManager()));
206 if (!iim) {
207 return NS_ERROR_FAILURE;
208 }
209
210 return iim->QueryInterface(aIID, aInstancePtr);
211}
212
213
214PR_STATIC_CALLBACK(nsresult)
215RegisterGenericFactory(nsIComponentRegistrar* registrar,
216 const nsModuleComponentInfo *info)
217{
218 nsresult rv;
219 nsIGenericFactory* fact;
220 rv = NS_NewGenericFactory(&fact, info);
221 if (NS_FAILED(rv)) return rv;
222
223 rv = registrar->RegisterFactory(info->mCID,
224 info->mDescription,
225 info->mContractID,
226 fact);
227 NS_RELEASE(fact);
228 return rv;
229}
230
231// In order to support the installer, we need
232// to be told out of band if we should cause
233// an autoregister. If the file ".autoreg" exists in the binary
234// directory, we check its timestamp against the timestamp of the
235// compreg.dat file. If the .autoreg file is newer, we autoregister.
236static PRBool CheckUpdateFile()
237{
238 nsresult rv;
239 nsCOMPtr<nsIProperties> directoryService;
240 nsDirectoryService::Create(nsnull,
241 NS_GET_IID(nsIProperties),
242 getter_AddRefs(directoryService));
243
244 if (!directoryService)
245 return PR_FALSE;
246
247 nsCOMPtr<nsIFile> file;
248 rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
249 NS_GET_IID(nsIFile),
250 getter_AddRefs(file));
251
252 if (NS_FAILED(rv)) {
253 NS_WARNING("Getting NS_XPCOM_CURRENT_PROCESS_DIR failed");
254 return PR_FALSE;
255 }
256
257 file->AppendNative(nsDependentCString(".autoreg"));
258
259 PRBool exists;
260 file->Exists(&exists);
261 if (!exists)
262 return PR_FALSE;
263
264 nsCOMPtr<nsIFile> compregFile;
265 rv = directoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE,
266 NS_GET_IID(nsIFile),
267 getter_AddRefs(compregFile));
268
269
270 if (NS_FAILED(rv)) {
271 NS_WARNING("Getting NS_XPCOM_COMPONENT_REGISTRY_FILE failed");
272 return PR_FALSE;
273 }
274
275 // Don't need to check whether compreg exists; if it doesn't
276 // we won't even be here.
277
278 PRInt64 compregModTime, autoregModTime;
279 compregFile->GetLastModifiedTime(&compregModTime);
280 file->GetLastModifiedTime(&autoregModTime);
281
282 return LL_CMP(autoregModTime, >, compregModTime);
283}
284
285#if 0 /// @todo later
286NS_GENERIC_FACTORY_CONSTRUCTOR(ipcService)
287NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ipcLockService, Init)
288NS_GENERIC_FACTORY_CONSTRUCTOR(tmTransactionService)
289NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ipcDConnectService, Init)
290
291// enable this code to make the IPC DCONNECT service auto-start.
292NS_METHOD
293ipcDConnectServiceRegisterProc(nsIComponentManager *aCompMgr,
294 nsIFile *aPath,
295 const char *registryLocation,
296 const char *componentType,
297 const nsModuleComponentInfo *info)
298{
299 //
300 // add ipcService to the XPCOM startup category
301 //
302 nsCOMPtr<nsICategoryManager> catman(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
303 if (catman) {
304 nsXPIDLCString prevEntry;
305 catman->AddCategoryEntry(NS_XPCOM_STARTUP_OBSERVER_ID, "ipcDConnectService",
306 IPC_DCONNECTSERVICE_CONTRACTID, PR_TRUE, PR_TRUE,
307 getter_Copies(prevEntry));
308 }
309 return NS_OK;
310}
311
312NS_METHOD
313ipcDConnectServiceUnregisterProc(nsIComponentManager *aCompMgr,
314 nsIFile *aPath,
315 const char *registryLocation,
316 const nsModuleComponentInfo *info)
317{
318 nsCOMPtr<nsICategoryManager> catman(do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
319 if (catman)
320 catman->DeleteCategoryEntry(NS_XPCOM_STARTUP_OBSERVER_ID,
321 IPC_DCONNECTSERVICE_CONTRACTID, PR_TRUE);
322 return NS_OK;
323}
324#endif
325
326nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = NULL;
327nsIProperties *gDirectoryService = NULL;
328PRBool gXPCOMShuttingDown = PR_FALSE;
329
330// For each class that wishes to support nsIClassInfo, add a line like this
331// NS_DECL_CLASSINFO(nsMyClass)
332
333#define COMPONENT(NAME, Ctor) \
334 { NS_##NAME##_CLASSNAME, NS_##NAME##_CID, NS_##NAME##_CONTRACTID, Ctor }
335
336#define COMPONENT_CI(NAME, Ctor, Class) \
337 { NS_##NAME##_CLASSNAME, NS_##NAME##_CID, NS_##NAME##_CONTRACTID, Ctor, \
338 NULL, NULL, NULL, NS_CI_INTERFACE_GETTER_NAME(Class), NULL, \
339 &NS_CLASSINFO_NAME(Class) }
340
341static const nsModuleComponentInfo components[] = {
342 COMPONENT(MEMORY, nsMemoryImpl::Create),
343 COMPONENT(DEBUG, nsDebugImpl::Create),
344#define NS_ERRORSERVICE_CLASSNAME NS_ERRORSERVICE_NAME
345 COMPONENT(ERRORSERVICE, nsErrorService::Create),
346
347 COMPONENT(BYTEBUFFER, ByteBufferImpl::Create),
348 COMPONENT(SCRIPTABLEINPUTSTREAM, nsScriptableInputStream::Create),
349 COMPONENT(BINARYINPUTSTREAM, nsBinaryInputStreamConstructor),
350 COMPONENT(BINARYOUTPUTSTREAM, nsBinaryOutputStreamConstructor),
351 COMPONENT(STORAGESTREAM, nsStorageStreamConstructor),
352
353#define NS_PROPERTIES_CLASSNAME "Properties"
354 COMPONENT(PROPERTIES, nsProperties::Create),
355
356#define NS_PERSISTENTPROPERTIES_CID NS_IPERSISTENTPROPERTIES_CID /* sigh */
357 COMPONENT(PERSISTENTPROPERTIES, nsPersistentProperties::Create),
358
359 COMPONENT(SUPPORTSARRAY, nsSupportsArray::Create),
360 COMPONENT(ARRAY, nsArrayConstructor),
361 COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor),
362 COMPONENT(EXCEPTIONSERVICE, nsExceptionServiceConstructor),
363 COMPONENT(ATOMSERVICE, nsAtomServiceConstructor),
364 COMPONENT(OBSERVERSERVICE, nsObserverService::Create),
365 COMPONENT(GENERICFACTORY, nsGenericFactory::Create),
366 COMPONENT(EVENTQUEUESERVICE, nsEventQueueServiceImplConstructor),
367 COMPONENT(EVENTQUEUE, nsEventQueueImpl::Create),
368 COMPONENT(THREAD, nsThread::Create),
369
370#define NS_XPCOMPROXY_CID NS_PROXYEVENT_MANAGER_CID
371 COMPONENT(XPCOMPROXY, nsProxyObjectManager::Create),
372
373 COMPONENT(TIMER, nsTimerImplConstructor),
374 COMPONENT(TIMERMANAGER, nsTimerManagerConstructor),
375
376#define COMPONENT_SUPPORTS(TYPE, Type) \
377 COMPONENT(SUPPORTS_##TYPE, nsSupports##Type##ImplConstructor)
378
379 COMPONENT_SUPPORTS(ID, ID),
380 COMPONENT_SUPPORTS(STRING, String),
381 COMPONENT_SUPPORTS(CSTRING, CString),
382 COMPONENT_SUPPORTS(PRBOOL, PRBool),
383 COMPONENT_SUPPORTS(PRUINT8, PRUint8),
384 COMPONENT_SUPPORTS(PRUINT16, PRUint16),
385 COMPONENT_SUPPORTS(PRUINT32, PRUint32),
386 COMPONENT_SUPPORTS(PRUINT64, PRUint64),
387 COMPONENT_SUPPORTS(PRTIME, PRTime),
388 COMPONENT_SUPPORTS(CHAR, Char),
389 COMPONENT_SUPPORTS(PRINT16, PRInt16),
390 COMPONENT_SUPPORTS(PRINT32, PRInt32),
391 COMPONENT_SUPPORTS(PRINT64, PRInt64),
392 COMPONENT_SUPPORTS(FLOAT, Float),
393 COMPONENT_SUPPORTS(DOUBLE, Double),
394 COMPONENT_SUPPORTS(VOID, Void),
395 COMPONENT_SUPPORTS(INTERFACE_POINTER, InterfacePointer),
396
397#undef COMPONENT_SUPPORTS
398#define NS_LOCAL_FILE_CLASSNAME "Local File Specification"
399 COMPONENT(LOCAL_FILE, nsLocalFile::nsLocalFileConstructor),
400#define NS_DIRECTORY_SERVICE_CLASSNAME "nsIFile Directory Service"
401 COMPONENT(DIRECTORY_SERVICE, nsDirectoryService::Create),
402 COMPONENT(PROCESS, nsProcessConstructor),
403 COMPONENT(ENVIRONMENT, nsEnvironment::Create),
404
405 COMPONENT(STRINGINPUTSTREAM, nsStringInputStreamConstructor),
406 COMPONENT(MULTIPLEXINPUTSTREAM, nsMultiplexInputStreamConstructor),
407
408 COMPONENT(VARIANT, nsVariantConstructor),
409 COMPONENT(INTERFACEINFOMANAGER_SERVICE, nsXPTIInterfaceInfoManagerGetSingleton),
410
411 COMPONENT(RECYCLINGALLOCATOR, nsRecyclingAllocatorImplConstructor),
412
413#if 0 /// @todo later
414 { IPC_SERVICE_CLASSNAME,
415 IPC_SERVICE_CID,
416 IPC_SERVICE_CONTRACTID,
417 ipcServiceConstructor },
418 /*
419 ipcServiceRegisterProc,
420 ipcServiceUnregisterProc },
421 */
422 //
423 // extensions go here:
424 //
425 { IPC_LOCKSERVICE_CLASSNAME,
426 IPC_LOCKSERVICE_CID,
427 IPC_LOCKSERVICE_CONTRACTID,
428 ipcLockServiceConstructor },
429 { IPC_TRANSACTIONSERVICE_CLASSNAME,
430 IPC_TRANSACTIONSERVICE_CID,
431 IPC_TRANSACTIONSERVICE_CONTRACTID,
432 tmTransactionServiceConstructor },
433
434#ifdef BUILD_DCONNECT
435 { IPC_DCONNECTSERVICE_CLASSNAME,
436 IPC_DCONNECTSERVICE_CID,
437 IPC_DCONNECTSERVICE_CONTRACTID,
438 ipcDConnectServiceConstructor,
439 ipcDConnectServiceRegisterProc,
440 ipcDConnectServiceUnregisterProc },
441#endif
442#endif
443};
444
445#undef COMPONENT
446
447const int components_length = sizeof(components) / sizeof(components[0]);
448
449// gMemory will be freed during shutdown.
450static nsIMemory* gMemory = nsnull;
451nsresult NS_COM NS_GetMemoryManager(nsIMemory* *result)
452{
453 nsresult rv = NS_OK;
454 if (!gMemory)
455 {
456 rv = nsMemoryImpl::Create(nsnull,
457 NS_GET_IID(nsIMemory),
458 (void**)&gMemory);
459 }
460 NS_IF_ADDREF(*result = gMemory);
461 return rv;
462}
463
464// gDebug will be freed during shutdown.
465static nsIDebug* gDebug = nsnull;
466nsresult NS_COM NS_GetDebug(nsIDebug** result)
467{
468 nsresult rv = NS_OK;
469 if (!gDebug)
470 {
471 rv = nsDebugImpl::Create(nsnull,
472 NS_GET_IID(nsIDebug),
473 (void**)&gDebug);
474 }
475 NS_IF_ADDREF(*result = gDebug);
476 return rv;
477}
478
479#ifdef NS_BUILD_REFCNT_LOGGING
480// gTraceRefcnt will be freed during shutdown.
481static nsITraceRefcnt* gTraceRefcnt = nsnull;
482#endif
483
484nsresult NS_COM NS_GetTraceRefcnt(nsITraceRefcnt** result)
485{
486#ifdef NS_BUILD_REFCNT_LOGGING
487 nsresult rv = NS_OK;
488 if (!gTraceRefcnt)
489 {
490 rv = nsTraceRefcntImpl::Create(nsnull,
491 NS_GET_IID(nsITraceRefcnt),
492 (void**)&gTraceRefcnt);
493 }
494 NS_IF_ADDREF(*result = gTraceRefcnt);
495 return rv;
496#else
497 return NS_ERROR_NOT_INITIALIZED;
498#endif
499}
500
501nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result,
502 nsIFile* binDirectory)
503{
504 return NS_InitXPCOM2(result, binDirectory, nsnull);
505}
506
507nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
508 nsIFile* binDirectory,
509 nsIDirectoryServiceProvider* appFileLocationProvider)
510{
511 nsresult rv = NS_OK;
512
513 // We are not shutting down
514 gXPCOMShuttingDown = PR_FALSE;
515
516#ifdef NS_BUILD_REFCNT_LOGGING
517 nsTraceRefcntImpl::Startup();
518#endif
519
520 // Establish the main thread here.
521 rv = nsIThread::SetMainThread();
522 if (NS_FAILED(rv)) return rv;
523
524 // Set up the timer globals/timer thread
525 rv = nsTimerImpl::Startup();
526 NS_ENSURE_SUCCESS(rv, rv);
527
528 // Startup the memory manager
529 rv = nsMemoryImpl::Startup();
530 if (NS_FAILED(rv)) return rv;
531
532 // If the locale hasn't already been setup by our embedder,
533 // get us out of the "C" locale and into the system
534 if (strcmp(setlocale(LC_ALL, NULL), "C") == 0)
535 setlocale(LC_ALL, "");
536
537#if defined(XP_UNIX) || defined(XP_OS2)
538 NS_StartupNativeCharsetUtils();
539#endif
540 NS_StartupLocalFile();
541
542 StartupSpecialSystemDirectory();
543
544 // Start the directory service so that the component manager init can use it.
545 rv = nsDirectoryService::Create(nsnull,
546 NS_GET_IID(nsIProperties),
547 (void**)&gDirectoryService);
548 if (NS_FAILED(rv))
549 return rv;
550
551 nsCOMPtr<nsIDirectoryService> dirService = do_QueryInterface(gDirectoryService, &rv);
552 if (NS_FAILED(rv))
553 return rv;
554 rv = dirService->Init();
555 if (NS_FAILED(rv))
556 return rv;
557
558 // Create the Component/Service Manager
559 nsComponentManagerImpl *compMgr = NULL;
560
561 if (nsComponentManagerImpl::gComponentManager == NULL)
562 {
563 compMgr = new nsComponentManagerImpl();
564 if (compMgr == NULL)
565 return NS_ERROR_OUT_OF_MEMORY;
566 NS_ADDREF(compMgr);
567
568 nsCOMPtr<nsIFile> xpcomLib;
569
570 PRBool value;
571 if (binDirectory)
572 {
573 rv = binDirectory->IsDirectory(&value);
574
575 if (NS_SUCCEEDED(rv) && value) {
576 gDirectoryService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
577 binDirectory->Clone(getter_AddRefs(xpcomLib));
578 }
579 }
580 else {
581 gDirectoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
582 NS_GET_IID(nsIFile),
583 getter_AddRefs(xpcomLib));
584 }
585
586 if (xpcomLib) {
587 xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
588 gDirectoryService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
589 }
590
591 if (appFileLocationProvider) {
592 rv = dirService->RegisterProvider(appFileLocationProvider);
593 if (NS_FAILED(rv)) return rv;
594 }
595
596 rv = compMgr->Init();
597 if (NS_FAILED(rv))
598 {
599 NS_RELEASE(compMgr);
600 return rv;
601 }
602
603 nsComponentManagerImpl::gComponentManager = compMgr;
604
605 if (result) {
606 nsIServiceManager *serviceManager =
607 NS_STATIC_CAST(nsIServiceManager*, compMgr);
608
609 NS_ADDREF(*result = serviceManager);
610 }
611 }
612
613 nsCOMPtr<nsIMemory> memory;
614 NS_GetMemoryManager(getter_AddRefs(memory));
615 // dougt - these calls will be moved into a new interface when nsIComponentManager is frozen.
616 rv = compMgr->RegisterService(kMemoryCID, memory);
617 if (NS_FAILED(rv)) return rv;
618
619 rv = compMgr->RegisterService(kComponentManagerCID, NS_STATIC_CAST(nsIComponentManager*, compMgr));
620 if (NS_FAILED(rv)) return rv;
621
622 // 2. Register the global services with the component manager so that
623 // clients can create new objects.
624
625 // Category Manager
626 {
627 nsCOMPtr<nsIFactory> categoryManagerFactory;
628 if ( NS_FAILED(rv = NS_CategoryManagerGetFactory(getter_AddRefs(categoryManagerFactory))) )
629 return rv;
630
631 NS_DEFINE_CID(kCategoryManagerCID, NS_CATEGORYMANAGER_CID);
632
633 rv = compMgr->RegisterFactory(kCategoryManagerCID,
634 NS_CATEGORYMANAGER_CLASSNAME,
635 NS_CATEGORYMANAGER_CONTRACTID,
636 categoryManagerFactory,
637 PR_TRUE);
638 if ( NS_FAILED(rv) ) return rv;
639 }
640
641 // what I want to do here is QI for a Component Registration Manager. Since this
642 // has not been invented yet, QI to the obsolete manager. Kids, don't do this at home.
643 nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(
644 NS_STATIC_CAST(nsIComponentManager*,compMgr), &rv);
645 if (registrar) {
646 for (int i = 0; i < components_length; i++)
647 RegisterGenericFactory(registrar, &components[i]);
648 }
649 rv = nsComponentManagerImpl::gComponentManager->ReadPersistentRegistry();
650#ifdef DEBUG
651 if (NS_FAILED(rv)) {
652 printf("No Persistent Registry Found.\n");
653 }
654#endif
655
656#if 0 /// @todo later
657 rv = IPC_Init();
658 if (NS_FAILED(rv))
659 return rv;
660#endif
661
662 if ( NS_FAILED(rv) || CheckUpdateFile()) {
663 // if we find no persistent registry, we will try to autoregister
664 // the default components directory.
665 nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull);
666
667 // If the application is using a GRE, then,
668 // auto register components in the GRE directory as well.
669 //
670 // The application indicates that it's using an GRE by
671 // returning a valid nsIFile when queried (via appFileLocProvider)
672 // for the NS_GRE_DIR atom as shown below
673 //
674
675 if ( appFileLocationProvider ) {
676 nsCOMPtr<nsIFile> greDir;
677 PRBool persistent = PR_TRUE;
678
679 appFileLocationProvider->GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(greDir));
680
681 if (greDir) {
682#ifdef DEBUG_dougt
683 printf("start - Registering GRE components\n");
684#endif
685 rv = gDirectoryService->Get(NS_GRE_COMPONENT_DIR,
686 NS_GET_IID(nsIFile),
687 getter_AddRefs(greDir));
688 if (NS_FAILED(rv)) {
689 NS_ERROR("Could not get GRE components directory!");
690 return rv;
691 }
692
693 // If the GRE contains any loaders, we want to know about it so that we can cause another
694 // autoregistration of the applications component directory.
695 int loaderCount = nsComponentManagerImpl::gComponentManager->GetLoaderCount();
696 rv = nsComponentManagerImpl::gComponentManager->AutoRegister(greDir);
697
698 if (loaderCount != nsComponentManagerImpl::gComponentManager->GetLoaderCount())
699 nsComponentManagerImpl::gComponentManager->AutoRegisterNonNativeComponents(nsnull);
700
701#ifdef DEBUG_dougt
702 printf("end - Registering GRE components\n");
703#endif
704 if (NS_FAILED(rv)) {
705 NS_ERROR("Could not AutoRegister GRE components");
706 return rv;
707 }
708 }
709 }
710
711 //
712 // If additional component directories have been specified, then
713 // register them as well.
714 //
715
716 nsCOMPtr<nsISimpleEnumerator> dirList;
717 gDirectoryService->Get(NS_XPCOM_COMPONENT_DIR_LIST,
718 NS_GET_IID(nsISimpleEnumerator),
719 getter_AddRefs(dirList));
720 if (dirList) {
721 PRBool hasMore;
722 while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore) {
723 nsCOMPtr<nsISupports> elem;
724 dirList->GetNext(getter_AddRefs(elem));
725 if (elem) {
726 nsCOMPtr<nsIFile> dir = do_QueryInterface(elem);
727 if (dir)
728 nsComponentManagerImpl::gComponentManager->AutoRegister(dir);
729
730 // XXX should we worry about new component loaders being
731 // XXX defined by this process?
732 }
733 }
734 }
735
736
737 // Make sure the compreg file's mod time is current.
738 nsCOMPtr<nsIFile> compregFile;
739 rv = gDirectoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE,
740 NS_GET_IID(nsIFile),
741 getter_AddRefs(compregFile));
742 compregFile->SetLastModifiedTime(PR_Now() / 1000);
743 }
744
745 // Pay the cost at startup time of starting this singleton.
746 nsIInterfaceInfoManager* iim = XPTI_GetInterfaceInfoManager();
747 NS_IF_RELEASE(iim);
748#ifdef VBOX
749 // Must initialize the EventQueueService singleton before anyone is
750 // using it. The notification below creates a thread which races creating
751 // the EventQueueService creation otherwise, no matter what.
752 nsCOMPtr<nsIEventQueue> eventQ;
753 rv = NS_GetMainEventQ(getter_AddRefs(eventQ));
754 if (NS_FAILED(rv)) {
755 NS_ERROR("Could not create event queue for main thread");
756 /* this is just a build-time hack, to reference NS_ProxyRelease */
757 if (rv == 666)
758 NS_ProxyRelease(nsnull, nsnull);
759 return rv;
760 }
761#endif /* VBOX */
762
763 // Notify observers of xpcom autoregistration start
764 NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_OBSERVER_ID,
765 nsnull,
766 NS_XPCOM_STARTUP_OBSERVER_ID);
767
768 return NS_OK;
769}
770
771
772static nsVoidArray* gExitRoutines;
773
774static void CallExitRoutines()
775{
776 if (!gExitRoutines)
777 return;
778
779 PRInt32 count = gExitRoutines->Count();
780 for (PRInt32 i = 0; i < count; i++) {
781 XPCOMExitRoutine func = (XPCOMExitRoutine) gExitRoutines->ElementAt(i);
782 func();
783 }
784 gExitRoutines->Clear();
785 delete gExitRoutines;
786 gExitRoutines = nsnull;
787}
788
789nsresult NS_COM
790NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
791{
792 // priority are not used right now. It will need to be implemented as more
793 // classes are moved into the glue library --dougt
794 if (!gExitRoutines) {
795 gExitRoutines = new nsVoidArray();
796 if (!gExitRoutines) {
797 NS_WARNING("Failed to allocate gExitRoutines");
798 return NS_ERROR_FAILURE;
799 }
800 }
801
802 PRBool okay = gExitRoutines->AppendElement((void*)exitRoutine);
803 return okay ? NS_OK : NS_ERROR_FAILURE;
804}
805
806nsresult NS_COM
807NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
808{
809 if (!gExitRoutines)
810 return NS_ERROR_FAILURE;
811
812 PRBool okay = gExitRoutines->RemoveElement((void*)exitRoutine);
813 return okay ? NS_OK : NS_ERROR_FAILURE;
814}
815
816
817//
818// NS_ShutdownXPCOM()
819//
820// The shutdown sequence for xpcom would be
821//
822// - Release the Global Service Manager
823// - Release all service instances held by the global service manager
824// - Release the Global Service Manager itself
825// - Release the Component Manager
826// - Release all factories cached by the Component Manager
827// - Unload Libraries
828// - Release Contractid Cache held by Component Manager
829// - Release dll abstraction held by Component Manager
830// - Release the Registry held by Component Manager
831// - Finally, release the component manager itself
832//
833nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr)
834{
835
836 // Notify observers of xpcom shutting down
837 nsresult rv = NS_OK;
838 {
839 // Block it so that the COMPtr will get deleted before we hit
840 // servicemanager shutdown
841 nsCOMPtr<nsIObserverService> observerService =
842 do_GetService("@mozilla.org/observer-service;1", &rv);
843 if (NS_SUCCEEDED(rv))
844 {
845 nsCOMPtr<nsIServiceManager> mgr;
846 rv = NS_GetServiceManager(getter_AddRefs(mgr));
847 if (NS_SUCCEEDED(rv))
848 {
849 (void) observerService->NotifyObservers(mgr,
850 NS_XPCOM_SHUTDOWN_OBSERVER_ID,
851 nsnull);
852 }
853 }
854 }
855
856 // grab the event queue so that we can process events one last time before exiting
857 nsCOMPtr <nsIEventQueue> currentQ;
858 {
859 nsCOMPtr<nsIEventQueueService> eventQService =
860 do_GetService(kEventQueueServiceCID, &rv);
861
862 if (eventQService) {
863 eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(currentQ));
864 }
865 }
866 // XPCOM is officially in shutdown mode NOW
867 // Set this only after the observers have been notified as this
868 // will cause servicemanager to become inaccessible.
869 gXPCOMShuttingDown = PR_TRUE;
870
871#ifdef DEBUG_dougt
872 fprintf(stderr, "* * * * XPCOM shutdown. Access will be denied * * * * \n");
873#endif
874
875#if 0 /// @todo later
876 IPC_Shutdown();
877#endif
878
879 // We may have AddRef'd for the caller of NS_InitXPCOM, so release it
880 // here again:
881 NS_IF_RELEASE(servMgr);
882
883 // Shutdown global servicemanager
884 if (nsComponentManagerImpl::gComponentManager) {
885 nsComponentManagerImpl::gComponentManager->FreeServices();
886 }
887 nsServiceManager::ShutdownGlobalServiceManager(nsnull);
888
889 if (currentQ) {
890 currentQ->ProcessPendingEvents();
891 currentQ = 0;
892 }
893
894 nsProxyObjectManager::Shutdown();
895
896 // Release the directory service
897 NS_IF_RELEASE(gDirectoryService);
898
899 // Shutdown nsLocalFile string conversion
900 NS_ShutdownLocalFile();
901#ifdef XP_UNIX
902 NS_ShutdownNativeCharsetUtils();
903#endif
904
905 // Shutdown the timer thread and all timers that might still be alive before
906 // shutting down the component manager
907 nsTimerImpl::Shutdown();
908
909 CallExitRoutines();
910
911 // Shutdown xpcom. This will release all loaders and cause others holding
912 // a refcount to the component manager to release it.
913 if (nsComponentManagerImpl::gComponentManager) {
914 rv = (nsComponentManagerImpl::gComponentManager)->Shutdown();
915 NS_ASSERTION(NS_SUCCEEDED(rv), "Component Manager shutdown failed.");
916 } else
917 NS_WARNING("Component Manager was never created ...");
918
919 // Release our own singletons
920 // Do this _after_ shutting down the component manager, because the
921 // JS component loader will use XPConnect to call nsIModule::canUnload,
922 // and that will spin up the InterfaceInfoManager again -- bad mojo
923 XPTI_FreeInterfaceInfoManager();
924
925 // Finally, release the component manager last because it unloads the
926 // libraries:
927 if (nsComponentManagerImpl::gComponentManager) {
928 nsrefcnt cnt;
929 NS_RELEASE2(nsComponentManagerImpl::gComponentManager, cnt);
930 NS_WARN_IF_FALSE(cnt == 0, "Component Manager being held past XPCOM shutdown.");
931 }
932 nsComponentManagerImpl::gComponentManager = nsnull;
933
934#ifdef DEBUG
935 _FreeAutoLockStatics();
936#endif
937
938 ShutdownSpecialSystemDirectory();
939
940 EmptyEnumeratorImpl::Shutdown();
941 nsMemoryImpl::Shutdown();
942 NS_IF_RELEASE(gMemory);
943
944 nsThread::Shutdown();
945 NS_PurgeAtomTable();
946
947 NS_IF_RELEASE(gDebug);
948
949#ifdef NS_BUILD_REFCNT_LOGGING
950 nsTraceRefcntImpl::DumpStatistics();
951 nsTraceRefcntImpl::ResetStatistics();
952 nsTraceRefcntImpl::Shutdown();
953#endif
954
955 return NS_OK;
956}
957
958#define GET_FUNC(_tag, _decl, _name) \
959 functions->_tag = (_decl) PR_FindSymbol(xpcomLib, _name); \
960 if (!functions->_tag) goto end
961
962nsresult NS_COM PR_CALLBACK
963NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* libraryPath)
964{
965 if (!functions)
966 return NS_ERROR_OUT_OF_MEMORY;
967
968 if (functions->version != XPCOM_GLUE_VERSION)
969 return NS_ERROR_FAILURE;
970
971 PRLibrary *xpcomLib = PR_LoadLibrary(libraryPath);
972 if (!xpcomLib)
973 return NS_ERROR_FAILURE;
974
975 nsresult rv = NS_ERROR_FAILURE;
976
977#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
978 GET_FUNC(init, InitFunc, "VBoxNsxpNS_InitXPCOM2");
979 GET_FUNC(shutdown, ShutdownFunc, "VBoxNsxpNS_ShutdownXPCOM");
980 GET_FUNC(getServiceManager, GetServiceManagerFunc, "VBoxNsxpNS_GetServiceManager");
981 GET_FUNC(getComponentManager, GetComponentManagerFunc, "VBoxNsxpNS_GetComponentManager");
982 GET_FUNC(getComponentRegistrar, GetComponentRegistrarFunc, "VBoxNsxpNS_GetComponentRegistrar");
983 GET_FUNC(getMemoryManager, GetMemoryManagerFunc, "VBoxNsxpNS_GetMemoryManager");
984 GET_FUNC(newLocalFile, NewLocalFileFunc, "VBoxNsxpNS_NewLocalFile");
985 GET_FUNC(newNativeLocalFile, NewNativeLocalFileFunc, "VBoxNsxpNS_NewNativeLocalFile");
986 GET_FUNC(registerExitRoutine, RegisterXPCOMExitRoutineFunc, "VBoxNsxpNS_RegisterXPCOMExitRoutine");
987 GET_FUNC(unregisterExitRoutine, UnregisterXPCOMExitRoutineFunc, "VBoxNsxpNS_UnregisterXPCOMExitRoutine");
988#else /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
989 GET_FUNC(init, InitFunc, "NS_InitXPCOM2");
990 GET_FUNC(shutdown, ShutdownFunc, "NS_ShutdownXPCOM");
991 GET_FUNC(getServiceManager, GetServiceManagerFunc, "NS_GetServiceManager");
992 GET_FUNC(getComponentManager, GetComponentManagerFunc, "NS_GetComponentManager");
993 GET_FUNC(getComponentRegistrar, GetComponentRegistrarFunc, "NS_GetComponentRegistrar");
994 GET_FUNC(getMemoryManager, GetMemoryManagerFunc, "NS_GetMemoryManager");
995 GET_FUNC(newLocalFile, NewLocalFileFunc, "NS_NewLocalFile");
996 GET_FUNC(newNativeLocalFile, NewNativeLocalFileFunc, "NS_NewNativeLocalFile");
997 GET_FUNC(registerExitRoutine, RegisterXPCOMExitRoutineFunc, "NS_RegisterXPCOMExitRoutine");
998 GET_FUNC(unregisterExitRoutine, UnregisterXPCOMExitRoutineFunc, "NS_UnregisterXPCOMExitRoutine");
999#endif /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1000
1001 // these functions were added post 1.4 (need to check size of |functions|)
1002 if (functions->size > offsetof(XPCOMFunctions, getTraceRefcnt)) {
1003#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
1004 GET_FUNC(getDebug, GetDebugFunc, "VBoxNsxpNS_GetDebug");
1005 GET_FUNC(getTraceRefcnt, GetTraceRefcntFunc, "VBoxNsxpNS_GetTraceRefcnt");
1006#else /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1007 GET_FUNC(getDebug, GetDebugFunc, "NS_GetDebug");
1008 GET_FUNC(getTraceRefcnt, GetTraceRefcntFunc, "NS_GetTraceRefcnt");
1009#endif /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1010 }
1011
1012 // these functions were added post 1.6 (need to check size of |functions|)
1013 if (functions->size > offsetof(XPCOMFunctions, cstringCloneData)) {
1014#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
1015 GET_FUNC(stringContainerInit, StringContainerInitFunc, "VBoxNsxpNS_StringContainerInit");
1016 GET_FUNC(stringContainerFinish, StringContainerFinishFunc, "VBoxNsxpNS_StringContainerFinish");
1017 GET_FUNC(stringGetData, StringGetDataFunc, "VBoxNsxpNS_StringGetData");
1018 GET_FUNC(stringSetData, StringSetDataFunc, "VBoxNsxpNS_StringSetData");
1019 GET_FUNC(stringSetDataRange, StringSetDataRangeFunc, "VBoxNsxpNS_StringSetDataRange");
1020 GET_FUNC(stringCopy, StringCopyFunc, "VBoxNsxpNS_StringCopy");
1021 GET_FUNC(cstringContainerInit, CStringContainerInitFunc, "VBoxNsxpNS_CStringContainerInit");
1022 GET_FUNC(cstringContainerFinish, CStringContainerFinishFunc, "VBoxNsxpNS_CStringContainerFinish");
1023 GET_FUNC(cstringGetData, CStringGetDataFunc, "VBoxNsxpNS_CStringGetData");
1024 GET_FUNC(cstringSetData, CStringSetDataFunc, "VBoxNsxpNS_CStringSetData");
1025 GET_FUNC(cstringSetDataRange, CStringSetDataRangeFunc, "VBoxNsxpNS_CStringSetDataRange");
1026 GET_FUNC(cstringCopy, CStringCopyFunc, "VBoxNsxpNS_CStringCopy");
1027 GET_FUNC(cstringToUTF16, CStringToUTF16, "VBoxNsxpNS_CStringToUTF16");
1028 GET_FUNC(utf16ToCString, UTF16ToCString, "VBoxNsxpNS_UTF16ToCString");
1029 GET_FUNC(stringCloneData, StringCloneDataFunc, "VBoxNsxpNS_StringCloneData");
1030 GET_FUNC(cstringCloneData, CStringCloneDataFunc, "VBoxNsxpNS_CStringCloneData");
1031#else /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1032 GET_FUNC(stringContainerInit, StringContainerInitFunc, "NS_StringContainerInit");
1033 GET_FUNC(stringContainerFinish, StringContainerFinishFunc, "NS_StringContainerFinish");
1034 GET_FUNC(stringGetData, StringGetDataFunc, "NS_StringGetData");
1035 GET_FUNC(stringSetData, StringSetDataFunc, "NS_StringSetData");
1036 GET_FUNC(stringSetDataRange, StringSetDataRangeFunc, "NS_StringSetDataRange");
1037 GET_FUNC(stringCopy, StringCopyFunc, "NS_StringCopy");
1038 GET_FUNC(cstringContainerInit, CStringContainerInitFunc, "NS_CStringContainerInit");
1039 GET_FUNC(cstringContainerFinish, CStringContainerFinishFunc, "NS_CStringContainerFinish");
1040 GET_FUNC(cstringGetData, CStringGetDataFunc, "NS_CStringGetData");
1041 GET_FUNC(cstringSetData, CStringSetDataFunc, "NS_CStringSetData");
1042 GET_FUNC(cstringSetDataRange, CStringSetDataRangeFunc, "NS_CStringSetDataRange");
1043 GET_FUNC(cstringCopy, CStringCopyFunc, "NS_CStringCopy");
1044 GET_FUNC(cstringToUTF16, CStringToUTF16, "NS_CStringToUTF16");
1045 GET_FUNC(utf16ToCString, UTF16ToCString, "NS_UTF16ToCString");
1046 GET_FUNC(stringCloneData, StringCloneDataFunc, "NS_StringCloneData");
1047 GET_FUNC(cstringCloneData, CStringCloneDataFunc, "NS_CStringCloneData");
1048#endif /* !VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
1049 }
1050
1051 rv = NS_OK;
1052end:
1053 PR_UnloadLibrary(xpcomLib); // the library is refcnt'ed above by the caller.
1054 return rv;
1055}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette