1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : *
3 : * ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is Mozilla Communicator client code, released
17 : * March 31, 1998.
18 : *
19 : * The Initial Developer of the Original Code is
20 : * Netscape Communications Corporation.
21 : * Portions created by the Initial Developer are Copyright (C) 1998
22 : * the Initial Developer. All Rights Reserved.
23 : *
24 : * Contributor(s):
25 : * John Bandhauer <jband@netscape.com> (original author)
26 : *
27 : * Alternatively, the contents of this file may be used under the terms of
28 : * either of the GNU General Public License Version 2 or later (the "GPL"),
29 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 : * in which case the provisions of the GPL or the LGPL are applicable instead
31 : * of those above. If you wish to allow use of your version of this file only
32 : * under the terms of either the GPL or the LGPL, and not to allow others to
33 : * use your version of this file under the terms of the MPL, indicate your
34 : * decision by deleting the provisions above and replace them with the notice
35 : * and other provisions required by the GPL or the LGPL. If you do not delete
36 : * the provisions above, a recipient may use your version of this file under
37 : * the terms of any one of the MPL, the GPL or the LGPL.
38 : *
39 : * ***** END LICENSE BLOCK ***** */
40 :
41 : #include "xpcprivate.h"
42 : #include "mozilla/ModuleUtils.h"
43 : #include "mozJSComponentLoader.h"
44 : #include "mozJSSubScriptLoader.h"
45 :
46 : /* Module implementation for the xpconnect library. */
47 :
48 : #define XPCVARIANT_CONTRACTID "@mozilla.org/xpcvariant;1"
49 : #define XPC_JSCONTEXT_STACK_ITERATOR_CONTRACTID \
50 : "@mozilla.org/js/xpc/ContextStackIterator;1"
51 :
52 : // {FE4F7592-C1FC-4662-AC83-538841318803}
53 : #define SCRIPTABLE_INTERFACES_CID \
54 : {0xfe4f7592, 0xc1fc, 0x4662, \
55 : { 0xac, 0x83, 0x53, 0x88, 0x41, 0x31, 0x88, 0x3 } }
56 :
57 : #define MOZJSSUBSCRIPTLOADER_CONTRACTID "@mozilla.org/moz/jssubscript-loader;1"
58 :
59 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSID)
60 2026 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCException)
61 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCJSContextStackIterator)
62 1403 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIXPConnect,
63 1403 : nsXPConnect::GetSingleton)
64 6120 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptError)
65 :
66 1930 : NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSComponentLoader)
67 1510 : NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSSubScriptLoader)
68 :
69 : NS_DEFINE_NAMED_CID(NS_JS_ID_CID);
70 : NS_DEFINE_NAMED_CID(NS_XPCONNECT_CID);
71 : NS_DEFINE_NAMED_CID(NS_XPCEXCEPTION_CID);
72 : NS_DEFINE_NAMED_CID(NS_SCRIPTERROR_CID);
73 : NS_DEFINE_NAMED_CID(NS_XPC_JSCONTEXT_STACK_ITERATOR_CID);
74 : NS_DEFINE_NAMED_CID(MOZJSCOMPONENTLOADER_CID);
75 : NS_DEFINE_NAMED_CID(MOZ_JSSUBSCRIPTLOADER_CID);
76 :
77 : #define XPCONNECT_CIDENTRIES \
78 : { &kNS_JS_ID_CID, false, NULL, nsJSIDConstructor }, \
79 : { &kNS_XPCONNECT_CID, false, NULL, nsIXPConnectConstructor }, \
80 : { &kNS_XPCEXCEPTION_CID, false, NULL, nsXPCExceptionConstructor }, \
81 : { &kNS_SCRIPTERROR_CID, false, NULL, nsScriptErrorConstructor }, \
82 : { &kNS_XPC_JSCONTEXT_STACK_ITERATOR_CID, false, NULL, nsXPCJSContextStackIteratorConstructor }, \
83 : { &kMOZJSCOMPONENTLOADER_CID, false, NULL, mozJSComponentLoaderConstructor },\
84 : { &kMOZ_JSSUBSCRIPTLOADER_CID, false, NULL, mozJSSubScriptLoaderConstructor },
85 :
86 : #define XPCONNECT_CONTRACTS \
87 : { XPC_ID_CONTRACTID, &kNS_JS_ID_CID }, \
88 : { XPC_XPCONNECT_CONTRACTID, &kNS_XPCONNECT_CID }, \
89 : { XPC_CONTEXT_STACK_CONTRACTID, &kNS_XPCONNECT_CID }, \
90 : { XPC_RUNTIME_CONTRACTID, &kNS_XPCONNECT_CID }, \
91 : { XPC_EXCEPTION_CONTRACTID, &kNS_XPCEXCEPTION_CID }, \
92 : { NS_SCRIPTERROR_CONTRACTID, &kNS_SCRIPTERROR_CID }, \
93 : { XPC_JSCONTEXT_STACK_ITERATOR_CONTRACTID, &kNS_XPC_JSCONTEXT_STACK_ITERATOR_CID }, \
94 : { MOZJSCOMPONENTLOADER_CONTRACTID, &kMOZJSCOMPONENTLOADER_CID }, \
95 : { MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID },
96 :
97 : #define XPCONNECT_CATEGORIES \
98 : { "module-loader", "js", MOZJSCOMPONENTLOADER_CONTRACTID },
99 :
100 : nsresult xpcModuleCtor();
101 : void xpcModuleDtor();
|