From 892ad17efd5efa642a85ad28ea72f0c2a9bf632a Mon Sep 17 00:00:00 2001 From: Matheus Kerschbaum Date: Tue, 14 Jun 2011 05:50:29 +0200 Subject: [PATCH] Bug 662000 part 2: Remove XPC_IDISPATCH_SUPPORT from the build-system and XPConnect. r=mrbkap --- caps/include/nsScriptSecurityManager.h | 11 --- caps/src/Makefile.in | 4 - caps/src/nsScriptSecurityManager.cpp | 81 ------------------- config/autoconf.mk.in | 1 - configure.in | 11 +-- js/src/xpconnect/idl/Makefile.in | 8 -- js/src/xpconnect/idl/nsIXPConnect.idl | 8 -- js/src/xpconnect/src/Makefile.in | 20 ----- js/src/xpconnect/src/xpc.msg | 8 -- js/src/xpconnect/src/xpccallcontext.cpp | 36 --------- js/src/xpconnect/src/xpcforwards.h | 10 --- js/src/xpconnect/src/xpcinlines.h | 52 +----------- js/src/xpconnect/src/xpcmodule.cpp | 8 -- js/src/xpconnect/src/xpcmodule.h | 21 +---- js/src/xpconnect/src/xpcprivate.h | 43 ---------- js/src/xpconnect/src/xpcthrower.cpp | 76 +---------------- js/src/xpconnect/src/xpcwrappedjsclass.cpp | 7 -- js/src/xpconnect/src/xpcwrappednative.cpp | 47 +---------- .../xpconnect/src/xpcwrappednativejsops.cpp | 15 ---- 19 files changed, 7 insertions(+), 460 deletions(-) diff --git a/caps/include/nsScriptSecurityManager.h b/caps/include/nsScriptSecurityManager.h index ce1eb610c68..56fec6c62a1 100644 --- a/caps/include/nsScriptSecurityManager.h +++ b/caps/include/nsScriptSecurityManager.h @@ -588,13 +588,6 @@ private: nsresult InitPrincipals(PRUint32 prefCount, const char** prefNames); - -#ifdef XPC_IDISPATCH_SUPPORT - // While this header is included outside of caps, this class isn't - // referenced so this should be fine. - nsresult - CheckComponentPermissions(JSContext *cx, const nsCID &aCID); -#endif #ifdef DEBUG_CAPS_HACKER void PrintPolicyDB(); @@ -632,10 +625,6 @@ private: PRPackedBool mIsJavaScriptEnabled; PRPackedBool mIsWritingPrefs; PRPackedBool mPolicyPrefsChanged; -#ifdef XPC_IDISPATCH_SUPPORT - PRPackedBool mXPCDefaultGrantAll; - static const char sXPCDefaultGrantAllName[]; -#endif static PRBool sStrictFileOriginPolicy; diff --git a/caps/src/Makefile.in b/caps/src/Makefile.in index 8e821a0722e..1761af05536 100644 --- a/caps/src/Makefile.in +++ b/caps/src/Makefile.in @@ -58,10 +58,6 @@ CPPSRCS = \ nsSecurityManagerFactory.cpp \ $(NULL) -ifdef XPC_IDISPATCH_SUPPORT -DEFINES += -DXPC_IDISPATCH_SUPPORT -endif - include $(topsrcdir)/config/rules.mk INCLUDES += -I$(srcdir)/../include \ diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index 700210fbbdc..a39c9e93206 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -3090,60 +3090,6 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx, return rv; } -#ifdef XPC_IDISPATCH_SUPPORT -nsresult -nsScriptSecurityManager::CheckComponentPermissions(JSContext *cx, - const nsCID &aCID) -{ - nsresult rv; - nsIPrincipal* subjectPrincipal = GetSubjectPrincipal(cx, &rv); - if (NS_FAILED(rv)) - return rv; - - // Reformat the CID string so it's suitable for prefs - nsXPIDLCString cidTemp; - cidTemp.Adopt(aCID.ToString()); - nsCAutoString cid(NS_LITERAL_CSTRING("CID") + - Substring(cidTemp, 1, cidTemp.Length() - 2)); - ToUpperCase(cid); - -#ifdef DEBUG_CAPS_CheckComponentPermissions - printf("### CheckComponentPermissions(ClassID.%s) ",cid.get()); -#endif - - // Look up the policy for this class. - // while this isn't a property we'll treat it as such, using ACCESS_CALL_METHOD - JSAutoRequest ar(cx); - jsid cidId = INTERNED_STRING_TO_JSID(::JS_InternString(cx, cid.get())); - - ClassInfoData nameData(nsnull, "ClassID"); - SecurityLevel securityLevel; - rv = LookupPolicy(subjectPrincipal, nameData, cidId, - nsIXPCSecurityManager::ACCESS_CALL_METHOD, - nsnull, &securityLevel); - if (NS_FAILED(rv)) - return rv; - - // If there's no policy stored, use the "security.classID.allowByDefault" pref - if (securityLevel.level == SCRIPT_SECURITY_UNDEFINED_ACCESS) - securityLevel.level = mXPCDefaultGrantAll ? SCRIPT_SECURITY_ALL_ACCESS : - SCRIPT_SECURITY_NO_ACCESS; - - if (securityLevel.level == SCRIPT_SECURITY_ALL_ACCESS) - { -#ifdef DEBUG_CAPS_CheckComponentPermissions - printf(" GRANTED.\n"); -#endif - return NS_OK; - } - -#ifdef DEBUG_CAPS_CheckComponentPermissions - printf(" DENIED.\n"); -#endif - return NS_ERROR_DOM_PROP_ACCESS_DENIED; -} -#endif - NS_IMETHODIMP nsScriptSecurityManager::CanCreateInstance(JSContext *cx, const nsCID &aCID) @@ -3156,12 +3102,6 @@ nsScriptSecurityManager::CanCreateInstance(JSContext *cx, nsresult rv = CheckXPCPermissions(nsnull, nsnull, nsnull, nsnull, nsnull); if (NS_FAILED(rv)) -#ifdef XPC_IDISPATCH_SUPPORT - { - rv = CheckComponentPermissions(cx, aCID); - } - if (NS_FAILED(rv)) -#endif { //-- Access denied, report an error nsCAutoString errorMsg("Permission denied to create instance of class. CID="); @@ -3382,9 +3322,6 @@ nsScriptSecurityManager::nsScriptSecurityManager(void) mIsJavaScriptEnabled(PR_FALSE), mIsWritingPrefs(PR_FALSE), mPolicyPrefsChanged(PR_TRUE) -#ifdef XPC_IDISPATCH_SUPPORT - , mXPCDefaultGrantAll(PR_FALSE) -#endif { NS_ASSERTION(sizeof(PRWord) == sizeof(void*), "PRWord and void* have different lengths on this platform. " @@ -3982,10 +3919,6 @@ const char nsScriptSecurityManager::sJSEnabledPrefName[] = "javascript.enabled"; const char nsScriptSecurityManager::sFileOriginPolicyPrefName[] = "security.fileuri.strict_origin_policy"; -#ifdef XPC_IDISPATCH_SUPPORT -const char nsScriptSecurityManager::sXPCDefaultGrantAllName[] = - "security.classID.allowByDefault"; -#endif inline void nsScriptSecurityManager::ScriptSecurityPrefChanged() @@ -3995,11 +3928,6 @@ nsScriptSecurityManager::ScriptSecurityPrefChanged() sStrictFileOriginPolicy = PR_TRUE; -#ifdef XPC_IDISPATCH_SUPPORT - // Granting XPC Priveleges defaults to disabled in failure cases. - mXPCDefaultGrantAll = PR_FALSE; -#endif - nsresult rv; if (!mPrefBranch) { rv = InitPrefs(); @@ -4015,12 +3943,6 @@ nsScriptSecurityManager::ScriptSecurityPrefChanged() rv = mPrefBranch->GetBoolPref(sFileOriginPolicyPrefName, &temp); if (NS_SUCCEEDED(rv)) sStrictFileOriginPolicy = NS_SUCCEEDED(rv) && temp; - -#ifdef XPC_IDISPATCH_SUPPORT - rv = mPrefBranch->GetBoolPref(sXPCDefaultGrantAllName, &temp); - if (NS_SUCCEEDED(rv)) - mXPCDefaultGrantAll = temp; -#endif } nsresult @@ -4039,9 +3961,6 @@ nsScriptSecurityManager::InitPrefs() // set observer callbacks in case the value of the prefs change prefBranchInternal->AddObserver(sJSEnabledPrefName, this, PR_FALSE); prefBranchInternal->AddObserver(sFileOriginPolicyPrefName, this, PR_FALSE); -#ifdef XPC_IDISPATCH_SUPPORT - prefBranchInternal->AddObserver(sXPCDefaultGrantAllName, this, PR_FALSE); -#endif PRUint32 prefCount; char** prefNames; diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index d5c52f3c6c6..9d08ec8caa6 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -138,7 +138,6 @@ MOZ_UPDATE_PACKAGING = @MOZ_UPDATE_PACKAGING@ MOZ_NO_ACTIVEX_SUPPORT = @MOZ_NO_ACTIVEX_SUPPORT@ MOZ_ACTIVEX_SCRIPTING_SUPPORT = @MOZ_ACTIVEX_SCRIPTING_SUPPORT@ MOZ_DISABLE_PARENTAL_CONTROLS = @MOZ_DISABLE_PARENTAL_CONTROLS@ -XPC_IDISPATCH_SUPPORT = @XPC_IDISPATCH_SUPPORT@ NS_ENABLE_TSF = @NS_ENABLE_TSF@ MOZ_SPELLCHECK = @MOZ_SPELLCHECK@ MOZ_PROFILELOCKING = @MOZ_PROFILELOCKING@ diff --git a/configure.in b/configure.in index 066973db299..d57c1115602 100644 --- a/configure.in +++ b/configure.in @@ -4819,7 +4819,6 @@ NECKO_DISK_CACHE=1 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg" USE_ARM_KUSER= BUILD_CTYPES=1 -XPC_IDISPATCH_SUPPORT= case "${target}" in @@ -6503,14 +6502,6 @@ dnl ======================================================== dnl ActiveX dnl ======================================================== -MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch, -[ --disable-xpconnect-idispatch - Disable building of xpconnect support for IDispatch - (win32 only)], - XPC_IDISPATCH_SUPPORT=, - XPC_IDISPATCH_SUPPORT=1) -AC_SUBST(XPC_IDISPATCH_SUPPORT) - MOZ_ARG_DISABLE_BOOL(activex, [ --disable-activex Disable building of ActiveX control (win32 only)], MOZ_NO_ACTIVEX_SUPPORT=1, @@ -6530,7 +6521,7 @@ then fi if test "$COMPILE_ENVIRONMENT" = "1"; then -if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then +if test -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then case "$target" in *-mingw*) if test "$ac_cv_header_atlbase_h" = "no"; then diff --git a/js/src/xpconnect/idl/Makefile.in b/js/src/xpconnect/idl/Makefile.in index 575a38a208d..974d6351fab 100644 --- a/js/src/xpconnect/idl/Makefile.in +++ b/js/src/xpconnect/idl/Makefile.in @@ -63,17 +63,9 @@ XPIDLSRCS = \ nsIScriptError.idl \ nsIXPCScriptNotify.idl \ nsIScriptableInterfaces.idl \ - XPCIDispatch.idl \ xpcIJSWeakReference.idl \ xpcIJSGetFactory.idl \ $(NULL) -ifdef XPC_IDISPATCH_SUPPORT -XPIDLSRCS += \ - nsIDispatchSupport.idl \ - nsIActiveXSecurityPolicy.idl \ - $(NULL) -endif - include $(topsrcdir)/config/rules.mk diff --git a/js/src/xpconnect/idl/nsIXPConnect.idl b/js/src/xpconnect/idl/nsIXPConnect.idl index 990856472f0..45547f3d304 100644 --- a/js/src/xpconnect/idl/nsIXPConnect.idl +++ b/js/src/xpconnect/idl/nsIXPConnect.idl @@ -137,14 +137,6 @@ class nsWrapperCache; #define NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN GENERATE_XPC_FAILURE(52) #define NS_ERROR_XPC_BAD_CONVERT_JS_ZERO_ISNOT_NULL GENERATE_XPC_FAILURE(53) -#ifdef XPC_IDISPATCH_SUPPORT -// IDispatch support related errors -#define NS_ERROR_XPC_COM_UNKNOWN GENERATE_XPC_FAILURE(54) -#define NS_ERROR_XPC_COM_ERROR GENERATE_XPC_FAILURE(55) -#define NS_ERROR_XPC_COM_INVALID_CLASS_ID GENERATE_XPC_FAILURE(56) -#define NS_ERROR_XPC_COM_CREATE_FAILED GENERATE_XPC_FAILURE(57) -#define NS_ERROR_XPC_IDISPATCH_NOT_ENABLED GENERATE_XPC_FAILURE(58) -#endif // any new errors here should have an associated entry added in xpc.msg /***************************************************************************/ %} diff --git a/js/src/xpconnect/src/Makefile.in b/js/src/xpconnect/src/Makefile.in index 7ca36b97351..3ae754c483b 100644 --- a/js/src/xpconnect/src/Makefile.in +++ b/js/src/xpconnect/src/Makefile.in @@ -93,18 +93,6 @@ CPPSRCS = \ xpcquickstubs.cpp \ dom_quickstubs.cpp \ $(NULL) -ifdef XPC_IDISPATCH_SUPPORT -CPPSRCS += XPCDispObject.cpp \ - XPCDispInterface.cpp \ - XPCDispConvert.cpp \ - XPCDispTypeInfo.cpp \ - XPCDispTearOff.cpp \ - XPCIDispatchExtension.cpp \ - XPCDispParams.cpp \ - XPCIDispatchClassInfo.cpp \ - nsDispatchSupport.cpp \ - $(NULL) -endif include $(topsrcdir)/config/config.mk @@ -154,14 +142,6 @@ ENABLE_TRACEABLE_FLAGS = --enable-traceables endif # ENABLE_JIT -ifdef XPC_IDISPATCH_SUPPORT -DEFINES += -DXPC_IDISPATCH_SUPPORT -ifdef XPC_COMOBJECT -DEFINES += -DXPC_COMOBJECT -endif - -endif - ifeq ($(OS_ARCH),WINNT) ifndef GNU_CXX ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER))) diff --git a/js/src/xpconnect/src/xpc.msg b/js/src/xpconnect/src/xpc.msg index b60ec04b8a4..103c50a1e0f 100644 --- a/js/src/xpconnect/src/xpc.msg +++ b/js/src/xpconnect/src/xpc.msg @@ -162,14 +162,6 @@ XPC_MSG_DEF(NS_ERROR_OBJECT_IS_IMMUTABLE , "Can not modify immutable XPC_MSG_DEF(NS_ERROR_LOSS_OF_SIGNIFICANT_DATA , "Data conversion failed because significant data would be lost") XPC_MSG_DEF(NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA , "Data conversion succeeded but data was rounded to fit") -#ifdef XPC_IDISPATCH_SUPPORT -XPC_MSG_DEF(NS_ERROR_XPC_COM_UNKNOWN , "Unknown COM error occurred") -XPC_MSG_DEF(NS_ERROR_XPC_COM_ERROR , "COM Error") -XPC_MSG_DEF(NS_ERROR_XPC_COM_INVALID_CLASS_ID , "Invalid class ID") -XPC_MSG_DEF(NS_ERROR_XPC_COM_CREATE_FAILED , "Unable to create an instance of the desired COM class") -XPC_MSG_DEF(NS_ERROR_XPC_IDISPATCH_NOT_ENABLED , "IDispatch support is not enabled") -#endif - /* network related codes (from nsNetError.h) */ XPC_MSG_DEF(NS_BINDING_FAILED , "The async request failed for some unknown reason") diff --git a/js/src/xpconnect/src/xpccallcontext.cpp b/js/src/xpconnect/src/xpccallcontext.cpp index 91b692de458..182de8febb3 100644 --- a/js/src/xpconnect/src/xpccallcontext.cpp +++ b/js/src/xpconnect/src/xpccallcontext.cpp @@ -216,9 +216,6 @@ XPCCallContext::SetName(jsid name) mName = name; -#ifdef XPC_IDISPATCH_SUPPORT - mIDispatchMember = nsnull; -#endif if(mTearOff) { mSet = nsnull; @@ -274,9 +271,6 @@ XPCCallContext::SetCallInfo(XPCNativeInterface* iface, XPCNativeMember* member, if(mState < HAVE_NAME) mState = HAVE_NAME; -#ifdef XPC_IDISPATCH_SUPPORT - mIDispatchMember = nsnull; -#endif } void @@ -291,9 +285,6 @@ XPCCallContext::SetArgsAndResultPtr(uintN argc, mSet = nsnull; mInterface = nsnull; mMember = nsnull; -#ifdef XPC_IDISPATCH_SUPPORT - mIDispatchMember = nsnull; -#endif mStaticMemberIsLocal = JS_FALSE; } @@ -553,33 +544,6 @@ XPCCallContext::SetReturnValueWasSet(PRBool aReturnValueWasSet) return NS_OK; } -#ifdef XPC_IDISPATCH_SUPPORT - -void -XPCCallContext::SetIDispatchInfo(XPCNativeInterface* iface, - void * member) -{ - CHECK_STATE(HAVE_CONTEXT); - - // We are going straight to the method info and need not do a lookup - // by id. - - // don't be tricked if method is called with wrong 'this' - if(mTearOff && mTearOff->GetInterface() != iface) - mTearOff = nsnull; - - mSet = nsnull; - mInterface = iface; - mMember = nsnull; - mIDispatchMember = member; - mName = reinterpret_cast(member)->GetName(); - - if(mState < HAVE_NAME) - mState = HAVE_NAME; -} - -#endif - NS_IMETHODIMP XPCCallContext::GetPreviousCallContext(nsAXPCNativeCallContext **aResult) { diff --git a/js/src/xpconnect/src/xpcforwards.h b/js/src/xpconnect/src/xpcforwards.h index 490d1ceeaf5..08a1c5401ac 100644 --- a/js/src/xpconnect/src/xpcforwards.h +++ b/js/src/xpconnect/src/xpcforwards.h @@ -101,14 +101,4 @@ class AutoMarkingPtr; class xpcProperty; -#ifdef XPC_IDISPATCH_SUPPORT -class XPCDispInterface; -struct IDispatch; -class XPCDispParams; -class XPCDispJSPropertyInfo; -class nsIXPConnectWrappedJS; -class XPCIDispatchExtension; -#endif - - #endif /* xpcforwards_h___ */ diff --git a/js/src/xpconnect/src/xpcinlines.h b/js/src/xpconnect/src/xpcinlines.h index dc49d7b08e4..2f2b5a45890 100644 --- a/js/src/xpconnect/src/xpcinlines.h +++ b/js/src/xpconnect/src/xpcinlines.h @@ -271,11 +271,7 @@ XPCCallContext::GetMember() const inline JSBool XPCCallContext::HasInterfaceAndMember() const { - return mState >= HAVE_NAME && mInterface && (mMember -#ifdef XPC_IDISPATCH_SUPPORT - || mIDispatchMember -#endif - ); + return mState >= HAVE_NAME && mInterface && mMember; } inline jsid @@ -612,65 +608,19 @@ inline void XPCNativeSet::ASSERT_NotMarked() inline JSObject* XPCWrappedNativeTearOff::GetJSObject() const { -#ifdef XPC_IDISPATCH_SUPPORT - if(IsIDispatch()) - { - XPCDispInterface * iface = GetIDispatchInfo(); - return iface ? iface->GetJSObject() : nsnull; - } -#endif return mJSObject; } inline void XPCWrappedNativeTearOff::SetJSObject(JSObject* JSObj) { -#ifdef XPC_IDISPATCH_SUPPORT - if(IsIDispatch()) - { - XPCDispInterface* iface = GetIDispatchInfo(); - if(iface) - iface->SetJSObject(JSObj); - } - else -#endif mJSObject = JSObj; } -#ifdef XPC_IDISPATCH_SUPPORT -inline void -XPCWrappedNativeTearOff::SetIDispatch(JSContext* cx) -{ - mJSObject = (JSObject*)(((jsword) - ::XPCDispInterface::NewInstance(cx, - mNative)) | 2); -} - -inline XPCDispInterface* -XPCWrappedNativeTearOff::GetIDispatchInfo() const -{ - NS_ASSERTION((jsword)mJSObject & 2, "XPCWrappedNativeTearOff::GetIDispatchInfo " - "called on a non IDispatch interface"); - return reinterpret_cast - ((((jsword)mJSObject) & ~JSOBJECT_MASK)); -} - -inline JSBool -XPCWrappedNativeTearOff::IsIDispatch() const -{ - return (JSBool)(((jsword)mJSObject) & IDISPATCH_BIT); -} - -#endif - inline XPCWrappedNativeTearOff::~XPCWrappedNativeTearOff() { NS_ASSERTION(!(GetInterface()||GetNative()||GetJSObject()), "tearoff not empty in dtor"); -#ifdef XPC_IDISPATCH_SUPPORT - if(IsIDispatch()) - delete GetIDispatchInfo(); -#endif } /***************************************************************************/ diff --git a/js/src/xpconnect/src/xpcmodule.cpp b/js/src/xpconnect/src/xpcmodule.cpp index f2c192153f8..67e3a082d14 100644 --- a/js/src/xpconnect/src/xpcmodule.cpp +++ b/js/src/xpconnect/src/xpcmodule.cpp @@ -49,10 +49,6 @@ xpcModuleCtor() XPCWrappedNativeScope::InitStatics(); XPCPerThreadData::InitStatics(); -#ifdef XPC_IDISPATCH_SUPPORT - XPCIDispatchExtension::InitStatics(); -#endif - return NS_OK; } @@ -62,8 +58,4 @@ xpcModuleDtor() // Release our singletons nsXPConnect::ReleaseXPConnectSingleton(); xpc_DestroyJSxIDClassObjects(); -#ifdef XPC_IDISPATCH_SUPPORT - nsDispatchSupport::FreeSingleton(); - XPCIDispatchClassInfo::FreeSingleton(); -#endif } diff --git a/js/src/xpconnect/src/xpcmodule.h b/js/src/xpconnect/src/xpcmodule.h index 62d356e134d..6ecb73a860a 100644 --- a/js/src/xpconnect/src/xpcmodule.h +++ b/js/src/xpconnect/src/xpcmodule.h @@ -67,11 +67,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCComponents_Interfaces) NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSComponentLoader) NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSSubScriptLoader) -#ifdef XPC_IDISPATCH_SUPPORT -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIDispatchSupport, - nsDispatchSupport::GetSingleton) -#endif // XPC_IDISPATCH_SUPPORT - NS_DEFINE_NAMED_CID(NS_JS_ID_CID); NS_DEFINE_NAMED_CID(NS_XPCONNECT_CID); NS_DEFINE_NAMED_CID(NS_XPCEXCEPTION_CID); @@ -80,16 +75,6 @@ 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); -#ifdef XPC_IDISPATCH_SUPPORT -NS_DEFINE_NAMED_CID(NS_IDISPATCH_SUPPORT_CID); -#define XPCIDISPATCH_CIDS \ - { &kNS_IDISPATCH_SUPPORT_CID, false, NULL, nsIDispatchSupportConstructor }, -#define XPCIDISPATCH_CONTRACTS \ - { NS_IDISPATCH_SUPPORT_CONTRACTID, &kNS_IDISPATCH_SUPPORT_CID }, -#else -#define XPCIDISPATCH_CIDS -#define XPCIDISPATCH_CONTRACTS -#endif #define XPCONNECT_CIDENTRIES \ { &kNS_JS_ID_CID, false, NULL, nsJSIDConstructor }, \ @@ -99,8 +84,7 @@ NS_DEFINE_NAMED_CID(NS_IDISPATCH_SUPPORT_CID); { &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 }, \ - XPCIDISPATCH_CIDS + { &kMOZ_JSSUBSCRIPTLOADER_CID, false, NULL, mozJSSubScriptLoaderConstructor }, #define XPCONNECT_CONTRACTS \ { XPC_ID_CONTRACTID, &kNS_JS_ID_CID }, \ @@ -112,8 +96,7 @@ NS_DEFINE_NAMED_CID(NS_IDISPATCH_SUPPORT_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 }, \ - XPCIDISPATCH_CONTRACTS + { MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID }, #define XPCONNECT_CATEGORIES \ { "module-loader", "js", MOZJSCOMPONENTLOADER_CONTRACTID }, diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index 9b7b324fa8a..6a97ef7fbc9 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -130,13 +130,6 @@ #include "nsIThreadInternal.h" -#ifdef XPC_IDISPATCH_SUPPORT -// This goop was added because of EXCEPINFO in ThrowCOMError -// This include is here, because it needs to occur before the undefines below -#include -#include "oaidl.h" -#endif - #ifdef XP_WIN // Nasty MS defines #ifdef GetClassInfo @@ -585,10 +578,6 @@ public: return gReportAllJSExceptions > 0; } -#ifdef XPC_IDISPATCH_SUPPORT -public: - static PRBool IsIDispatchEnabled(); -#endif protected: nsXPConnect(); @@ -1112,15 +1101,6 @@ public: XPCReadableJSStringWrapper *NewStringWrapper(const PRUnichar *str, PRUint32 len); void DeleteString(nsAString *string); -#ifdef XPC_IDISPATCH_SUPPORT - /** - * Sets the IDispatch information for the context - * This has to be void* because of icky Microsoft macros that - * would be introduced if we included the DispatchInterface header - */ - void SetIDispatchInfo(XPCNativeInterface* iface, void * member); - void* GetIDispatchMember() const { return mIDispatchMember; } -#endif private: // no copy ctor or assignment allowed @@ -1209,9 +1189,6 @@ private: jsval* mRetVal; JSBool mReturnValueWasSet; -#ifdef XPC_IDISPATCH_SUPPORT - void* mIDispatchMember; -#endif PRUint16 mMethodIndex; #define XPCCCX_STRING_CACHE_SIZE 2 @@ -2362,16 +2339,6 @@ public: void Unmark() {mJSObject = (JSObject*)(((jsword)mJSObject) & ~1);} JSBool IsMarked() const {return (JSBool)(((jsword)mJSObject) & 1);} -#ifdef XPC_IDISPATCH_SUPPORT - enum JSObject_flags - { - IDISPATCH_BIT = 2, - JSOBJECT_MASK = 3 - }; - void SetIDispatch(JSContext* cx); - JSBool IsIDispatch() const; - XPCDispInterface* GetIDispatchInfo() const; -#endif private: XPCWrappedNativeTearOff(const XPCWrappedNativeTearOff& r); // not implemented XPCWrappedNativeTearOff& operator= (const XPCWrappedNativeTearOff& r); // not implemented @@ -3363,11 +3330,6 @@ public: static void Throw(nsresult rv, XPCCallContext& ccx); static void ThrowBadResult(nsresult rv, nsresult result, XPCCallContext& ccx); static void ThrowBadParam(nsresult rv, uintN paramNum, XPCCallContext& ccx); -#ifdef XPC_IDISPATCH_SUPPORT - static void ThrowCOMError(JSContext* cx, unsigned long COMErrorCode, - nsresult rv = NS_ERROR_XPC_COM_ERROR, - const EXCEPINFO * exception = nsnull); -#endif static JSBool SetVerbosity(JSBool state) {JSBool old = sVerbose; sVerbose = state; return old;} @@ -4504,11 +4466,6 @@ ParticipatesInCycleCollection(JSContext *cx, js::gc::Cell *cell) } -#ifdef XPC_IDISPATCH_SUPPORT -// IDispatch specific classes -#include "XPCDispPrivate.h" -#endif - /***************************************************************************/ // Inlines use the above - include last. diff --git a/js/src/xpconnect/src/xpcthrower.cpp b/js/src/xpconnect/src/xpcthrower.cpp index 36f0e0f7634..9694537186a 100644 --- a/js/src/xpconnect/src/xpcthrower.cpp +++ b/js/src/xpconnect/src/xpcthrower.cpp @@ -179,25 +179,8 @@ XPCThrower::Verbosify(XPCCallContext& ccx, if(ccx.HasInterfaceAndMember()) { XPCNativeInterface* iface = ccx.GetInterface(); - jsid id = JSID_VOID; -#ifdef XPC_IDISPATCH_SUPPORT - NS_ASSERTION(ccx.GetIDispatchMember() == nsnull || - ccx.GetMember() == nsnull, - "Both IDispatch member and regular XPCOM member " - "were set in XPCCallContext"); - if(ccx.GetIDispatchMember()) { - XPCDispInterface::Member * member = - reinterpret_cast(ccx.GetIDispatchMember()); - if(member && JSID_IS_STRING(member->GetName())) - { - id = member->GetName(); - } - } - else -#endif - { - id = ccx.GetMember()->GetName(); + jsid id = ccx.GetMember()->GetName(); } JSAutoByteString bytes; const char *name = JSID_IS_VOID(id) ? "Unknown" : bytes.encode(ccx, JSID_TO_STRING(id)); @@ -339,60 +322,3 @@ XPCThrower::ThrowExceptionObject(JSContext* cx, nsIException* e) } return success; } - -#ifdef XPC_IDISPATCH_SUPPORT -// static -void -XPCThrower::ThrowCOMError(JSContext* cx, unsigned long COMErrorCode, - nsresult rv, const EXCEPINFO * exception) -{ - nsCAutoString msg; - IErrorInfo * pError; - const char * format; - if(!nsXPCException::NameAndFormatForNSResult(rv, nsnull, &format)) - format = ""; - msg = format; - if(exception) - { - msg += static_cast - (_bstr_t(exception->bstrSource, false)); - msg += " : "; - msg.AppendInt(static_cast(COMErrorCode)); - msg += " - "; - msg += static_cast - (_bstr_t(exception->bstrDescription, false)); - } - else - { - // Get the current COM error object - unsigned long result = GetErrorInfo(0, &pError); - if(SUCCEEDED(result) && pError) - { - // Build an error message from the COM error object - BSTR bstrSource = NULL; - if(SUCCEEDED(pError->GetSource(&bstrSource)) && bstrSource) - { - _bstr_t src(bstrSource, false); - msg += static_cast(src); - msg += " : "; - } - msg.AppendInt(static_cast(COMErrorCode), 16); - BSTR bstrDesc = NULL; - if(SUCCEEDED(pError->GetDescription(&bstrDesc)) && bstrDesc) - { - msg += " - "; - _bstr_t desc(bstrDesc, false); - msg += static_cast(desc); - } - } - else - { - // No error object, so just report the result - msg += "COM Error Result = "; - msg.AppendInt(static_cast(COMErrorCode), 16); - } - } - XPCThrower::BuildAndThrowException(cx, rv, msg.get()); -} - -#endif diff --git a/js/src/xpconnect/src/xpcwrappedjsclass.cpp b/js/src/xpconnect/src/xpcwrappedjsclass.cpp index 24218d14a7f..cc2f035baaa 100644 --- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp +++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp @@ -661,13 +661,6 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self, return NS_OK; } -#ifdef XPC_IDISPATCH_SUPPORT - // If IDispatch is enabled and we're QI'ing to IDispatch - if(nsXPConnect::IsIDispatchEnabled() && aIID.Equals(NSID_IDISPATCH)) - { - return XPCIDispatchExtension::IDispatchQIWrappedJS(self, aInstancePtr); - } -#endif if(aIID.Equals(NS_GET_IID(nsIPropertyBag))) { // We only want to expose one implementation from our aggregate. diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index b74b941fba5..be27a7856e8 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -356,20 +356,7 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx, NS_ASSERTION(!Scope->GetRuntime()->GetThreadRunningGC(), "XPCWrappedNative::GetNewOrUsed called during GC"); - nsISupports *identity; -#ifdef XPC_IDISPATCH_SUPPORT - // XXX This is done for the benefit of some warped COM implementations - // where QI(IID_IUnknown, a.b) == QI(IID_IUnknown, a). If someone passes - // in a pointer that hasn't been QI'd to IDispatch properly this could - // create multiple wrappers for the same object, creating a fair bit of - // confusion. - PRBool isIDispatch = Interface && - Interface->GetIID()->Equals(NSID_IDISPATCH); - if(isIDispatch) - identity = helper.Object(); - else -#endif - identity = helper.GetCanonical(); + nsISupports *identity = helper.GetCanonical(); if(!identity) { @@ -435,18 +422,6 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx, nsIClassInfo *info = helper.GetClassInfo(); -#ifdef XPC_IDISPATCH_SUPPORT - // If this is an IDispatch wrapper and it didn't give us a class info - // we'll provide a default one - nsCOMPtr dispatchInfo; - if(isIDispatch && !info) - { - dispatchInfo = dont_AddRef(static_cast - (XPCIDispatchClassInfo::GetSingleton())); - info = dispatchInfo; - } -#endif - XPCNativeScriptableCreateInfo sciProto; XPCNativeScriptableCreateInfo sci; @@ -845,14 +820,7 @@ XPCWrappedNative::GetUsedOnly(XPCCallContext& ccx, } else { - nsCOMPtr identity; -#ifdef XPC_IDISPATCH_SUPPORT - // XXX See GetNewOrUsed for more info on this - if(Interface->GetIID()->Equals(NSID_IDISPATCH)) - identity = Object; - else -#endif - identity = do_QueryInterface(Object); + nsCOMPtr identity = do_QueryInterface(Object); if(!identity) { @@ -1466,10 +1434,6 @@ XPCWrappedNative::SystemIsBeingShutDown(JSContext* cx) if(to->GetJSObject()) { JS_SetPrivate(cx, to->GetJSObject(), nsnull); -#ifdef XPC_IDISPATCH_SUPPORT - if(to->IsIDispatch()) - delete to->GetIDispatchInfo(); -#endif to->SetJSObject(nsnull); } // We leak the tearoff mNative @@ -2174,13 +2138,6 @@ XPCWrappedNative::InitTearOff(XPCCallContext& ccx, aTearOff->SetInterface(aInterface); aTearOff->SetNative(obj); -#ifdef XPC_IDISPATCH_SUPPORT - // Are we building a tearoff for IDispatch? - if(iid->Equals(NSID_IDISPATCH)) - { - aTearOff->SetIDispatch(ccx); - } -#endif if(needJSObject && !InitTearOffJSObject(ccx, aTearOff)) return NS_ERROR_OUT_OF_MEMORY; diff --git a/js/src/xpconnect/src/xpcwrappednativejsops.cpp b/js/src/xpconnect/src/xpcwrappednativejsops.cpp index 677e6bdbaf0..536d76a6700 100644 --- a/js/src/xpconnect/src/xpcwrappednativejsops.cpp +++ b/js/src/xpconnect/src/xpcwrappednativejsops.cpp @@ -406,14 +406,6 @@ DefinePropertyIfFound(XPCCallContext& ccx, nsnull, propFlags); } -#ifdef XPC_IDISPATCH_SUPPORT - // Check to see if there's an IDispatch tearoff - if(wrapperToReflectInterfaceNames && - XPCIDispatchExtension::DefineProperty(ccx, obj, - id, wrapperToReflectInterfaceNames, propFlags, resolved)) - return JS_TRUE; -#endif - if(resolved) *resolved = JS_FALSE; return JS_TRUE; @@ -634,13 +626,6 @@ XPC_WN_Shared_Enumerate(JSContext *cx, JSObject *obj) for(PRUint16 i = 0; i < interface_count; i++) { XPCNativeInterface* iface = interfaceArray[i]; -#ifdef XPC_IDISPATCH_SUPPORT - if(iface->GetIID()->Equals(NSID_IDISPATCH)) - { - XPCIDispatchExtension::Enumerate(ccx, obj, wrapper); - continue; - } -#endif PRUint16 member_count = iface->GetMemberCount(); for(PRUint16 k = 0; k < member_count; k++) {