Bug 1477432 - Part 8: Remove test-only Components.classesById and Components.interfacesById, r=mccr8
authorNika Layzell <nika@thelayzells.com>
Wed, 18 Jul 2018 22:06:44 -0400
changeset 446903 1ddcdfc06526ffa9a997987ae7a2cfff320c00e9
parent 446902 a68bee9d2168c514ea485deba6c2624934a1c79f
child 446904 3439b17bdc2a1bf5626355d529c9a3decf3843be
push id35053
push userapavel@mozilla.com
push dateSat, 17 Nov 2018 11:27:54 +0000
treeherdermozilla-central@e4deec61fc8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1477432
milestone65.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
Bug 1477432 - Part 8: Remove test-only Components.classesById and Components.interfacesById, r=mccr8 These two interfaces are effectively never used, so to avoid needing to support ClassID2JSValue with the new implementation, I remove them entirely. Differential Revision: https://phabricator.services.mozilla.com/D2285
js/xpconnect/idl/xpccomponents.idl
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCForwards.h
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/src/xpcpublic.h
js/xpconnect/tests/unit/test_bug677864.js
js/xpconnect/tests/unit/test_classesByID_instanceof.js
js/xpconnect/tests/unit/test_import.js
js/xpconnect/tests/unit/xpcshell.ini
toolkit/components/search/tests/xpcshell/head_search.js
xpcom/tests/unit/test_bug656331.js
--- a/js/xpconnect/idl/xpccomponents.idl
+++ b/js/xpconnect/idl/xpccomponents.idl
@@ -20,25 +20,16 @@ interface nsIFile;
 interface nsILoadContext;
 interface nsIPersistentProperties;
 interface nsIURI;
 interface nsIPrincipal;
 interface nsIStackFrame;
 webidl Element;
 
 /**
-* interface of Components.interfacesByID
-* (interesting stuff only reflected into JavaScript)
-*/
-[scriptable, builtinclass, uuid(f235ef76-9919-478b-aa0f-282d994ddf76)]
-interface nsIXPCComponents_InterfacesByID : nsISupports
-{
-};
-
-/**
 * interface of Components.interfaces
 * (interesting stuff only reflected into JavaScript)
 */
 [scriptable, builtinclass, uuid(b8c31bba-79db-4a1d-930d-4cdd68713f9e)]
 interface nsIXPCComponents_Interfaces : nsISupports
 {
 };
 
@@ -47,25 +38,16 @@ interface nsIXPCComponents_Interfaces : 
 * (interesting stuff only reflected into JavaScript)
 */
 [scriptable, builtinclass, uuid(978ff520-d26c-11d2-9842-006008962422)]
 interface nsIXPCComponents_Classes : nsISupports
 {
 };
 
 /**
-* interface of Components.classesByID
-* (interesting stuff only reflected into JavaScript)
-*/
-[scriptable, builtinclass, uuid(336a9590-4d19-11d3-9893-006008962422)]
-interface nsIXPCComponents_ClassesByID : nsISupports
-{
-};
-
-/**
 * interface of Components.results
 * (interesting stuff only reflected into JavaScript)
 */
 [scriptable, builtinclass, uuid(2fc229a0-5860-11d3-9899-006008962422)]
 interface nsIXPCComponents_Results : nsISupports
 {
 };
 
@@ -749,28 +731,26 @@ interface nsIXPCComponents_Utils : nsISu
 * that runs in a scope with an ExpandedPrincipal. The second interface
 * includes members that are only exposed to chrome.
 */
 
 [scriptable, builtinclass, uuid(eeeada2f-86c0-4609-b2bf-4bf2351b1ce6)]
 interface nsIXPCComponentsBase : nsISupports
 {
     readonly attribute nsIXPCComponents_Interfaces      interfaces;
-    readonly attribute nsIXPCComponents_InterfacesByID  interfacesByID;
     readonly attribute nsIXPCComponents_Results         results;
 
     boolean isSuccessCode(in nsresult result);
 
 };
 
 [scriptable, builtinclass, uuid(aa28aaf6-70ce-4b03-9514-afe43c7dfda8)]
 interface nsIXPCComponents : nsIXPCComponentsBase
 {
     readonly attribute nsIXPCComponents_Classes         classes;
-    readonly attribute nsIXPCComponents_ClassesByID     classesByID;
     // Will return null if there is no JS stack right now.
     readonly attribute nsIStackFrame                    stack;
     readonly attribute nsIComponentManager              manager;
     readonly attribute nsIXPCComponents_Utils           utils;
 
     readonly attribute nsIXPCComponents_ID              ID;
     readonly attribute nsIXPCComponents_Exception       Exception;
     readonly attribute nsIXPCComponents_Constructor     Constructor;
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -281,198 +281,16 @@ nsXPCComponents_Interfaces::Resolve(nsIX
     }
     return NS_OK;
 }
 
 /***************************************************************************/
 /***************************************************************************/
 /***************************************************************************/
 
-class nsXPCComponents_InterfacesByID final :
-            public nsIXPCComponents_InterfacesByID,
-            public nsIXPCScriptable,
-            public nsIClassInfo
-{
-public:
-    // all the interface method declarations...
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIXPCCOMPONENTS_INTERFACESBYID
-    NS_DECL_NSIXPCSCRIPTABLE
-    NS_DECL_NSICLASSINFO
-
-public:
-    nsXPCComponents_InterfacesByID();
-
-private:
-    virtual ~nsXPCComponents_InterfacesByID();
-};
-
-/***************************************************************************/
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetInterfaces(uint32_t* aCount, nsIID * **aArray)
-{
-    *aCount = 2;
-    nsIID** array = static_cast<nsIID**>(moz_xmalloc(2 * sizeof(nsIID*)));
-    *aArray = array;
-
-    array[0] = NS_GET_IID(nsIXPCComponents_InterfacesByID).Clone();
-    array[1] = NS_GET_IID(nsIXPCScriptable).Clone();
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetScriptableHelper(nsIXPCScriptable** retval)
-{
-    *retval = nullptr;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetContractID(nsACString& aContractID)
-{
-    aContractID.SetIsVoid(true);
-    return NS_ERROR_NOT_AVAILABLE;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetClassDescription(
-    nsACString& aClassDescription)
-{
-    aClassDescription.AssignLiteral("XPCComponents_InterfacesByID");
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetClassID(nsCID * *aClassID)
-{
-    *aClassID = nullptr;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetFlags(uint32_t* aFlags)
-{
-    *aFlags = 0;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::GetClassIDNoAlloc(nsCID* aClassIDNoAlloc)
-{
-    return NS_ERROR_NOT_AVAILABLE;
-}
-
-nsXPCComponents_InterfacesByID::nsXPCComponents_InterfacesByID()
-{
-}
-
-nsXPCComponents_InterfacesByID::~nsXPCComponents_InterfacesByID()
-{
-    // empty
-}
-
-NS_IMPL_ISUPPORTS(nsXPCComponents_InterfacesByID,
-                  nsIXPCComponents_InterfacesByID,
-                  nsIXPCScriptable,
-                  nsIClassInfo)
-
-// The nsIXPCScriptable map declaration that will generate stubs for us...
-#define XPC_MAP_CLASSNAME         nsXPCComponents_InterfacesByID
-#define XPC_MAP_QUOTED_CLASSNAME "nsXPCComponents_InterfacesByID"
-#define XPC_MAP_FLAGS (XPC_SCRIPTABLE_WANT_RESOLVE | \
-                       XPC_SCRIPTABLE_WANT_NEWENUMERATE | \
-                       XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE)
-#include "xpc_map_end.h" /* This will #undef the above */
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::NewEnumerate(nsIXPConnectWrappedNative* wrapper,
-                                             JSContext* cx, JSObject* obj,
-                                             JS::AutoIdVector& properties,
-                                             bool enumerableOnly,
-                                             bool* _retval)
-{
-
-    if (!properties.reserve(nsXPTInterfaceInfo::InterfaceCount())) {
-        *_retval = false;
-        return NS_OK;
-    }
-
-    for (uint32_t index = 0; index < nsXPTInterfaceInfo::InterfaceCount(); index++) {
-        const nsXPTInterfaceInfo* interface = nsXPTInterfaceInfo::ByIndex(index);
-        if (!interface) {
-            continue;
-        }
-
-        char idstr[NSID_LENGTH];
-        interface->IID().ToProvidedString(idstr);
-        RootedString jsstr(cx, JS_NewStringCopyZ(cx, idstr));
-        if (!jsstr) {
-            *_retval = false;
-            return NS_OK;
-        }
-
-        RootedId id(cx);
-        if (!JS_StringToId(cx, jsstr, &id)) {
-            *_retval = false;
-            return NS_OK;
-        }
-
-        properties.infallibleAppend(id);
-    }
-
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_InterfacesByID::Resolve(nsIXPConnectWrappedNative* wrapper,
-                                        JSContext* cx, JSObject* objArg,
-                                        jsid idArg, bool* resolvedp,
-                                        bool* _retval)
-{
-    RootedObject obj(cx, objArg);
-    RootedId id(cx, idArg);
-
-    if (!JSID_IS_STRING(id)) {
-        return NS_OK;
-    }
-
-    RootedString str(cx, JSID_TO_STRING(id));
-    if (38 != JS_GetStringLength(str)) {
-        return NS_OK;
-    }
-
-    JS::UniqueChars utf8str = JS_EncodeStringToUTF8(cx, str);
-    if (utf8str) {
-        nsID iid;
-        if (!iid.Parse(utf8str.get())) {
-            return NS_OK;
-        }
-
-        const nsXPTInterfaceInfo* info = nsXPTInterfaceInfo::ByIID(iid);
-        if (!info) {
-            return NS_OK;
-        }
-
-        RootedValue iidv(cx);
-        if (xpc::IfaceID2JSValue(cx, *info, &iidv)) {
-            *resolvedp = true;
-            *_retval = JS_DefinePropertyById(cx, obj, id, iidv,
-                                             JSPROP_ENUMERATE |
-                                             JSPROP_READONLY |
-                                             JSPROP_PERMANENT |
-                                             JSPROP_RESOLVING);
-        }
-    }
-    return NS_OK;
-}
-
-/***************************************************************************/
-/***************************************************************************/
-/***************************************************************************/
-
 
 
 class nsXPCComponents_Classes final :
   public nsIXPCComponents_Classes,
   public nsIXPCScriptable,
   public nsIClassInfo
 {
 public:
@@ -643,210 +461,16 @@ nsXPCComponents_Classes::Resolve(nsIXPCo
     return NS_OK;
 }
 
 
 /***************************************************************************/
 /***************************************************************************/
 /***************************************************************************/
 
-class nsXPCComponents_ClassesByID final :
-  public nsIXPCComponents_ClassesByID,
-  public nsIXPCScriptable,
-  public nsIClassInfo
-{
-public:
-    // all the interface method declarations...
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIXPCCOMPONENTS_CLASSESBYID
-    NS_DECL_NSIXPCSCRIPTABLE
-    NS_DECL_NSICLASSINFO
-
-public:
-    nsXPCComponents_ClassesByID();
-
-private:
-    virtual ~nsXPCComponents_ClassesByID();
-};
-
-/***************************************************************************/
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetInterfaces(uint32_t* aCount, nsIID * **aArray)
-{
-    *aCount = 2;
-    nsIID** array = static_cast<nsIID**>(moz_xmalloc(2 * sizeof(nsIID*)));
-    *aArray = array;
-
-    array[0] = NS_GET_IID(nsIXPCComponents_ClassesByID).Clone();
-    array[1] = NS_GET_IID(nsIXPCScriptable).Clone();
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetScriptableHelper(nsIXPCScriptable** retval)
-{
-    *retval = nullptr;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetContractID(nsACString& aContractID)
-{
-    aContractID.SetIsVoid(true);
-    return NS_ERROR_NOT_AVAILABLE;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetClassDescription(nsACString& aClassDescription)
-{
-    aClassDescription.AssignLiteral("XPCComponents_ClassesByID");
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetClassID(nsCID * *aClassID)
-{
-    *aClassID = nullptr;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetFlags(uint32_t* aFlags)
-{
-    *aFlags = 0;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::GetClassIDNoAlloc(nsCID* aClassIDNoAlloc)
-{
-    return NS_ERROR_NOT_AVAILABLE;
-}
-
-nsXPCComponents_ClassesByID::nsXPCComponents_ClassesByID()
-{
-}
-
-nsXPCComponents_ClassesByID::~nsXPCComponents_ClassesByID()
-{
-    // empty
-}
-
-NS_IMPL_ISUPPORTS(nsXPCComponents_ClassesByID,
-                  nsIXPCComponents_ClassesByID,
-                  nsIXPCScriptable,
-                  nsIClassInfo)
-
-// The nsIXPCScriptable map declaration that will generate stubs for us...
-#define XPC_MAP_CLASSNAME         nsXPCComponents_ClassesByID
-#define XPC_MAP_QUOTED_CLASSNAME "nsXPCComponents_ClassesByID"
-#define XPC_MAP_FLAGS (XPC_SCRIPTABLE_WANT_RESOLVE | \
-                       XPC_SCRIPTABLE_WANT_NEWENUMERATE | \
-                       XPC_SCRIPTABLE_ALLOW_PROP_MODS_DURING_RESOLVE)
-#include "xpc_map_end.h" /* This will #undef the above */
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::NewEnumerate(nsIXPConnectWrappedNative* wrapper,
-                                          JSContext* cx, JSObject* obj,
-                                          JS::AutoIdVector& properties,
-                                          bool enumerableOnly,
-                                          bool* _retval)
-{
-
-    nsCOMPtr<nsIComponentRegistrar> compMgr;
-    if (NS_FAILED(NS_GetComponentRegistrar(getter_AddRefs(compMgr))) || !compMgr) {
-        return NS_ERROR_UNEXPECTED;
-    }
-
-    nsISimpleEnumerator* e;
-    if (NS_FAILED(compMgr->EnumerateCIDs(&e)) || !e) {
-        return NS_ERROR_UNEXPECTED;
-    }
-
-    bool hasMore;
-    nsCOMPtr<nsISupports> isup;
-    while(NS_SUCCEEDED(e->HasMoreElements(&hasMore)) && hasMore &&
-          NS_SUCCEEDED(e->GetNext(getter_AddRefs(isup))) && isup) {
-        nsCOMPtr<nsISupportsID> holder(do_QueryInterface(isup));
-        if (!holder) {
-            continue;
-        }
-
-        char* name;
-        if (NS_SUCCEEDED(holder->ToString(&name)) && name) {
-            RootedString idstr(cx, JS_NewStringCopyZ(cx, name));
-            if (!idstr) {
-                *_retval = false;
-                return NS_OK;
-            }
-
-            RootedId id(cx);
-            if (!JS_StringToId(cx, idstr, &id)) {
-                *_retval = false;
-                return NS_OK;
-            }
-
-            if (!properties.append(id)) {
-                *_retval = false;
-                return NS_OK;
-            }
-        }
-    }
-
-    return NS_OK;
-}
-
-static bool
-IsRegisteredCLSID(const nsCID& aCID)
-{
-    bool registered = false;
-    nsCOMPtr<nsIComponentRegistrar> compMgr;
-    if (NS_FAILED(NS_GetComponentRegistrar(getter_AddRefs(compMgr))) || !compMgr ||
-        NS_FAILED(compMgr->IsCIDRegistered(aCID, &registered)))
-        return false;
-
-    return registered;
-}
-
-NS_IMETHODIMP
-nsXPCComponents_ClassesByID::Resolve(nsIXPConnectWrappedNative* wrapper,
-                                     JSContext* cx, JSObject* objArg,
-                                     jsid idArg, bool* resolvedp,
-                                     bool* _retval)
-{
-    RootedObject obj(cx, objArg);
-    RootedId id(cx, idArg);
-
-    if (!JSID_IS_STRING(id)) {
-        return NS_OK;
-    }
-
-    // we only allow canonical CLSIDs here
-    nsCID cid;
-    JSAutoByteString name;
-    RootedString str(cx, JSID_TO_STRING(id));
-    if (name.encodeLatin1(cx, str) && name.ptr()[0] == '{' &&
-        cid.Parse(name.ptr()) && IsRegisteredCLSID(cid))
-    {
-        RootedValue cidv(cx);
-        if (xpc::ClassID2JSValue(cx, cid, &cidv)) {
-            *resolvedp = true;
-            *_retval = JS_DefinePropertyById(cx, obj, id, cidv,
-                                             JSPROP_ENUMERATE |
-                                             JSPROP_READONLY |
-                                             JSPROP_PERMANENT |
-                                             JSPROP_RESOLVING);
-        }
-    }
-    return NS_OK;
-}
-
-
-/***************************************************************************/
-
 // Currently the possible results do not change at runtime, so they are only
 // cached once (unlike ContractIDs, CLSIDs, and IIDs)
 
 class nsXPCComponents_Results final :
   public nsIXPCComponents_Results,
   public nsIXPCScriptable,
   public nsIClassInfo
 {
@@ -3118,25 +2742,23 @@ nsXPCComponentsBase::~nsXPCComponentsBas
 nsXPCComponents::~nsXPCComponents()
 {
 }
 
 void
 nsXPCComponentsBase::ClearMembers()
 {
     mInterfaces = nullptr;
-    mInterfacesByID = nullptr;
     mResults = nullptr;
 }
 
 void
 nsXPCComponents::ClearMembers()
 {
     mClasses = nullptr;
-    mClassesByID = nullptr;
     mID = nullptr;
     mException = nullptr;
     mConstructor = nullptr;
     mUtils = nullptr;
 
     nsXPCComponentsBase::ClearMembers();
 }
 
@@ -3147,19 +2769,17 @@ NS_IMETHODIMP _class::Get##_n(nsIXPCComp
     if (!m##_n)                                                               \
         m##_n = new nsXPCComponents_##_n();                                   \
     RefPtr<nsXPCComponents_##_n> ret = m##_n;                               \
     ret.forget(a##_n);                                                        \
     return NS_OK;                                                             \
 }
 
 XPC_IMPL_GET_OBJ_METHOD(nsXPCComponentsBase, Interfaces)
-XPC_IMPL_GET_OBJ_METHOD(nsXPCComponentsBase, InterfacesByID)
 XPC_IMPL_GET_OBJ_METHOD(nsXPCComponents, Classes)
-XPC_IMPL_GET_OBJ_METHOD(nsXPCComponents, ClassesByID)
 XPC_IMPL_GET_OBJ_METHOD(nsXPCComponentsBase, Results)
 XPC_IMPL_GET_OBJ_METHOD(nsXPCComponents, ID)
 XPC_IMPL_GET_OBJ_METHOD(nsXPCComponents, Exception)
 XPC_IMPL_GET_OBJ_METHOD(nsXPCComponents, Constructor)
 XPC_IMPL_GET_OBJ_METHOD(nsXPCComponents, Utils)
 
 #undef XPC_IMPL_GET_OBJ_METHOD
 /*******************************************/
--- a/js/xpconnect/src/XPCForwards.h
+++ b/js/xpconnect/src/XPCForwards.h
@@ -39,19 +39,17 @@ class IID2NativeInterfaceMap;
 class ClassInfo2NativeSetMap;
 class ClassInfo2WrappedNativeProtoMap;
 class NativeSetMap;
 class XPCWrappedNativeProtoMap;
 class JSObject2JSObjectMap;
 
 class nsXPCComponents;
 class nsXPCComponents_Interfaces;
-class nsXPCComponents_InterfacesByID;
 class nsXPCComponents_Classes;
-class nsXPCComponents_ClassesByID;
 class nsXPCComponents_Results;
 class nsXPCComponents_ID;
 class nsXPCComponents_Exception;
 class nsXPCComponents_Constructor;
 class nsXPCComponents_Utils;
 
 class AutoMarkingPtr;
 
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -825,27 +825,16 @@ IfaceID2JSValue(JSContext* aCx, const ns
                 JS::MutableHandleValue aVal)
 {
     nsCOMPtr<nsIJSIID> jsid = nsJSIID::NewID(&aInfo);
     return jsid && NS_SUCCEEDED(
         nsContentUtils::WrapNative(aCx, jsid, &NS_GET_IID(nsIJSIID), aVal));
 }
 
 bool
-ClassID2JSValue(JSContext* aCx, const nsCID& aId, JS::MutableHandleValue aVal)
-{
-    char idstr[NSID_LENGTH];
-    aId.ToProvidedString(idstr);
-
-    nsCOMPtr<nsIJSCID> jsid = nsJSCID::NewID(idstr);
-    return jsid && NS_SUCCEEDED(
-        nsContentUtils::WrapNative(aCx, jsid, &NS_GET_IID(nsIJSCID), aVal));
-}
-
-bool
 ContractID2JSValue(JSContext* aCx, const nsACString& aContract,
                    JS::MutableHandleValue aVal)
 {
     if (aContract.IsEmpty() || aContract.First() == '{') {
         return false;
     }
 
     nsCOMPtr<nsIJSCID> jsid =
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -2252,17 +2252,16 @@ protected:
 
     explicit nsXPCComponentsBase(XPCWrappedNativeScope* aScope);
     virtual void ClearMembers();
 
     XPCWrappedNativeScope*                   mScope;
 
     // Unprivileged members from nsIXPCComponentsBase.
     RefPtr<nsXPCComponents_Interfaces>     mInterfaces;
-    RefPtr<nsXPCComponents_InterfacesByID> mInterfacesByID;
     RefPtr<nsXPCComponents_Results>        mResults;
 
     friend class XPCWrappedNativeScope;
 };
 
 class nsXPCComponents : public nsXPCComponentsBase,
                         public nsIXPCComponents
 {
@@ -2273,17 +2272,16 @@ public:
 
 protected:
     explicit nsXPCComponents(XPCWrappedNativeScope* aScope);
     virtual ~nsXPCComponents();
     virtual void ClearMembers() override;
 
     // Privileged members added by nsIXPCComponents.
     RefPtr<nsXPCComponents_Classes>     mClasses;
-    RefPtr<nsXPCComponents_ClassesByID> mClassesByID;
     RefPtr<nsXPCComponents_ID>          mID;
     RefPtr<nsXPCComponents_Exception>   mException;
     RefPtr<nsXPCComponents_Constructor> mConstructor;
     RefPtr<nsXPCComponents_Utils>       mUtils;
 
     friend class XPCWrappedNativeScope;
 };
 
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -754,27 +754,16 @@ bool ID2JSValue(JSContext* aCx, const ns
  * 'instanceof', in addition to the other methods available on JS ID objects.
  *
  * Use 'xpc::JSValue2ID' to unwrap JS::Values created with this function.
  */
 bool IfaceID2JSValue(JSContext* aCx, const nsXPTInterfaceInfo& aInfo,
                      JS::MutableHandleValue aVal);
 
 /**
- * Reflect a ClassID into JS
- *
- * This object will expose 'getService' and 'createInstance' methods in addition
- * to the other methods avaliable on nsID objects.
- *
- * Use 'xpc::JSValue2ID' to unwrap JS::Values created with this function.
- */
-bool ClassID2JSValue(JSContext* aCx, const nsCID& aId,
-                     JS::MutableHandleValue aVal);
-
-/**
  * Reflect a ContractID into JS
  *
  * This object will expose 'getService' and 'createInstance' methods in addition
  * to the other methods available on nsID objects.
  *
  * Use 'xpc::JSValue2ID' to unwrap JS::Values created with this function.
  */
 bool ContractID2JSValue(JSContext* aCx, const nsACString& aContract,
--- a/js/xpconnect/tests/unit/test_bug677864.js
+++ b/js/xpconnect/tests/unit/test_bug677864.js
@@ -1,11 +1,9 @@
 function check_cl(iface, desc) {
     Assert.equal(iface.QueryInterface(Ci.nsIClassInfo).classDescription, desc);
 }
 
 function run_test() {
     check_cl(Ci, 'XPCComponents_Interfaces');
-    check_cl(Components.interfacesByID, 'XPCComponents_InterfacesByID');
     check_cl(Cc, 'XPCComponents_Classes');
-    check_cl(Components.classesByID, 'XPCComponents_ClassesByID');
     check_cl(Cr, 'XPCComponents_Results');
 }
deleted file mode 100644
--- a/js/xpconnect/tests/unit/test_classesByID_instanceof.js
+++ /dev/null
@@ -1,86 +0,0 @@
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
-registerCleanupFunction(() => {
-  Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
-});
-
-function testActual(CSPContextClassByID)
-{
-  var cspContext =
-    Cc["@mozilla.org/cspcontext;1"].createInstance();
-
-  Assert.equal(cspContext instanceof CSPContextClassByID, true);
-}
-
-function testInherited(CSPContextClassByID)
-{
-  var cspContext =
-    Cc["@mozilla.org/cspcontext;1"].createInstance();
-
-  var inherited = Object.create(cspContext);
-
-  Assert.equal(inherited instanceof CSPContextClassByID, true);
-}
-
-function testInheritedCrossGlobal(CSPContextClassByID)
-{
-  var cspContext =
-    Cc["@mozilla.org/cspcontext;1"].createInstance();
-
-  var sb = new Cu.Sandbox(this, { wantComponents: true });
-  var inheritedCross = sb.Object.create(cspContext);
-
-  Assert.equal(inheritedCross instanceof CSPContextClassByID, true);
-}
-
-function testCrossGlobalArbitraryGetPrototype(CSPContextClassByID)
-{
-  var cspContext =
-    Cc["@mozilla.org/cspcontext;1"].createInstance();
-
-  var sb = new Cu.Sandbox(this, { wantComponents: true });
-  var firstLevel = Object.create(cspContext);
-
-  var obj = { shouldThrow: false };
-  var secondLevel =
-    new sb.Proxy(Object.create(firstLevel),
-                 {
-                   getPrototypeOf: new sb.Function("obj", `return function(t) {
-                     if (obj.shouldThrow)
-                       throw 42;
-                     return Reflect.getPrototypeOf(t);
-                   };`)(obj)
-                 });
-  var thirdLevel = Object.create(secondLevel);
-
-  obj.shouldThrow = true;
-
-  var threw = false;
-  var err;
-  try
-  {
-    void (thirdLevel instanceof CSPContextClassByID);
-  }
-  catch (e)
-  {
-    threw = true;
-    err = e;
-  }
-
-  Assert.equal(threw, true);
-  Assert.equal(err, 42);
-
-  obj.shouldThrow = false;
-
-  Assert.equal(thirdLevel instanceof CSPContextClassByID, true);
-}
-
-function run_test() {
-  var CSPContextClassByID = Components.classesByID["{09d9ed1a-e5d4-4004-bfe0-27ceb923d9ac}"];
-
-  testActual(CSPContextClassByID);
-  testInherited(CSPContextClassByID);
-  testInheritedCrossGlobal(CSPContextClassByID);
-  testCrossGlobalArbitraryGetPrototype(CSPContextClassByID);
-}
--- a/js/xpconnect/tests/unit/test_import.js
+++ b/js/xpconnect/tests/unit/test_import.js
@@ -67,22 +67,15 @@ function run_test() {
 
   // Call getInterfaces to test line numbers in JS components.  But as long as
   // we're doing that, why not test what it returns too?
   // Kind of odd that this is not returning an array containing the
   // number... Or for that matter not returning an array containing an object?
   var interfaces = foo.getInterfaces({});
   Assert.equal(interfaces, Ci.nsIClassInfo.number);
 
-  // try to create a component by CID
-  const cid = "{6b933fe6-6eba-4622-ac86-e4f654f1b474}";
-  Assert.ok(cid in Components.classesByID);
-  foo = Components.classesByID[cid]
-                  .createInstance(Ci.nsIClassInfo);
-  Assert.ok(foo.contractID == contractID + "1");
-
   // try to create another component which doesn't directly implement QI
   Assert.ok((contractID + "2") in Cc);
   var bar = Cc[contractID + "2"]
               .createInstance(Ci.nsIClassInfo);
   Assert.ok(Boolean(bar));
   Assert.ok(bar.contractID == contractID + "2");
 }
--- a/js/xpconnect/tests/unit/xpcshell.ini
+++ b/js/xpconnect/tests/unit/xpcshell.ini
@@ -60,17 +60,16 @@ support-files =
 [test_bug1150106.js]
 [test_bug1150771.js]
 [test_bug1151385.js]
 [test_bug1170311.js]
 [test_bug1244222.js]
 [test_bug_442086.js]
 [test_callFunctionWithAsyncStack.js]
 [test_cenums.js]
-[test_classesByID_instanceof.js]
 [test_compileScript.js]
 [test_deepFreezeClone.js]
 [test_defineModuleGetter.js]
 [test_file.js]
 [test_blob.js]
 [test_blob2.js]
 [test_file2.js]
 [test_getCallerLocation.js]
--- a/toolkit/components/search/tests/xpcshell/head_search.js
+++ b/toolkit/components/search/tests/xpcshell/head_search.js
@@ -20,18 +20,17 @@ const MODE_RDONLY = FileUtils.MODE_RDONL
 const MODE_WRONLY = FileUtils.MODE_WRONLY;
 const MODE_CREATE = FileUtils.MODE_CREATE;
 const MODE_TRUNCATE = FileUtils.MODE_TRUNCATE;
 
 const CACHE_FILENAME = "search.json.mozlz4";
 
 // nsSearchService.js uses Services.appinfo.name to build a salt for a hash.
 // eslint-disable-next-line mozilla/use-services
-var XULRuntime = Components.classesByID["{95d89e3e-a169-41a3-8e56-719978e15b12}"]
-                           .getService(Ci.nsIXULRuntime);
+var XULRuntime = Cc["@mozilla.org/xre/runtime;1"].getService(Ci.nsIXULRuntime);
 
 var isChild = XULRuntime.processType == XULRuntime.PROCESS_TYPE_CONTENT;
 
 updateAppInfo({
   name: "XPCShell",
   ID: "xpcshell@test.mozilla.org",
   version: "5",
   platformVersion: "1.9",
deleted file mode 100644
--- a/xpcom/tests/unit/test_bug656331.js
+++ /dev/null
@@ -1,36 +0,0 @@
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-
-/* global registerAppManifest */
-
-function info(s) {
-  dump("TEST-INFO | test_bug656331.js | " + s + "\n");
-}
-
-var gMessageExpected = /Native module.*has version 3.*expected/;
-var gFound = false;
-
-const kConsoleListener = {
-  QueryInterface: ChromeUtils.generateQI([Ci.nsIConsoleListener]),
-
-  observe: function listener_observe(message) {
-    if (gMessageExpected.test(message.message))
-      gFound = true;
-  },
-};
-
-function run_test() {
-  Services.console.registerListener(kConsoleListener);
-
-  let manifest = do_get_file("components/bug656331.manifest");
-  registerAppManifest(manifest);
-
-  Assert.equal(false, "{f18fb09b-28b4-4435-bc5b-8027f18df743}" in Components.classesByID);
-
-  do_test_pending();
-  Services.tm.dispatchToMainThread(function() {
-    Services.console.unregisterListener(kConsoleListener);
-    Assert.ok(gFound);
-    do_test_finished();
-  });
-}