Bug 662000 part 2: Remove XPC_IDISPATCH_SUPPORT from the build-system and XPConnect. r=mrbkap
authorMatheus Kerschbaum <matjk7@gmail.com>
Wed, 22 Jun 2011 11:56:47 -0400
changeset 71567 b0507816cb5ec51735a49773a64efb8f9d2a4cef
parent 71566 64ff58414b5aee72dde94029cd3e5e0a6980dd9d
child 71568 311835bfec30d1d91d7fce62186b4d92d43cf711
push idunknown
push userunknown
push dateunknown
reviewersmrbkap
bugs662000
milestone7.0a1
Bug 662000 part 2: Remove XPC_IDISPATCH_SUPPORT from the build-system and XPConnect. r=mrbkap
caps/include/nsScriptSecurityManager.h
caps/src/Makefile.in
caps/src/nsScriptSecurityManager.cpp
config/autoconf.mk.in
configure.in
js/src/xpconnect/idl/Makefile.in
js/src/xpconnect/idl/nsIXPConnect.idl
js/src/xpconnect/src/Makefile.in
js/src/xpconnect/src/xpc.msg
js/src/xpconnect/src/xpccallcontext.cpp
js/src/xpconnect/src/xpcforwards.h
js/src/xpconnect/src/xpcinlines.h
js/src/xpconnect/src/xpcmodule.cpp
js/src/xpconnect/src/xpcmodule.h
js/src/xpconnect/src/xpcprivate.h
js/src/xpconnect/src/xpcthrower.cpp
js/src/xpconnect/src/xpcwrappedjsclass.cpp
js/src/xpconnect/src/xpcwrappednative.cpp
js/src/xpconnect/src/xpcwrappednativejsops.cpp
--- a/caps/include/nsScriptSecurityManager.h
+++ b/caps/include/nsScriptSecurityManager.h
@@ -582,23 +582,16 @@ private:
 
     nsresult
     InitDomainPolicy(JSContext* cx, const char* aPolicyName,
                      DomainPolicy* aDomainPolicy);
 
     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();
 #endif
 
     struct ContextPrincipal {
         ContextPrincipal(ContextPrincipal *next, JSContext *cx,
                          JSStackFrame *fp, nsIPrincipal *principal)
@@ -623,19 +616,16 @@ private:
     nsCOMPtr<nsIPrincipal> mSystemPrincipal;
     nsCOMPtr<nsIPrincipal> mSystemCertificate;
     ContextPrincipal *mContextPrincipals;
     nsInterfaceHashtable<PrincipalKey, nsIPrincipal> mPrincipals;
     PRPackedBool mPrefInitialized;
     PRPackedBool mIsJavaScriptEnabled;
     PRPackedBool mIsWritingPrefs;
     PRPackedBool mPolicyPrefsChanged;
-#ifdef XPC_IDISPATCH_SUPPORT    
-    PRPackedBool mXPCDefaultGrantAll;
-#endif
 
     static PRBool sStrictFileOriginPolicy;
 
     static nsIIOService    *sIOService;
     static nsIXPConnect    *sXPConnect;
     static nsIThreadJSContextStack* sJSContextStack;
     static nsIStringBundle *sStrBundle;
     static JSRuntime       *sRuntime;
--- a/caps/src/Makefile.in
+++ b/caps/src/Makefile.in
@@ -53,17 +53,13 @@ CPPSRCS		= \
 		nsSystemPrincipal.cpp \
 		nsNullPrincipal.cpp \
 		nsNullPrincipalURI.cpp \
 		nsJSPrincipals.cpp \
 		nsScriptSecurityManager.cpp \
 		nsSecurityManagerFactory.cpp \
 		$(NULL)
 
-ifdef XPC_IDISPATCH_SUPPORT
-DEFINES += -DXPC_IDISPATCH_SUPPORT
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 INCLUDES	+= -I$(srcdir)/../include \
 		   -I$(topsrcdir)/js/src/xpconnect/src
 
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -3087,88 +3087,28 @@ nsScriptSecurityManager::CanCreateWrappe
     {
         printf("GRANTED.\n");
 #endif
     }
 
     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)
 {
 #ifdef DEBUG_CAPS_CanCreateInstance
     char* cidStr = aCID.ToString();
     printf("### CanCreateInstance(%s) ", cidStr);
     NS_Free(cidStr);
 #endif
 
     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=");
         char cidStr[NSID_LENGTH];
         aCID.ToProvidedString(cidStr);
         errorMsg.Append(cidStr);
         SetPendingException(cx, errorMsg.get());
 
@@ -3332,28 +3272,22 @@ nsScriptSecurityManager::AsyncOnChannelR
 
 
 /////////////////////////////////////
 // Method implementing nsIObserver //
 /////////////////////////////////////
 const char sJSEnabledPrefName[] = "javascript.enabled";
 const char sFileOriginPolicyPrefName[] =
     "security.fileuri.strict_origin_policy";
-#ifdef XPC_IDISPATCH_SUPPORT
-const char sXPCDefaultGrantAllName[] = "security.classID.allowByDefault";
-#endif
 static const char sPrincipalPrefix[] = "capability.principal";
 static const char sPolicyPrefix[] = "capability.policy.";
 
 static const char* kObservedPrefs[] = {
   sJSEnabledPrefName,
   sFileOriginPolicyPrefName,
-#ifdef XPC_IDISPATCH_SUPPORT
-  sXPCDefaultGrantAllName,
-#endif
   sPolicyPrefix,
   sPrincipalPrefix,
   nsnull
 };
 
 
 NS_IMETHODIMP
 nsScriptSecurityManager::Observe(nsISupports* aObject, const char* aTopic,
@@ -3398,19 +3332,16 @@ nsScriptSecurityManager::nsScriptSecurit
     : mOriginToPolicyMap(nsnull),
       mDefaultPolicy(nsnull),
       mCapabilities(nsnull),
       mContextPrincipals(nsnull),
       mPrefInitialized(PR_FALSE),
       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. "
                  "This may cause a security failure with the SecurityLevel union.");
     mPrincipals.Init(31);
 }
 
 
@@ -4000,38 +3931,28 @@ nsScriptSecurityManager::InitPrincipals(
 inline void
 nsScriptSecurityManager::ScriptSecurityPrefChanged()
 {
     // JavaScript defaults to enabled in failure cases.
     mIsJavaScriptEnabled = PR_TRUE;
 
     sStrictFileOriginPolicy = PR_TRUE;
 
-#ifdef XPC_IDISPATCH_SUPPORT
-    // Granting XPC Priveleges defaults to disabled in failure cases.
-    mXPCDefaultGrantAll = PR_FALSE;
-#endif
-
     nsresult rv;
     if (!mPrefInitialized) {
         rv = InitPrefs();
         if (NS_FAILED(rv))
             return;
     }
 
     mIsJavaScriptEnabled =
         Preferences::GetBool(sJSEnabledPrefName, mIsJavaScriptEnabled);
 
     sStrictFileOriginPolicy =
         Preferences::GetBool(sFileOriginPolicyPrefName, PR_FALSE);
-
-#ifdef XPC_IDISPATCH_SUPPORT
-    mXPCDefaultGrantAll =
-        Preferences::GetBoolPref(sXPCDefaultGrantAllName, mXPCDefaultGrantAll);
-#endif
 }
 
 nsresult
 nsScriptSecurityManager::InitPrefs()
 {
     nsresult rv;
     nsIPrefBranch* branch = Preferences::GetRootBranch();
     NS_ENSURE_TRUE(branch, NS_ERROR_FAILURE);
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -133,17 +133,16 @@ MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_D
 XPCOM_USE_LEA = @XPCOM_USE_LEA@
 MOZ_INSTALLER	= @MOZ_INSTALLER@
 MOZ_UPDATER	= @MOZ_UPDATER@
 MOZ_UPDATE_CHANNEL	= @MOZ_UPDATE_CHANNEL@
 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@
 MOZ_FEEDS = @MOZ_FEEDS@
 MOZ_TOOLKIT_SEARCH = @MOZ_TOOLKIT_SEARCH@
 MOZ_PLACES = @MOZ_PLACES@
 MOZ_STORAGE = @MOZ_STORAGE@
 MOZ_SAFE_BROWSING = @MOZ_SAFE_BROWSING@
--- a/configure.in
+++ b/configure.in
@@ -4802,17 +4802,16 @@ MOZ_PDF_PRINTING=
 MOZ_DISABLE_DOMCRYPTO=
 NSS_DISABLE_DBM=
 NECKO_WIFI=1
 NECKO_COOKIES=1
 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=
 MOZ_USE_NATIVE_POPUP_WINDOWS=
 
 
 case "${target}" in
 *android*|*darwin*)
     ACCESSIBILITY=
     ;;
 *)
@@ -6476,24 +6475,16 @@ MOZ_ARG_ENABLE_BOOL(update-packaging,
     MOZ_UPDATE_PACKAGING=1,
     MOZ_UPDATE_PACKAGING= )
 AC_SUBST(MOZ_UPDATE_PACKAGING)
 
 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,
     MOZ_NO_ACTIVEX_SUPPORT= )
 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
 
 MOZ_ARG_ENABLE_BOOL(activex-scripting,
 [  --enable-activex-scripting
@@ -6503,17 +6494,17 @@ MOZ_ARG_ENABLE_BOOL(activex-scripting,
 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
 
 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
 then
     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
 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
         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
     fi
     ;;
 esac
 fi
--- a/js/src/xpconnect/idl/Makefile.in
+++ b/js/src/xpconnect/idl/Makefile.in
@@ -58,22 +58,14 @@ XPIDLSRCS	= \
 		nsIJSContextStack.idl \
 		nsIJSRuntimeService.idl \
 		nsIXPConnect.idl \
 		nsIXPCSecurityManager.idl \
 		nsIXPCScriptable.idl \
 		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
 
--- a/js/src/xpconnect/idl/nsIXPConnect.idl
+++ b/js/src/xpconnect/idl/nsIXPConnect.idl
@@ -132,24 +132,16 @@ class nsWrapperCache;
 #define NS_ERROR_XPC_CALL_TO_SCRIPTABLE_FAILED         GENERATE_XPC_FAILURE(47)
 #define NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED    GENERATE_XPC_FAILURE(48)
 #define NS_ERROR_XPC_BAD_ID_STRING                     GENERATE_XPC_FAILURE(49)
 #define NS_ERROR_XPC_BAD_INITIALIZER_NAME              GENERATE_XPC_FAILURE(50)
 #define NS_ERROR_XPC_HAS_BEEN_SHUTDOWN                 GENERATE_XPC_FAILURE(51)
 #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
 /***************************************************************************/
 %}
 
 /***************************************************************************/
 
 // forward declarations...
 interface nsIXPCScriptable;
--- a/js/src/xpconnect/src/Makefile.in
+++ b/js/src/xpconnect/src/Makefile.in
@@ -88,28 +88,16 @@ CPPSRCS		= \
 		xpcwrappednativejsops.cpp \
 		xpcwrappednativeproto.cpp \
 		xpcwrappednativescope.cpp \
 		xpcJSWeakReference.cpp \
 		XPCWrapper.cpp \
 		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
 
 LOCAL_INCLUDES = \
 		-I$(srcdir)/../wrappers \
 		-I$(srcdir)/../loader \
 		-I$(topsrcdir)/js/src \
 		-I$(topsrcdir)/js/src/nanojit \
@@ -149,24 +137,16 @@ DEFINES += \
   -DFEATURE_NANOJIT=1 \
   $(addprefix -D,$(filter AVMPLUS%,$(CONFIG))) \
   $(NULL)
 
 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)))
 # whole program optimization and precompiled headers are incompatible
 ifeq (,$(findstring GL,$(CXXFLAGS)))
 # use pre-compiled headers
 CXXFLAGS	+= -YX -Fp$(LIBRARY_NAME).pch
 # precompiled headers require write access to .pch which breaks -j builds
--- a/js/src/xpconnect/src/xpc.msg
+++ b/js/src/xpconnect/src/xpc.msg
@@ -157,24 +157,16 @@ XPC_MSG_DEF(NS_ERROR_FILE_ACCESS_DENIED 
 
 /* added from nsError.h on Sept 6 2001... */
 
 XPC_MSG_DEF(NS_ERROR_CANNOT_CONVERT_DATA            , "Data conversion error")
 XPC_MSG_DEF(NS_ERROR_OBJECT_IS_IMMUTABLE            , "Can not modify immutable data container")
 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")
 XPC_MSG_DEF(NS_BINDING_ABORTED                      , "The async request failed because it was aborted by some user action")
 XPC_MSG_DEF(NS_BINDING_REDIRECTED                   , "The async request has been redirected to a different async request")
 XPC_MSG_DEF(NS_BINDING_RETARGETED                   , "The async request has been retargeted to a different handler")
 XPC_MSG_DEF(NS_ERROR_MALFORMED_URI                  , "The URI is malformed")
 XPC_MSG_DEF(NS_ERROR_UNKNOWN_PROTOCOL               , "The URI scheme corresponds to an unknown protocol handler")
--- a/js/src/xpconnect/src/xpccallcontext.cpp
+++ b/js/src/xpconnect/src/xpccallcontext.cpp
@@ -211,19 +211,16 @@ XPCCallContext::Init(XPCContext::LangTyp
 
 void
 XPCCallContext::SetName(jsid name)
 {
     CHECK_STATE(HAVE_OBJECT);
 
     mName = name;
 
-#ifdef XPC_IDISPATCH_SUPPORT
-    mIDispatchMember = nsnull;
-#endif
     if(mTearOff)
     {
         mSet = nsnull;
         mInterface = mTearOff->GetInterface();
         mMember = mInterface->FindMember(name);
         mStaticMemberIsLocal = JS_TRUE;
         if(mMember && !mMember->IsConstant())
             mMethodIndex = mMember->GetIndex();
@@ -269,36 +266,30 @@ XPCCallContext::SetCallInfo(XPCNativeInt
     mSet = nsnull;
     mInterface = iface;
     mMember = member;
     mMethodIndex = mMember->GetIndex() + (isSetter ? 1 : 0);
     mName = mMember->GetName();
 
     if(mState < HAVE_NAME)
         mState = HAVE_NAME;
-#ifdef XPC_IDISPATCH_SUPPORT
-    mIDispatchMember = nsnull;
-#endif
 }
 
 void
 XPCCallContext::SetArgsAndResultPtr(uintN argc,
                                     jsval *argv,
                                     jsval *rval)
 {
     CHECK_STATE(HAVE_OBJECT);
 
     if(mState < HAVE_NAME)
     {
         mSet = nsnull;
         mInterface = nsnull;
         mMember = nsnull;
-#ifdef XPC_IDISPATCH_SUPPORT
-        mIDispatchMember = nsnull;
-#endif
         mStaticMemberIsLocal = JS_FALSE;
     }
 
     mArgc   = argc;
     mArgv   = argv;
     mRetVal = rval;
 
     mReturnValueWasSet = JS_FALSE;
@@ -548,43 +539,16 @@ XPCCallContext::GetReturnValueWasSet(PRB
 }
 NS_IMETHODIMP
 XPCCallContext::SetReturnValueWasSet(PRBool aReturnValueWasSet)
 {
     mReturnValueWasSet = 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<XPCDispInterface::Member*>(member)->GetName();
-
-    if(mState < HAVE_NAME)
-        mState = HAVE_NAME;
-}
-
-#endif
-
 NS_IMETHODIMP
 XPCCallContext::GetPreviousCallContext(nsAXPCNativeCallContext **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = GetPrevCallContext();
   return NS_OK;
 }
 
--- a/js/src/xpconnect/src/xpcforwards.h
+++ b/js/src/xpconnect/src/xpcforwards.h
@@ -96,19 +96,9 @@ class nsXPCComponents_Exception;
 class nsXPCComponents_Constructor;
 class nsXPCComponents_Utils;
 class nsXPCConstructor;
 
 class AutoMarkingPtr;
 
 class xpcProperty;
 
-#ifdef XPC_IDISPATCH_SUPPORT
-class XPCDispInterface;
-struct IDispatch;
-class XPCDispParams;
-class XPCDispJSPropertyInfo;
-class nsIXPConnectWrappedJS;
-class XPCIDispatchExtension;
-#endif
-
-
 #endif /* xpcforwards_h___ */
--- a/js/src/xpconnect/src/xpcinlines.h
+++ b/js/src/xpconnect/src/xpcinlines.h
@@ -266,21 +266,17 @@ XPCCallContext::GetMember() const
 {
     CHECK_STATE(HAVE_NAME);
     return mMember;
 }
 
 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
 XPCCallContext::GetName() const
 {
     CHECK_STATE(HAVE_NAME);
     return mName;
 }
@@ -607,75 +603,29 @@ inline void XPCNativeSet::ASSERT_NotMark
 }
 #endif
 
 /***************************************************************************/
 
 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<XPCDispInterface*>
-                           ((((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
 }
 
 /***************************************************************************/
 
 inline JSBool
 XPCWrappedNative::HasInterfaceNoQI(const nsIID& iid)
 {
     return nsnull != GetSet()->FindInterfaceWithIID(iid);
--- a/js/src/xpconnect/src/xpcmodule.cpp
+++ b/js/src/xpconnect/src/xpcmodule.cpp
@@ -44,26 +44,18 @@
 nsresult
 xpcModuleCtor()
 {
     nsXPConnect::InitStatics();
     nsXPCException::InitStatics();
     XPCWrappedNativeScope::InitStatics();
     XPCPerThreadData::InitStatics();
 
-#ifdef XPC_IDISPATCH_SUPPORT
-    XPCIDispatchExtension::InitStatics();
-#endif
-
     return NS_OK;
 }
 
 void
 xpcModuleDtor()
 {
     // Release our singletons
     nsXPConnect::ReleaseXPConnectSingleton();
     xpc_DestroyJSxIDClassObjects();
-#ifdef XPC_IDISPATCH_SUPPORT
-    nsDispatchSupport::FreeSingleton();
-    XPCIDispatchClassInfo::FreeSingleton();
-#endif
 }
--- a/js/src/xpconnect/src/xpcmodule.h
+++ b/js/src/xpconnect/src/xpcmodule.h
@@ -62,61 +62,44 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCJSCo
 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)
 
-#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);
 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);
-#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 }, \
   { &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 }, \
-  XPCIDISPATCH_CIDS
+  { &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 }, \
-  XPCIDISPATCH_CONTRACTS
+  { MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID },
 
 #define XPCONNECT_CATEGORIES \
   { "module-loader", "js", MOZJSCOMPONENTLOADER_CONTRACTID },
 
 nsresult xpcModuleCtor();
 void xpcModuleDtor();
--- a/js/src/xpconnect/src/xpcprivate.h
+++ b/js/src/xpconnect/src/xpcprivate.h
@@ -125,23 +125,16 @@
 #include "nsIXPCScriptNotify.h"  // used to notify: ScriptEvaluated
 
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIPrincipal.h"
 #include "nsISecurityCheckedComponent.h"
 
 #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 <atlbase.h>
-#include "oaidl.h"
-#endif
-
 #ifdef XP_WIN
 // Nasty MS defines
 #ifdef GetClassInfo
 #undef GetClassInfo
 #endif
 #ifdef GetClassName
 #undef GetClassName
 #endif
@@ -580,20 +573,16 @@ public:
                                     PRBool showThisProps);
 
 
     static PRBool ReportAllJSExceptions()
     {
       return gReportAllJSExceptions > 0;
     }
 
-#ifdef XPC_IDISPATCH_SUPPORT
-public:
-    static PRBool IsIDispatchEnabled();
-#endif
 protected:
     nsXPConnect();
 
 private:
     static PRThread* FindMainThread();
 
 private:
     // Singleton instance
@@ -1107,25 +1096,16 @@ public:
 
     void SystemIsBeingShutDown();
 
     operator JSContext*() const {return GetJSContext();}
 
     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
     XPCCallContext(const XPCCallContext& r); // not implemented
     XPCCallContext& operator= (const XPCCallContext& r); // not implemented
 
     friend class XPCLazyCallContext;
     XPCCallContext(XPCContext::LangType callerLanguage,
@@ -1204,19 +1184,16 @@ private:
     jsid                            mName;
     JSBool                          mStaticMemberIsLocal;
 
     uintN                           mArgc;
     jsval*                          mArgv;
     jsval*                          mRetVal;
 
     JSBool                          mReturnValueWasSet;
-#ifdef XPC_IDISPATCH_SUPPORT
-    void*                           mIDispatchMember;
-#endif
     PRUint16                        mMethodIndex;
 
 #define XPCCCX_STRING_CACHE_SIZE 2
 
     // String wrapper entry, holds a string, and a boolean that tells
     // whether the string is in use or not.
     //
     // NB: The string is not stored by value so that we avoid the cost of
@@ -2357,26 +2334,16 @@ public:
     // NOP. This is just here to make the AutoMarkingPtr code compile.
     inline void TraceJS(JSTracer* trc) {}
     inline void AutoTrace(JSTracer* trc) {}
 
     void Mark()       {mJSObject = (JSObject*)(((jsword)mJSObject) | 1);}
     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
 
 private:
     XPCNativeInterface* mInterface;
     nsISupports*        mNative;
     JSObject*           mJSObject;
@@ -3358,21 +3325,16 @@ XPC_JSArgumentFormatter(JSContext *cx, c
 
 class XPCThrower
 {
 public:
     static void Throw(nsresult rv, JSContext* cx);
     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;}
 
     static void BuildAndThrowException(JSContext* cx, nsresult rv, const char* sz);
     static JSBool CheckForPendingException(nsresult result, JSContext *cx);
 
 private:
     static void Verbosify(XPCCallContext& ccx,
@@ -4499,21 +4461,16 @@ CompartmentParticipatesInCycleCollection
 inline bool
 ParticipatesInCycleCollection(JSContext *cx, js::gc::Cell *cell)
 {
     return CompartmentParticipatesInCycleCollection(cx, cell->compartment());
 }
 
 }
 
-#ifdef XPC_IDISPATCH_SUPPORT
-// IDispatch specific classes
-#include "XPCDispPrivate.h"
-#endif
-
 /***************************************************************************/
 // Inlines use the above - include last.
 
 #include "xpcinlines.h"
 
 /***************************************************************************/
 // Maps have inlines that use the above - include last.
 
--- a/js/src/xpconnect/src/xpcthrower.cpp
+++ b/js/src/xpconnect/src/xpcthrower.cpp
@@ -174,36 +174,17 @@ void
 XPCThrower::Verbosify(XPCCallContext& ccx,
                       char** psz, PRBool own)
 {
     char* sz = nsnull;
 
     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<XPCDispInterface::Member*>(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));
         if(!name)
         {
             name = "";
         }
         sz = JS_smprintf("%s [%s.%s]", *psz, iface->GetNameString(), name);
     }
@@ -334,65 +315,8 @@ XPCThrower::ThrowExceptionObject(JSConte
                     JS_SetPendingException(cx, OBJECT_TO_JSVAL(obj));
                     success = JS_TRUE;
                 }
             }
         }
     }
     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<const char *>
-                          (_bstr_t(exception->bstrSource, false));
-        msg += " : ";
-        msg.AppendInt(static_cast<PRUint32>(COMErrorCode));
-        msg += " - ";
-        msg += static_cast<const char *>
-                          (_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<const char *>(src);
-                msg += " : ";
-            }
-            msg.AppendInt(static_cast<PRUint32>(COMErrorCode), 16);
-            BSTR bstrDesc = NULL;
-            if(SUCCEEDED(pError->GetDescription(&bstrDesc)) && bstrDesc)
-            {
-                msg += " - ";
-                _bstr_t desc(bstrDesc, false);
-                msg += static_cast<const char *>(desc);
-            }
-        }
-        else
-        {
-            // No error object, so just report the result
-            msg += "COM Error Result = ";
-            msg.AppendInt(static_cast<PRUint32>(COMErrorCode), 16);
-        }
-    }
-    XPCThrower::BuildAndThrowException(cx, rv, msg.get());
-}
-
-#endif
--- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp
+++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp
@@ -656,23 +656,16 @@ nsXPCWrappedJSClass::DelegatedQueryInter
     // to ask for this iid. And none of them bother refcounting the thing.
     if(aIID.Equals(NS_GET_IID(WrappedJSIdentity)))
     {
         // asking to find out if this is a wrapper object
         *aInstancePtr = WrappedJSIdentity::GetSingleton();
         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.
         nsXPCWrappedJS* root = self->GetRootWrapper();
 
         if(!root->IsValid())
         {
             *aInstancePtr = nsnull;
--- a/js/src/xpconnect/src/xpcwrappednative.cpp
+++ b/js/src/xpconnect/src/xpcwrappednative.cpp
@@ -351,30 +351,17 @@ XPCWrappedNative::GetNewOrUsed(XPCCallCo
                  "We assume the caller already checked if it could get the "
                  "wrapper from the cache.");
 
     nsresult rv;
 
     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)
     {
         NS_ERROR("This XPCOM object fails in QueryInterface to nsISupports!");
         return NS_ERROR_FAILURE;
     }
 
     XPCLock* mapLock = Scope->GetRuntime()->GetMapLock();
@@ -430,28 +417,16 @@ XPCWrappedNative::GetNewOrUsed(XPCCallCo
     // If we are making a wrapper for the nsIClassInfo interface then
     // We *don't* want to have it use the prototype meant for instances
     // of that class.
     JSBool isClassInfo = Interface &&
                          Interface->GetIID()->Equals(NS_GET_IID(nsIClassInfo));
 
     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<nsIClassInfo> dispatchInfo;
-    if(isIDispatch && !info)
-    {
-        dispatchInfo = dont_AddRef(static_cast<nsIClassInfo*>
-                                      (XPCIDispatchClassInfo::GetSingleton()));
-        info = dispatchInfo;
-    }
-#endif
-
     XPCNativeScriptableCreateInfo sciProto;
     XPCNativeScriptableCreateInfo sci;
 
     // Gather scriptable create info if we are wrapping something
     // other than an nsIClassInfo object. We need to not do this for
     // nsIClassInfo objects because often nsIClassInfo implementations
     // are also nsIXPCScriptable helper implementations, but the helper
     // code is obviously intended for the implementation of the class
@@ -840,24 +815,17 @@ XPCWrappedNative::GetUsedOnly(XPCCallCon
         {
             *resultWrapper = nsnull;
             return NS_OK;
         }
         NS_ADDREF(wrapper);
     }
     else
     {
-        nsCOMPtr<nsISupports> 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<nsISupports> identity = do_QueryInterface(Object);
 
         if(!identity)
         {
             NS_ERROR("This XPCOM object fails in QueryInterface to nsISupports!");
             return NS_ERROR_FAILURE;
         }
 
         Native2WrappedNativeMap* map = Scope->GetWrappedNativeMap();
@@ -1461,20 +1429,16 @@ XPCWrappedNative::SystemIsBeingShutDown(
     for(chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk)
     {
         XPCWrappedNativeTearOff* to = chunk->mTearOffs;
         for(int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++)
         {
             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
             // (for the same reason we leak mIdentity - see above).
             to->SetNative(nsnull);
             to->SetInterface(nsnull);
         }
     }
@@ -2169,23 +2133,16 @@ XPCWrappedNative::InitTearOff(XPCCallCon
     {
         NS_RELEASE(obj);
         aTearOff->SetInterface(nsnull);
         return NS_ERROR_NO_INTERFACE;
     }
 
     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;
 
     return NS_OK;
 }
 
 JSBool
 XPCWrappedNative::InitTearOffJSObject(XPCCallContext& ccx,
--- a/js/src/xpconnect/src/xpcwrappednativejsops.cpp
+++ b/js/src/xpconnect/src/xpcwrappednativejsops.cpp
@@ -401,24 +401,16 @@ DefinePropertyIfFound(XPCCallContext& cc
             if(resolved)
                 *resolved = JS_TRUE;
             return JS_DefinePropertyById(ccx, obj, id, JSVAL_VOID,
                                          JS_DATA_TO_FUNC_PTR(JSPropertyOp,
                                                              funobj),
                                          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;
     }
 
     if(!member)
     {
         if(wrapperToReflectInterfaceNames)
@@ -629,23 +621,16 @@ XPC_WN_Shared_Enumerate(JSContext *cx, J
     XPCNativeSet* protoSet = wrapper->HasProto() ?
                                 wrapper->GetProto()->GetSet() : nsnull;
 
     PRUint16 interface_count = set->GetInterfaceCount();
     XPCNativeInterface** interfaceArray = set->GetInterfaceArray();
     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++)
         {
             XPCNativeMember* member = iface->GetMemberAt(k);
             jsid name = member->GetName();
 
             // Skip if this member is going to come from the proto.
             PRUint16 index;