author | arno renevier <arno@renevier.net> |
Tue, 16 Aug 2011 13:57:23 -0700 | |
changeset 75429 | b23c1a9de86cfe00da3843e9d7bed15778d33b06 |
parent 75428 | 63f07bd1d64f39f801cb3f38196a788a1ddbc1fb |
child 75430 | b75337bbcf6bef9d887357e862a6c3fead406c0c |
push id | 21023 |
push user | mak77@bonardo.net |
push date | Thu, 18 Aug 2011 09:39:20 +0000 |
treeherder | mozilla-central@f69a10f23bf3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mrbkap |
bugs | 677880 |
milestone | 9.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/xpconnect/idl/Makefile.in +++ b/js/src/xpconnect/idl/Makefile.in @@ -57,16 +57,15 @@ XPIDLSRCS = \ xpcIJSModuleLoader.idl \ nsIJSContextStack.idl \ nsIJSRuntimeService.idl \ nsIXPConnect.idl \ nsIXPCSecurityManager.idl \ nsIXPCScriptable.idl \ nsIScriptError.idl \ nsIXPCScriptNotify.idl \ - nsIScriptableInterfaces.idl \ xpcIJSWeakReference.idl \ xpcIJSGetFactory.idl \ nsIJSEngineTelemetryStats.idl \ $(NULL) include $(topsrcdir)/config/rules.mk
deleted file mode 100644 --- a/js/src/xpconnect/idl/nsIScriptableInterfaces.idl +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * John Bandhauer <jband@netscape.com> (original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsISupports.idl" -#include "nsIInterfaceInfoManager.idl" - -/** -* Interface used as Components.interfaces (and elsewhere) -* (interesting stuff only reflected into JavaScript) -*/ -[scriptable, uuid(01c78c65-31da-456b-90bf-da39d09fdcbf)] -interface nsIScriptableInterfaces : nsISupports -{ - [noscript] attribute nsIInterfaceInfoManager manager; -}; - -%{C++ -// The contractID for the implementation built into xpconnect -#define NS_SCRIPTABLE_INTERFACES_CONTRACTID "@mozilla.org/scriptableinterfaces;1" -%} - - -/** -* interface of Components.interfacesByID -* (interesting stuff only reflected into JavaScript) -*/ -[scriptable, uuid(c99cffac-5aed-4267-ad2f-f4a4c9d4a081)] -interface nsIScriptableInterfacesByID : nsISupports -{ -};
--- a/js/src/xpconnect/idl/xpccomponents.idl +++ b/js/src/xpconnect/idl/xpccomponents.idl @@ -37,25 +37,42 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsISupports.idl" #include "xpcexception.idl" #include "xpcjsid.idl" #include "nsIComponentManager.idl" -#include "nsIScriptableInterfaces.idl" %{C++ #include "jspubtd.h" %} interface xpcIJSWeakReference; /** +* interface of Components.interfacesByID +* (interesting stuff only reflected into JavaScript) +*/ +[scriptable, uuid(c99cffac-5aed-4267-ad2f-f4a4c9d4a081)] +interface nsIXPCComponents_InterfacesByID : nsISupports +{ +}; + +/** +* interface of Components.interfaces +* (interesting stuff only reflected into JavaScript) +*/ +[scriptable, uuid(b8c31bba-79db-4a1d-930d-4cdd68713f9e)] +interface nsIXPCComponents_Interfaces : nsISupports +{ +}; + +/** * interface of Components.classes * (interesting stuff only reflected into JavaScript) */ [scriptable, uuid(978ff520-d26c-11d2-9842-006008962422)] interface nsIXPCComponents_Classes : nsISupports { }; @@ -277,28 +294,28 @@ interface nsIXPCComponents_Utils : nsISu }; /** * interface of JavaScript's 'Components' object */ [scriptable, uuid(155809f1-71f1-47c5-be97-d812ba560405)] interface nsIXPCComponents : nsISupports { - readonly attribute nsIScriptableInterfaces interfaces; - readonly attribute nsIScriptableInterfacesByID interfacesByID; - readonly attribute nsIXPCComponents_Classes classes; - readonly attribute nsIXPCComponents_ClassesByID classesByID; - readonly attribute nsIStackFrame stack; - readonly attribute nsIXPCComponents_Results results; - readonly attribute nsIComponentManager manager; - readonly attribute nsIXPCComponents_Utils utils; + readonly attribute nsIXPCComponents_Interfaces interfaces; + readonly attribute nsIXPCComponents_InterfacesByID interfacesByID; + readonly attribute nsIXPCComponents_Classes classes; + readonly attribute nsIXPCComponents_ClassesByID classesByID; + readonly attribute nsIStackFrame stack; + readonly attribute nsIXPCComponents_Results results; + readonly attribute nsIComponentManager manager; + readonly attribute nsIXPCComponents_Utils utils; - readonly attribute nsIXPCComponents_ID ID; - readonly attribute nsIXPCComponents_Exception Exception; - readonly attribute nsIXPCComponents_Constructor Constructor; + readonly attribute nsIXPCComponents_ID ID; + readonly attribute nsIXPCComponents_Exception Exception; + readonly attribute nsIXPCComponents_Constructor Constructor; boolean isSuccessCode(in nsresult result); /* @deprecated Use Components.utils.lookupMethod instead. * (But are you sure you really want this method any more? * See http://developer-test.mozilla.org/en/docs/XPCNativeWrapper ) */ [deprecated] void lookupMethod();
--- a/js/src/xpconnect/src/xpccomponents.cpp +++ b/js/src/xpconnect/src/xpccomponents.cpp @@ -100,16 +100,42 @@ char * xpc_CheckAccessList(const PRUnich for(const char** p = list; *p; p++) if(!strcmp(*p, asciiName.get())) return xpc_CloneAllAccess(); return nsnull; } /***************************************************************************/ +/***************************************************************************/ +/***************************************************************************/ + + + +class nsXPCComponents_Interfaces : + public nsIXPCComponents_Interfaces, + public nsIXPCScriptable, + public nsIClassInfo, + public nsISecurityCheckedComponent +{ +public: + // all the interface method declarations... + NS_DECL_ISUPPORTS + NS_DECL_NSIXPCCOMPONENTS_INTERFACES + NS_DECL_NSIXPCSCRIPTABLE + NS_DECL_NSICLASSINFO + NS_DECL_NSISECURITYCHECKEDCOMPONENT + +public: + nsXPCComponents_Interfaces(); + virtual ~nsXPCComponents_Interfaces(); + +private: + nsCOMPtr<nsIInterfaceInfoManager> mManager; +}; /* void getInterfaces (out PRUint32 count, [array, size_is (count), retval] out nsIIDPtr array); */ NS_IMETHODIMP nsXPCComponents_Interfaces::GetInterfaces(PRUint32 *aCount, nsIID * **aArray) { const PRUint32 count = 3; *aCount = count; @@ -122,17 +148,17 @@ nsXPCComponents_Interfaces::GetInterface nsIID* clone; #define PUSH_IID(id) \ clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \ sizeof(nsIID))); \ if (!clone) \ goto oom; \ array[index++] = clone; - PUSH_IID(nsIScriptableInterfaces) + PUSH_IID(nsIXPCComponents_Interfaces) PUSH_IID(nsIXPCScriptable) PUSH_IID(nsISecurityCheckedComponent) #undef PUSH_IID return NS_OK; oom: while (index) nsMemory::Free(array[--index]); @@ -205,35 +231,22 @@ nsXPCComponents_Interfaces::nsXPCCompone } nsXPCComponents_Interfaces::~nsXPCComponents_Interfaces() { // empty } -/* [noscript] attribute nsIInterfaceInfoManager manager; */ -NS_IMETHODIMP nsXPCComponents_Interfaces::GetManager(nsIInterfaceInfoManager * *aManager) -{ - *aManager = mManager; - NS_IF_ADDREF(*aManager); - return NS_OK; -} -NS_IMETHODIMP nsXPCComponents_Interfaces::SetManager(nsIInterfaceInfoManager * aManager) -{ - mManager = aManager; - return NS_OK; -} - NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Interfaces) - NS_INTERFACE_MAP_ENTRY(nsIScriptableInterfaces) + NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_Interfaces) NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable) NS_INTERFACE_MAP_ENTRY(nsIClassInfo) NS_INTERFACE_MAP_ENTRY(nsISecurityCheckedComponent) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptableInterfaces) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Interfaces) NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_Interfaces) NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_Interfaces) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_Interfaces #define XPC_MAP_QUOTED_CLASSNAME "nsXPCComponents_Interfaces" @@ -407,25 +420,25 @@ nsXPCComponents_Interfaces::CanSetProper return NS_OK; } /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ class nsXPCComponents_InterfacesByID : - public nsIScriptableInterfacesByID, + public nsIXPCComponents_InterfacesByID, public nsIXPCScriptable, public nsIClassInfo, public nsISecurityCheckedComponent { public: // all the interface method declarations... NS_DECL_ISUPPORTS - NS_DECL_NSISCRIPTABLEINTERFACESBYID + NS_DECL_NSIXPCCOMPONENTS_INTERFACESBYID NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO NS_DECL_NSISECURITYCHECKEDCOMPONENT public: nsXPCComponents_InterfacesByID(); virtual ~nsXPCComponents_InterfacesByID(); @@ -450,17 +463,17 @@ nsXPCComponents_InterfacesByID::GetInter nsIID* clone; #define PUSH_IID(id) \ clone = static_cast<nsIID *>(nsMemory::Clone(&NS_GET_IID( id ), \ sizeof(nsIID))); \ if (!clone) \ goto oom; \ array[index++] = clone; - PUSH_IID(nsIScriptableInterfacesByID) + PUSH_IID(nsIXPCComponents_InterfacesByID) PUSH_IID(nsIXPCScriptable) PUSH_IID(nsISecurityCheckedComponent) #undef PUSH_IID return NS_OK; oom: while (index) nsMemory::Free(array[--index]); @@ -533,21 +546,21 @@ nsXPCComponents_InterfacesByID::nsXPCCom } nsXPCComponents_InterfacesByID::~nsXPCComponents_InterfacesByID() { // empty } NS_INTERFACE_MAP_BEGIN(nsXPCComponents_InterfacesByID) - NS_INTERFACE_MAP_ENTRY(nsIScriptableInterfacesByID) + NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_InterfacesByID) NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable) NS_INTERFACE_MAP_ENTRY(nsIClassInfo) NS_INTERFACE_MAP_ENTRY(nsISecurityCheckedComponent) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptableInterfacesByID) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_InterfacesByID) NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_InterfacesByID) NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_InterfacesByID) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_InterfacesByID #define XPC_MAP_QUOTED_CLASSNAME "nsXPCComponents_InterfacesByID" @@ -2484,27 +2497,27 @@ nsXPCComponents_Constructor::CallOrConst return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); } if(argc >= 2) { // argv[1] is an iid name string // XXXjband support passing "Components.interfaces.foo"? - nsCOMPtr<nsIScriptableInterfaces> ifaces; + nsCOMPtr<nsIXPCComponents_Interfaces> ifaces; nsCOMPtr<nsIXPConnectJSObjectHolder> holder; JSObject* ifacesObj = nsnull; // we do the lookup by asking the Components.interfaces object // for the property with this name - i.e. we let its caching of these // nsIJSIID objects work for us. if(NS_FAILED(comp->GetInterfaces(getter_AddRefs(ifaces))) || NS_FAILED(xpc->WrapNative(cx, obj, ifaces, - NS_GET_IID(nsIScriptableInterfaces), + NS_GET_IID(nsIXPCComponents_Interfaces), getter_AddRefs(holder))) || !holder || NS_FAILED(holder->GetJSObject(&ifacesObj)) || !ifacesObj) { return ThrowAndFail(NS_ERROR_XPC_UNEXPECTED, cx, _retval); } JSString* str = JS_ValueToString(cx, argv[1]); jsid id; @@ -4149,40 +4162,40 @@ nsXPCComponents::ClearMembers() NS_IF_RELEASE(mResults); NS_IF_RELEASE(mID); NS_IF_RELEASE(mException); NS_IF_RELEASE(mConstructor); NS_IF_RELEASE(mUtils); } /*******************************************/ -#define XPC_IMPL_GET_OBJ_METHOD(_b, _n) \ -NS_IMETHODIMP nsXPCComponents::Get##_n(_b##_n * *a##_n) { \ +#define XPC_IMPL_GET_OBJ_METHOD(_n) \ +NS_IMETHODIMP nsXPCComponents::Get##_n(nsIXPCComponents_##_n * *a##_n) { \ NS_ENSURE_ARG_POINTER(a##_n); \ if(!m##_n) { \ if(!(m##_n = new nsXPCComponents_##_n())) { \ *a##_n = nsnull; \ return NS_ERROR_OUT_OF_MEMORY; \ } \ NS_ADDREF(m##_n); \ } \ NS_ADDREF(m##_n); \ *a##_n = m##_n; \ return NS_OK; \ } -XPC_IMPL_GET_OBJ_METHOD(nsIScriptable, Interfaces) -XPC_IMPL_GET_OBJ_METHOD(nsIScriptable, InterfacesByID) -XPC_IMPL_GET_OBJ_METHOD(nsIXPCComponents_, Classes) -XPC_IMPL_GET_OBJ_METHOD(nsIXPCComponents_, ClassesByID) -XPC_IMPL_GET_OBJ_METHOD(nsIXPCComponents_, Results) -XPC_IMPL_GET_OBJ_METHOD(nsIXPCComponents_, ID) -XPC_IMPL_GET_OBJ_METHOD(nsIXPCComponents_, Exception) -XPC_IMPL_GET_OBJ_METHOD(nsIXPCComponents_, Constructor) -XPC_IMPL_GET_OBJ_METHOD(nsIXPCComponents_, Utils) +XPC_IMPL_GET_OBJ_METHOD(Interfaces) +XPC_IMPL_GET_OBJ_METHOD(InterfacesByID) +XPC_IMPL_GET_OBJ_METHOD(Classes) +XPC_IMPL_GET_OBJ_METHOD(ClassesByID) +XPC_IMPL_GET_OBJ_METHOD(Results) +XPC_IMPL_GET_OBJ_METHOD(ID) +XPC_IMPL_GET_OBJ_METHOD(Exception) +XPC_IMPL_GET_OBJ_METHOD(Constructor) +XPC_IMPL_GET_OBJ_METHOD(Utils) #undef XPC_IMPL_GET_OBJ_METHOD /*******************************************/ NS_IMETHODIMP nsXPCComponents::IsSuccessCode(nsresult result, PRBool *out) { *out = NS_SUCCEEDED(result);
--- a/js/src/xpconnect/src/xpcmodule.h +++ b/js/src/xpconnect/src/xpcmodule.h @@ -57,48 +57,44 @@ #define MOZJSSUBSCRIPTLOADER_CONTRACTID "@mozilla.org/moz/jssubscript-loader;1" NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSID) NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCException) NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCJSContextStackIterator) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIXPConnect, nsXPConnect::GetSingleton) NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptError) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCComponents_Interfaces) NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSComponentLoader) NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSSubScriptLoader) NS_DEFINE_NAMED_CID(NS_JS_ID_CID); NS_DEFINE_NAMED_CID(NS_XPCONNECT_CID); NS_DEFINE_NAMED_CID(NS_XPCEXCEPTION_CID); NS_DEFINE_NAMED_CID(NS_SCRIPTERROR_CID); -NS_DEFINE_NAMED_CID(SCRIPTABLE_INTERFACES_CID); NS_DEFINE_NAMED_CID(NS_XPC_JSCONTEXT_STACK_ITERATOR_CID); NS_DEFINE_NAMED_CID(MOZJSCOMPONENTLOADER_CID); NS_DEFINE_NAMED_CID(MOZ_JSSUBSCRIPTLOADER_CID); #define XPCONNECT_CIDENTRIES \ { &kNS_JS_ID_CID, false, NULL, nsJSIDConstructor }, \ { &kNS_XPCONNECT_CID, false, NULL, nsIXPConnectConstructor }, \ { &kNS_XPCEXCEPTION_CID, false, NULL, nsXPCExceptionConstructor }, \ { &kNS_SCRIPTERROR_CID, false, NULL, nsScriptErrorConstructor }, \ - { &kSCRIPTABLE_INTERFACES_CID, false, NULL, nsXPCComponents_InterfacesConstructor }, \ { &kNS_XPC_JSCONTEXT_STACK_ITERATOR_CID, false, NULL, nsXPCJSContextStackIteratorConstructor }, \ { &kMOZJSCOMPONENTLOADER_CID, false, NULL, mozJSComponentLoaderConstructor }, \ { &kMOZ_JSSUBSCRIPTLOADER_CID, false, NULL, mozJSSubScriptLoaderConstructor }, #define XPCONNECT_CONTRACTS \ { XPC_ID_CONTRACTID, &kNS_JS_ID_CID }, \ { XPC_XPCONNECT_CONTRACTID, &kNS_XPCONNECT_CID }, \ { XPC_CONTEXT_STACK_CONTRACTID, &kNS_XPCONNECT_CID }, \ { XPC_RUNTIME_CONTRACTID, &kNS_XPCONNECT_CID }, \ { XPC_EXCEPTION_CONTRACTID, &kNS_XPCEXCEPTION_CID }, \ { NS_SCRIPTERROR_CONTRACTID, &kNS_SCRIPTERROR_CID }, \ - { NS_SCRIPTABLE_INTERFACES_CONTRACTID, &kSCRIPTABLE_INTERFACES_CID }, \ { XPC_JSCONTEXT_STACK_ITERATOR_CONTRACTID, &kNS_XPC_JSCONTEXT_STACK_ITERATOR_CID }, \ { MOZJSCOMPONENTLOADER_CONTRACTID, &kMOZJSCOMPONENTLOADER_CID }, \ { MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID }, #define XPCONNECT_CATEGORIES \ { "module-loader", "js", MOZJSCOMPONENTLOADER_CONTRACTID }, nsresult xpcModuleCtor();
--- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -3819,40 +3819,16 @@ private: nsXPCComponents_ClassesByID* mClassesByID; nsXPCComponents_Results* mResults; nsXPCComponents_ID* mID; nsXPCComponents_Exception* mException; nsXPCComponents_Constructor* mConstructor; nsXPCComponents_Utils* mUtils; }; -/***************************************************************************/ - -class nsXPCComponents_Interfaces : - public nsIScriptableInterfaces, - public nsIXPCScriptable, - public nsIClassInfo, - public nsISecurityCheckedComponent -{ -public: - // all the interface method declarations... - NS_DECL_ISUPPORTS - NS_DECL_NSISCRIPTABLEINTERFACES - NS_DECL_NSIXPCSCRIPTABLE - NS_DECL_NSICLASSINFO - NS_DECL_NSISECURITYCHECKEDCOMPONENT - -public: - nsXPCComponents_Interfaces(); - virtual ~nsXPCComponents_Interfaces(); - -private: - nsCOMPtr<nsIInterfaceInfoManager> mManager; -}; - /***************************************************************************/ extern JSObject* xpc_NewIDObject(JSContext *cx, JSObject* jsobj, const nsID& aID); extern const nsID* xpc_JSObjectToID(JSContext *cx, JSObject* obj);