Bug 1251655 - Remove support for JavaScript-DOM-class and JavaScript-DOM-interface. r=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Sun, 14 Feb 2016 15:59:48 +0100
changeset 324167 9ed6e0039901b943c48f7e9eac6d61d28a923980
parent 324166 d8bb98d26a6a8fb44ea6004f2f1dbe775ed085c8
child 324168 cc2fbc172cc03f2a84c7f6b0442c34276acd057b
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1251655
milestone47.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 1251655 - Remove support for JavaScript-DOM-class and JavaScript-DOM-interface. r=bz.
dom/base/moz.build
dom/base/nsContentUtils.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsDOMClassInfoID.h
dom/base/nsDOMScriptObjectFactory.cpp
dom/base/nsDOMScriptObjectFactory.h
dom/base/nsFrameMessageManager.cpp
dom/base/nsIDOMClassInfo.h
dom/base/nsIDOMScriptObjectFactory.h
dom/base/nsIScriptNameSpaceManager.h
dom/base/nsJSEnvironment.cpp
dom/base/nsScriptNameSpaceManager.cpp
dom/base/nsScriptNameSpaceManager.h
dom/xbl/nsBindingManager.cpp
dom/xbl/nsXBLDocumentInfo.cpp
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xul/nsXULPrototypeCache.cpp
dom/xul/nsXULPrototypeDocument.cpp
layout/build/nsLayoutModule.cpp
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -88,17 +88,16 @@ EXPORTS += [
     'nsIContent.h',
     'nsIContentInlines.h',
     'nsIContentIterator.h',
     'nsIContentSerializer.h',
     'nsIDocument.h',
     'nsIDocumentInlines.h',
     'nsIDocumentObserver.h',
     'nsIDOMClassInfo.h',
-    'nsIDOMScriptObjectFactory.h',
     'nsIGlobalObject.h',
     'nsImageLoadingContent.h',
     'nsIMutationObserver.h',
     'nsINode.h',
     'nsINodeList.h',
     'nsIScriptContext.h',
     'nsIScriptElement.h',
     'nsIScriptGlobalObject.h',
@@ -274,17 +273,16 @@ UNIFIED_SOURCES += [
     'nsDataDocumentContentPolicy.cpp',
     'nsDocument.cpp',
     'nsDocumentEncoder.cpp',
     'nsDOMAttributeMap.cpp',
     'nsDOMCaretPosition.cpp',
     'nsDOMClassInfo.cpp',
     'nsDOMMutationObserver.cpp',
     'nsDOMNavigationTiming.cpp',
-    'nsDOMScriptObjectFactory.cpp',
     'nsDOMSerializer.cpp',
     'nsDOMTokenList.cpp',
     'nsDOMWindowList.cpp',
     'nsFocusManager.cpp',
     'nsFrameLoader.cpp',
     'nsGenConImageContent.cpp',
     'nsGenericDOMDataNode.cpp',
     'nsGkAtoms.cpp',
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -114,17 +114,16 @@
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentType.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
-#include "nsIDOMScriptObjectFactory.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIDOMXULCommandEvent.h"
 #include "nsIDragService.h"
 #include "nsIEditor.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFragmentContentSink.h"
 #include "nsContainerFrame.h"
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -21,16 +21,17 @@
 #include "xpcprivate.h"
 #include "XPCWrapper.h"
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/dom/RegisterBindings.h"
 
 #include "nscore.h"
 #include "nsDOMClassInfo.h"
+#include "nsIDOMClassInfo.h"
 #include "nsCRT.h"
 #include "nsCRTGlue.h"
 #include "nsICategoryManager.h"
 #include "nsIComponentRegistrar.h"
 #include "nsXPCOM.h"
 #include "nsISimpleEnumerator.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIXPConnect.h"
@@ -112,18 +113,16 @@
 
 #ifdef MOZ_TIME_MANAGER
 #include "TimeManager.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
-
 // NOTE: DEFAULT_SCRIPTABLE_FLAGS and DOM_DEFAULT_SCRIPTABLE_FLAGS
 //       are defined in nsIDOMClassInfo.h.
 
 #define DOMCLASSINFO_STANDARD_FLAGS                                           \
   (nsIClassInfo::MAIN_THREAD_ONLY |                                           \
    nsIClassInfo::DOM_OBJECT       |                                           \
    nsIClassInfo::SINGLETON_CLASSINFO)
 
@@ -135,17 +134,17 @@ static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM
 #define NS_DEFINE_CLASSINFO_DATA_DEBUG(_class)                                \
   // nothing
 #endif
 
 #define NS_DEFINE_CLASSINFO_DATA_HELPER(_class, _helper, _flags,              \
                                         _chromeOnly, _allowXBL)               \
   { #_class,                                                                  \
     nullptr,                                                                  \
-    { _helper::doCreate },                                                    \
+    _helper::doCreate,                                                        \
     nullptr,                                                                  \
     nullptr,                                                                  \
     nullptr,                                                                  \
     _flags,                                                                   \
     true,                                                                     \
     _chromeOnly,                                                              \
     _allowXBL,                                                                \
     false,                                                                    \
@@ -347,25 +346,16 @@ nsDOMClassInfo::ObjectIsNativeWrapper(JS
   return xpc::WrapperFactory::IsXrayWrapper(obj) &&
          xpc::AccessCheck::wrapperSubsumes(obj);
 }
 
 nsDOMClassInfo::nsDOMClassInfo(nsDOMClassInfoData* aData) : mData(aData)
 {
 }
 
-nsDOMClassInfo::~nsDOMClassInfo()
-{
-  if (IS_EXTERNAL(mData->mCachedClassInfo)) {
-    // Some compilers don't like delete'ing a const nsDOMClassInfo*
-    nsDOMClassInfoData* data = const_cast<nsDOMClassInfoData*>(mData);
-    delete static_cast<nsExternalDOMClassInfoData*>(data);
-  }
-}
-
 NS_IMPL_ADDREF(nsDOMClassInfo)
 NS_IMPL_RELEASE(nsDOMClassInfo)
 
 NS_INTERFACE_MAP_BEGIN(nsDOMClassInfo)
   if (aIID.Equals(NS_GET_IID(nsXPCClassInfo)))
     foundInterface = static_cast<nsIClassInfo*>(
                                     static_cast<nsXPCClassInfo*>(this));
   else
@@ -443,68 +433,16 @@ nsDOMClassInfo::RegisterClassProtos(int3
 
     nsCOMPtr<nsIInterfaceInfo> tmp(if_info);
     tmp->GetParent(getter_AddRefs(if_info));
   }
 
   return NS_OK;
 }
 
-// static
-nsresult
-nsDOMClassInfo::RegisterExternalClasses()
-{
-  nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
-  NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
-
-  nsCOMPtr<nsIComponentRegistrar> registrar;
-  nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsICategoryManager> cm =
-    do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsISimpleEnumerator> e;
-  rv = cm->EnumerateCategory(JAVASCRIPT_DOM_CLASS, getter_AddRefs(e));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsXPIDLCString contractId;
-  nsAutoCString categoryEntry;
-  nsCOMPtr<nsISupports> entry;
-
-  while (NS_SUCCEEDED(e->GetNext(getter_AddRefs(entry)))) {
-    nsCOMPtr<nsISupportsCString> category(do_QueryInterface(entry));
-
-    if (!category) {
-      NS_WARNING("Category entry not an nsISupportsCString!");
-      continue;
-    }
-
-    rv = category->GetData(categoryEntry);
-
-    cm->GetCategoryEntry(JAVASCRIPT_DOM_CLASS, categoryEntry.get(),
-                         getter_Copies(contractId));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCID *cid;
-    rv = registrar->ContractIDToCID(contractId, &cid);
-    if (NS_FAILED(rv)) {
-      NS_WARNING("Bad contract id registered with the script namespace manager");
-      continue;
-    }
-
-    rv = nameSpaceManager->RegisterExternalClassName(categoryEntry.get(), *cid);
-    free(cid);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  return nameSpaceManager->RegisterExternalInterfaces(true);
-}
-
 #define _DOM_CLASSINFO_MAP_BEGIN(_class, _ifptr, _has_class_if)               \
   {                                                                           \
     nsDOMClassInfoData &d = sClassInfoData[eDOMClassInfo_##_class##_id];      \
     d.mProtoChainInterface = _ifptr;                                          \
     d.mHasClassInterface = _has_class_if;                                     \
     static const nsIID *interface_list[] = {
 
 #define DOM_CLASSINFO_MAP_BEGIN(_class, _interface)                           \
@@ -705,17 +643,17 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_END
 
   static_assert(MOZ_ARRAY_LENGTH(sClassInfoData) == eDOMClassInfoIDCount,
                 "The number of items in sClassInfoData doesn't match the "
                 "number of nsIDOMClassInfo ID's, this is bad! Fix it!");
 
 #ifdef DEBUG
   for (size_t i = 0; i < eDOMClassInfoIDCount; i++) {
-    if (!sClassInfoData[i].u.mConstructorFptr ||
+    if (!sClassInfoData[i].mConstructorFptr ||
         sClassInfoData[i].mDebugID != i) {
       MOZ_CRASH("Class info data out of sync, you forgot to update "
                 "nsDOMClassInfo.h and nsDOMClassInfo.cpp! Fix this, "
                 "mozilla will not work without this fixed!");
     }
   }
 
   for (size_t i = 0; i < eDOMClassInfoIDCount; i++) {
@@ -740,18 +678,16 @@ nsDOMClassInfo::Init()
     nameSpaceManager->RegisterClassName(data.mName, i, data.mChromeOnly,
                                         data.mAllowXBL, &data.mNameUTF16);
   }
 
   for (i = 0; i < eDOMClassInfoIDCount; ++i) {
     RegisterClassProtos(i);
   }
 
-  RegisterExternalClasses();
-
   sIsInitialized = true;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMClassInfo::GetInterfaces(uint32_t *aCount, nsIID ***aArray)
 {
@@ -974,51 +910,16 @@ nsDOMClassInfo::HasInstance(nsIXPConnect
                             bool *_retval)
 {
   NS_WARNING("nsDOMClassInfo::HasInstance Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 static nsresult
-GetExternalClassInfo(nsScriptNameSpaceManager *aNameSpaceManager,
-                     const nsAString &aName,
-                     const nsGlobalNameStruct *aStruct,
-                     const nsGlobalNameStruct **aResult)
-{
-  NS_ASSERTION(aStruct->mType ==
-                 nsGlobalNameStruct::eTypeExternalClassInfoCreator,
-               "Wrong type!");
-
-  nsresult rv;
-  nsCOMPtr<nsIDOMCIExtension> creator(do_CreateInstance(aStruct->mCID, &rv));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID));
-  NS_ENSURE_TRUE(sof, NS_ERROR_FAILURE);
-
-  rv = creator->RegisterDOMCI(NS_ConvertUTF16toUTF8(aName).get(), sof);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  const nsGlobalNameStruct *name_struct = aNameSpaceManager->LookupName(aName);
-  if (name_struct &&
-      name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
-    *aResult = name_struct;
-  }
-  else {
-    NS_ERROR("Couldn't get the DOM ClassInfo data.");
-
-    *aResult = nullptr;
-  }
-
-  return NS_OK;
-}
-
-
-static nsresult
 ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
                  JS::Handle<JSObject*> obj, const char16_t *name,
                  const nsDOMClassInfoData *ci_data,
                  const nsGlobalNameStruct *name_struct,
                  nsScriptNameSpaceManager *nameSpaceManager,
                  JSObject *dot_prototype,
                  JS::MutableHandle<JS::PropertyDescriptor> ctorDesc);
 
@@ -1129,58 +1030,30 @@ NS_GetDOMClassInfoInstance(nsDOMClassInf
   }
 
   nsresult rv = RegisterDOMNames();
   NS_ENSURE_SUCCESS(rv, nullptr);
 
   if (!sClassInfoData[aID].mCachedClassInfo) {
     nsDOMClassInfoData& data = sClassInfoData[aID];
 
-    data.mCachedClassInfo = data.u.mConstructorFptr(&data);
+    data.mCachedClassInfo = data.mConstructorFptr(&data);
     NS_ENSURE_TRUE(data.mCachedClassInfo, nullptr);
 
     NS_ADDREF(data.mCachedClassInfo);
   }
 
-  NS_ASSERTION(!IS_EXTERNAL(sClassInfoData[aID].mCachedClassInfo),
-               "This is bad, internal class marked as external!");
-
   return sClassInfoData[aID].mCachedClassInfo;
 }
 
 // static
-nsIClassInfo *
-nsDOMClassInfo::GetClassInfoInstance(nsDOMClassInfoData* aData)
-{
-  NS_ASSERTION(IS_EXTERNAL(aData->mCachedClassInfo)
-               || !aData->mCachedClassInfo,
-               "This is bad, external class marked as internal!");
-
-  if (!aData->mCachedClassInfo) {
-    if (aData->u.mExternalConstructorFptr) {
-      aData->mCachedClassInfo =
-        aData->u.mExternalConstructorFptr(aData->mName);
-    } else {
-      aData->mCachedClassInfo = nsDOMGenericSH::doCreate(aData);
-    }
-    NS_ENSURE_TRUE(aData->mCachedClassInfo, nullptr);
-
-    NS_ADDREF(aData->mCachedClassInfo);
-    aData->mCachedClassInfo = MARK_EXTERNAL(aData->mCachedClassInfo);
-  }
-
-  return GET_CLEAN_CI_PTR(aData->mCachedClassInfo);
-}
-
-
-// static
 void
 nsDOMClassInfo::ShutDown()
 {
-  if (sClassInfoData[0].u.mConstructorFptr) {
+  if (sClassInfoData[0].mConstructorFptr) {
     uint32_t i;
 
     for (i = 0; i < eDOMClassInfoIDCount; i++) {
       NS_IF_RELEASE(sClassInfoData[i].mCachedClassInfo);
     }
   }
 
   sConstructor_id     = JSID_VOID;
@@ -1197,20 +1070,20 @@ BaseStubConstructor(nsIWeakReference* aW
 {
   MOZ_ASSERT(obj);
   MOZ_ASSERT(cx == nsContentUtils::GetCurrentJSContext());
 
   nsresult rv;
   nsCOMPtr<nsISupports> native;
   if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
     rv = NS_ERROR_NOT_AVAILABLE;
-  } else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
+  } else {
+    MOZ_ASSERT(name_struct->mType ==
+               nsGlobalNameStruct::eTypeExternalConstructor);
     native = do_CreateInstance(name_struct->mCID, &rv);
-  } else {
-    native = do_CreateInstance(*name_struct->mData->mConstructorCID, &rv);
   }
   if (NS_FAILED(rv)) {
     NS_ERROR("Failed to create the object");
     return rv;
   }
 
   js::AssertSameCompartment(cx, obj);
   return nsContentUtils::WrapNative(cx, native, args.rval(), true);
@@ -1272,17 +1145,16 @@ protected:
   {
   }
 
   ~nsDOMConstructor() {}
 
 public:
 
   static nsresult Create(const char16_t* aName,
-                         const nsDOMClassInfoData* aData,
                          const nsGlobalNameStruct* aNameStruct,
                          nsPIDOMWindowInner* aOwner,
                          nsDOMConstructor** aResult);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMDOMCONSTRUCTOR
 
   nsresult PreCreate(JSContext *cx, JSObject *globalObj, JSObject **parentObj);
@@ -1328,45 +1200,29 @@ private:
     }
 
     *aNameStruct = nameSpaceManager->LookupName(aName);
 
     // Return NS_OK here, aName just isn't a DOM class but nothing failed.
     return NS_OK;
   }
 
-  static bool IsConstructable(const nsDOMClassInfoData *aData)
-  {
-    if (IS_EXTERNAL(aData->mCachedClassInfo)) {
-      const nsExternalDOMClassInfoData* data =
-        static_cast<const nsExternalDOMClassInfoData*>(aData);
-      return data->mConstructorCID != nullptr;
-    }
-
-    return false;
-  }
   static bool IsConstructable(const nsGlobalNameStruct *aNameStruct)
   {
-    return
-      (aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor &&
-       IsConstructable(&sClassInfoData[aNameStruct->mDOMClassInfoID])) ||
-      (aNameStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo &&
-       IsConstructable(aNameStruct->mData)) ||
-      aNameStruct->mType == nsGlobalNameStruct::eTypeExternalConstructor;
+    return aNameStruct->mType == nsGlobalNameStruct::eTypeExternalConstructor;
   }
 
   const char16_t*   mClassName;
   const bool mConstructable;
   nsWeakPtr          mWeakOwner;
 };
 
 //static
 nsresult
 nsDOMConstructor::Create(const char16_t* aName,
-                         const nsDOMClassInfoData* aData,
                          const nsGlobalNameStruct* aNameStruct,
                          nsPIDOMWindowInner* aOwner,
                          nsDOMConstructor** aResult)
 {
   *aResult = nullptr;
   // Prevent creating a constructor if aOwner is inner window which doesn't have
   // an outer window. If the outer window doesn't have an inner window or the
   // caller can't access the outer window's current inner window then try to use
@@ -1377,19 +1233,17 @@ nsDOMConstructor::Create(const char16_t*
     outerWindow ? outerWindow->GetCurrentInnerWindow() : aOwner;
   if (!currentInner ||
       (aOwner != currentInner &&
        !nsContentUtils::CanCallerAccess(currentInner) &&
        !(currentInner = aOwner)->IsInnerWindow())) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
-  bool constructable = aNameStruct ?
-                         IsConstructable(aNameStruct) :
-                         IsConstructable(aData);
+  bool constructable = aNameStruct && IsConstructable(aNameStruct);
 
   *aResult = new nsDOMConstructor(aName, constructable, currentInner);
   NS_ADDREF(*aResult);
   return NS_OK;
 }
 
 NS_IMPL_ADDREF(nsDOMConstructor)
 NS_IMPL_RELEASE(nsDOMConstructor)
@@ -1505,56 +1359,51 @@ nsDOMConstructor::HasInstance(nsIXPConne
         *bp = true;
         break;
       }
     }
 
     return NS_OK;
   }
 
-  if (name_struct->mType != nsGlobalNameStruct::eTypeClassConstructor &&
-      name_struct->mType != nsGlobalNameStruct::eTypeExternalClassInfo) {
+  if (name_struct->mType != nsGlobalNameStruct::eTypeClassConstructor) {
     // Doesn't have DOM interfaces.
     return NS_OK;
   }
 
   const nsGlobalNameStruct *class_name_struct = GetNameStruct();
   NS_ENSURE_TRUE(class_name_struct, NS_ERROR_FAILURE);
 
   if (name_struct == class_name_struct) {
     *bp = true;
 
     return NS_OK;
   }
 
   const nsIID *class_iid;
-  if (class_name_struct->mType == nsGlobalNameStruct::eTypeInterface ||
-      class_name_struct->mType == nsGlobalNameStruct::eTypeClassProto) {
+  if (class_name_struct->mType == nsGlobalNameStruct::eTypeClassProto) {
     class_iid = &class_name_struct->mIID;
   } else if (class_name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
     class_iid =
       sClassInfoData[class_name_struct->mDOMClassInfoID].mProtoChainInterface;
-  } else if (class_name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
-    class_iid = class_name_struct->mData->mProtoChainInterface;
   } else {
     *bp = false;
 
     return NS_OK;
   }
 
-  NS_ASSERTION(name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor ||
-               name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo,
+  NS_ASSERTION(name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor,
                "The constructor was set up with a struct of the wrong type.");
 
-  const nsDOMClassInfoData *ci_data = nullptr;
+  const nsDOMClassInfoData *ci_data;
   if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor &&
       name_struct->mDOMClassInfoID >= 0) {
     ci_data = &sClassInfoData[name_struct->mDOMClassInfoID];
-  } else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
-    ci_data = name_struct->mData;
+  } else {
+    ci_data = nullptr;
   }
 
   nsCOMPtr<nsIInterfaceInfoManager>
     iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
   if (!iim) {
     NS_ERROR("nsDOMConstructor::HasInstance can't get interface info mgr.");
     return NS_ERROR_UNEXPECTED;
   }
@@ -1588,24 +1437,21 @@ nsDOMConstructor::HasInstance(nsIXPConne
 nsresult
 nsDOMConstructor::ResolveInterfaceConstants(JSContext *cx, JS::Handle<JSObject*> obj)
 {
   const nsGlobalNameStruct *class_name_struct = GetNameStruct();
   if (!class_name_struct)
     return NS_ERROR_UNEXPECTED;
 
   const nsIID *class_iid;
-  if (class_name_struct->mType == nsGlobalNameStruct::eTypeInterface ||
-      class_name_struct->mType == nsGlobalNameStruct::eTypeClassProto) {
+  if (class_name_struct->mType == nsGlobalNameStruct::eTypeClassProto) {
     class_iid = &class_name_struct->mIID;
   } else if (class_name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
     class_iid =
       sClassInfoData[class_name_struct->mDOMClassInfoID].mProtoChainInterface;
-  } else if (class_name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
-    class_iid = class_name_struct->mData->mProtoChainInterface;
   } else {
     return NS_OK;
   }
 
   nsresult rv = DefineInterfaceConstants(cx, obj, class_iid);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
@@ -1622,33 +1468,25 @@ nsDOMConstructor::ToString(nsAString &aR
 }
 
 
 static nsresult
 GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
             const nsGlobalNameStruct *aNameStruct,
             JS::MutableHandle<JSObject*> aProto)
 {
-  NS_ASSERTION(aNameStruct->mType ==
-                 nsGlobalNameStruct::eTypeClassConstructor ||
-               aNameStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo,
+  NS_ASSERTION(aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor,
                "Wrong type!");
 
-  nsCOMPtr<nsIClassInfo> ci;
-  if (aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
-    int32_t id = aNameStruct->mDOMClassInfoID;
-    MOZ_ASSERT(id >= 0, "Negative DOM classinfo?!?");
+  int32_t id = aNameStruct->mDOMClassInfoID;
+  MOZ_ASSERT(id >= 0, "Negative DOM classinfo?!?");
 
-    nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id;
+  nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id;
 
-    ci = NS_GetDOMClassInfoInstance(ci_id);
-  }
-  else {
-    ci = nsDOMClassInfo::GetClassInfoInstance(aNameStruct->mData);
-  }
+  nsCOMPtr<nsIClassInfo> ci = NS_GetDOMClassInfoInstance(ci_id);
   NS_ENSURE_TRUE(ci, NS_ERROR_UNEXPECTED);
 
   nsresult rv =
     aXPConnect->GetWrappedNativePrototype(cx, aWin->GetGlobalJSObject(), ci, aProto.address());
   NS_ENSURE_SUCCESS(rv, rv);
 
   return JS_WrapObject(cx, aProto) ? NS_OK : NS_ERROR_FAILURE;
 }
@@ -1666,18 +1504,17 @@ ResolvePrototype(nsIXPConnect *aXPConnec
 {
   JS::Rooted<JSObject*> dot_prototype(cx, aDot_prototype);
   NS_ASSERTION(ci_data ||
                (name_struct &&
                 name_struct->mType == nsGlobalNameStruct::eTypeClassProto),
                "Wrong type or missing ci_data!");
 
   RefPtr<nsDOMConstructor> constructor;
-  nsresult rv = nsDOMConstructor::Create(name, ci_data, name_struct,
-                                         aWin->AsInner(),
+  nsresult rv = nsDOMConstructor::Create(name, name_struct, aWin->AsInner(),
                                          getter_AddRefs(constructor));
   NS_ENSURE_SUCCESS(rv, rv);
 
   JS::Rooted<JS::Value> v(cx);
 
   js::AssertSameCompartment(cx, obj);
   rv = nsContentUtils::WrapNative(cx, constructor,
                                   &NS_GET_IID(nsIDOMDOMConstructor), &v,
@@ -1820,18 +1657,17 @@ ResolvePrototype(nsIXPConnect *aXPConnec
   return NS_OK;
 }
 
 static bool
 OldBindingConstructorEnabled(const nsGlobalNameStruct *aStruct,
                              nsGlobalWindow *aWin, JSContext *cx)
 {
   MOZ_ASSERT(aStruct->mType == nsGlobalNameStruct::eTypeProperty ||
-             aStruct->mType == nsGlobalNameStruct::eTypeClassConstructor ||
-             aStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo);
+             aStruct->mType == nsGlobalNameStruct::eTypeClassConstructor);
 
   // Don't expose chrome only constructors to content windows.
   if (aStruct->mChromeOnly) {
     bool expose;
     if (aStruct->mAllowXBL) {
       expose = IsChromeOrXBL(cx, nullptr);
     } else {
       expose = nsContentUtils::IsSystemPrincipal(aWin->GetPrincipal());
@@ -1852,27 +1688,18 @@ LookupComponentsShim(JSContext *cx, JS::
 
 // static
 bool
 nsWindowSH::NameStructEnabled(JSContext* aCx, nsGlobalWindow *aWin,
                               const nsAString& aName,
                               const nsGlobalNameStruct& aNameStruct)
 {
   const nsGlobalNameStruct* nameStruct = &aNameStruct;
-  if (nameStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfoCreator) {
-    nsresult rv = GetExternalClassInfo(GetNameSpaceManager(), aName, nameStruct,
-                                       &nameStruct);
-    if (NS_FAILED(rv) || !nameStruct) {
-      return false;
-    }
-  }
-
   return (nameStruct->mType != nsGlobalNameStruct::eTypeProperty &&
-          nameStruct->mType != nsGlobalNameStruct::eTypeClassConstructor &&
-          nameStruct->mType != nsGlobalNameStruct::eTypeExternalClassInfo) ||
+          nameStruct->mType != nsGlobalNameStruct::eTypeClassConstructor) ||
          OldBindingConstructorEnabled(nameStruct, aWin, aCx);
 }
 
 #ifdef RELEASE_BUILD
 #define USE_CONTROLLERS_SHIM
 #endif
 
 #ifdef USE_CONTROLLERS_SHIM
@@ -1932,26 +1759,17 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
 
   // The class_name had better match our name
   MOZ_ASSERT(name.Equals(class_name));
 
   NS_ENSURE_TRUE(class_name, NS_ERROR_UNEXPECTED);
 
   nsresult rv = NS_OK;
 
-  if (name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfoCreator) {
-    rv = GetExternalClassInfo(nameSpaceManager, name, name_struct,
-                              &name_struct);
-    if (NS_FAILED(rv) || !name_struct) {
-      return rv;
-    }
-  }
-
   if (name_struct->mType == nsGlobalNameStruct::eTypeNewDOMBinding ||
-      name_struct->mType == nsGlobalNameStruct::eTypeInterface ||
       name_struct->mType == nsGlobalNameStruct::eTypeClassProto ||
       name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
     // Lookup new DOM bindings.
     DefineInterface getOrCreateInterfaceObject =
       name_struct->mDefineDOMInterface;
     if (getOrCreateInterfaceObject) {
       if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor &&
           !OldBindingConstructorEnabled(name_struct, aWin, cx)) {
@@ -2033,55 +1851,17 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
         // doesn't matter what we pass for the "readonly" argument here.
         FillPropertyDescriptor(desc, obj, JS::UndefinedValue(), false);
       }
 
       return NS_OK;
     }
   }
 
-  if (name_struct->mType == nsGlobalNameStruct::eTypeInterface) {
-    // We're resolving a name of a DOM interface for which there is no
-    // direct DOM class, create a constructor object...
-    RefPtr<nsDOMConstructor> constructor;
-    rv = nsDOMConstructor::Create(class_name,
-                                  nullptr,
-                                  name_struct,
-                                  aWin->AsInner(),
-                                  getter_AddRefs(constructor));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    JS::Rooted<JS::Value> v(cx);
-    js::AssertSameCompartment(cx, obj);
-    rv = nsContentUtils::WrapNative(cx, constructor,
-                                    &NS_GET_IID(nsIDOMDOMConstructor), &v,
-                                    false);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    JS::Rooted<JSObject*> class_obj(cx, &v.toObject());
-
-    // ... and define the constants from the DOM interface on that
-    // constructor object.
-
-    {
-      JSAutoCompartment ac(cx, class_obj);
-      rv = DefineInterfaceConstants(cx, class_obj, &name_struct->mIID);
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-
-    if (!JS_WrapValue(cx, &v)) {
-      return NS_ERROR_UNEXPECTED;
-    }
-
-    FillPropertyDescriptor(desc, obj, 0, v);
-    return NS_OK;
-  }
-
-  if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor ||
-      name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
+  if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
     if (!OldBindingConstructorEnabled(name_struct, aWin, cx)) {
       return NS_OK;
     }
 
     // Create the XPConnect prototype for our classinfo, PostCreateProto will
     // set up the prototype chain.  This will go ahead and define things on the
     // actual window's global.
     JS::Rooted<JSObject*> dot_prototype(cx);
@@ -2095,41 +1875,35 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
     if (!isXray) {
       // GetXPCProto already defined the property for us
       FillPropertyDescriptor(desc, obj, JS::UndefinedValue(), false);
       return NS_OK;
     }
 
     // This is the Xray case.  Look up the constructor object for this
     // prototype.
-    const nsDOMClassInfoData *ci_data;
-    if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
-      ci_data = &sClassInfoData[name_struct->mDOMClassInfoID];
-    } else {
-      ci_data = name_struct->mData;
-    }
-
     return ResolvePrototype(nsDOMClassInfo::sXPConnect, aWin, cx, obj,
-                            class_name, ci_data,
+                            class_name,
+                            &sClassInfoData[name_struct->mDOMClassInfoID],
                             name_struct, nameSpaceManager, dot_prototype,
                             desc);
   }
 
   if (name_struct->mType == nsGlobalNameStruct::eTypeClassProto) {
     // We don't have a XPConnect prototype object, let ResolvePrototype create
     // one.
     return ResolvePrototype(nsDOMClassInfo::sXPConnect, aWin, cx, obj,
                             class_name, nullptr,
                             name_struct, nameSpaceManager, nullptr, desc);
   }
 
   if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
     RefPtr<nsDOMConstructor> constructor;
-    rv = nsDOMConstructor::Create(class_name, nullptr, name_struct,
-                                  aWin->AsInner(), getter_AddRefs(constructor));
+    rv = nsDOMConstructor::Create(class_name, name_struct, aWin->AsInner(),
+                                  getter_AddRefs(constructor));
     NS_ENSURE_SUCCESS(rv, rv);
 
     JS::Rooted<JS::Value> val(cx);
     js::AssertSameCompartment(cx, obj);
     rv = nsContentUtils::WrapNative(cx, constructor,
                                     &NS_GET_IID(nsIDOMDOMConstructor), &val,
                                     true);
     NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -3,19 +3,19 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsDOMClassInfo_h___
 #define nsDOMClassInfo_h___
 
 #include "mozilla/Attributes.h"
+#include "nsDOMClassInfoID.h"
 #include "nsIXPCScriptable.h"
 #include "nsIScriptGlobalObject.h"
-#include "nsIDOMScriptObjectFactory.h"
 #include "js/Id.h"
 #include "nsIXPConnect.h"
 
 #ifdef XP_WIN
 #undef GetClassName
 #endif
 
 struct nsGlobalNameStruct;
@@ -27,77 +27,49 @@ typedef nsIClassInfo* (*nsDOMClassInfoCo
   (nsDOMClassInfoData* aData);
 
 typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject);
 
 struct nsDOMClassInfoData
 {
   const char *mName;
   const char16_t *mNameUTF16;
-  union {
-    nsDOMClassInfoConstructorFnc mConstructorFptr;
-    nsDOMClassInfoExternalConstructorFnc mExternalConstructorFptr;
-  } u;
+  nsDOMClassInfoConstructorFnc mConstructorFptr;
 
-  nsIClassInfo *mCachedClassInfo; // low bit is set to 1 if external,
-                                  // so be sure to mask if necessary!
+  nsIClassInfo *mCachedClassInfo;
   const nsIID *mProtoChainInterface;
   const nsIID **mInterfaces;
   uint32_t mScriptableFlags : 31; // flags must not use more than 31 bits!
   uint32_t mHasClassInterface : 1;
   bool mChromeOnly : 1;
   bool mAllowXBL : 1;
   bool mDisabled : 1;
 #ifdef DEBUG
   uint32_t mDebugID;
 #endif
 };
 
-struct nsExternalDOMClassInfoData : public nsDOMClassInfoData
-{
-  const nsCID *mConstructorCID;
-};
-
-
-// To be used with the nsDOMClassInfoData::mCachedClassInfo pointer.
-// The low bit is set when we created a generic helper for an external
-// (which holds on to the nsDOMClassInfoData).
-#define GET_CLEAN_CI_PTR(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) & ~0x1)
-#define MARK_EXTERNAL(_ptr) (nsIClassInfo*)(uintptr_t(_ptr) | 0x1)
-#define IS_EXTERNAL(_ptr) (uintptr_t(_ptr) & 0x1)
-
 class nsWindowSH;
 
 class nsDOMClassInfo : public nsXPCClassInfo
 {
   friend class nsWindowSH;
 
 protected:
-  virtual ~nsDOMClassInfo();
+  virtual ~nsDOMClassInfo() {};
 
 public:
   explicit nsDOMClassInfo(nsDOMClassInfoData* aData);
 
   NS_DECL_NSIXPCSCRIPTABLE
 
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSICLASSINFO
 
-  // Helper method that returns a *non* refcounted pointer to a
-  // helper. So please note, don't release this pointer, if you do,
-  // you better make sure you've addreffed before release.
-  //
-  // Whaaaaa! I wanted to name this method GetClassInfo, but nooo,
-  // some of Microsoft devstudio's headers #defines GetClassInfo to
-  // GetClassInfoA so I can't, those $%#@^! bastards!!! What gives
-  // them the right to do that?
-
-  static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);
-
   static nsresult Init();
   static void ShutDown();
 
   static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
   {
     return new nsDOMClassInfo(aData);
   }
 
@@ -129,17 +101,16 @@ protected:
 
   const nsDOMClassInfoData* mData;
 
   virtual void PreserveWrapper(nsISupports *aNative) override
   {
   }
 
   static nsresult RegisterClassProtos(int32_t aDOMClassInfoID);
-  static nsresult RegisterExternalClasses();
 
   static nsIXPConnect *sXPConnect;
 
   // nsIXPCScriptable code
   static nsresult DefineStaticJSVals(JSContext *cx);
 
   static bool sIsInitialized;
 
--- a/dom/base/nsDOMClassInfoID.h
+++ b/dom/base/nsDOMClassInfoID.h
@@ -55,15 +55,11 @@ NS_GetDOMClassInfoInstance(nsDOMClassInf
        aIID.Equals(NS_GET_IID(nsXPCClassInfo)))) {                            \
     foundInterface = NS_GetDOMClassInfoInstance(eDOMClassInfo_##_class##_id); \
     if (!foundInterface) {                                                    \
       *aInstancePtr = nullptr;                                                 \
       return NS_ERROR_OUT_OF_MEMORY;                                          \
     }                                                                         \
   } else
 
-#else
-
-// See nsIDOMClassInfo.h
-
 #endif // MOZILLA_INTERNAL_API
 
 #endif // nsDOMClassInfoID_h__
deleted file mode 100644
--- a/dom/base/nsDOMScriptObjectFactory.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * This Original Code has been modified by IBM Corporation.
- * Modifications made by IBM described herein are
- * Copyright (c) International Business Machines
- * Corporation, 2000
- *
- * Modifications to Mozilla code or documentation
- * identified per MPL Section 3.3
- *
- * Date         Modified by     Description of modification
- * 03/27/2000   IBM Corp.       Added PR_CALLBACK for Optlink
- *                               use in OS2
- */
-
-#include "nsDOMScriptObjectFactory.h"
-#include "nsScriptNameSpaceManager.h"
-#include "nsIObserverService.h"
-#include "nsJSEnvironment.h"
-#include "nsGlobalWindow.h"
-#include "nsCRT.h"
-#ifdef MOZ_XUL
-#include "nsXULPrototypeCache.h"
-#endif
-#include "nsThreadUtils.h"
-
-using mozilla::dom::GetNameSpaceManager;
-
-nsDOMScriptObjectFactory::nsDOMScriptObjectFactory()
-{
-  nsCOMPtr<nsIObserverService> observerService =
-    mozilla::services::GetObserverService();
-  if (observerService) {
-    observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
-  }
-
-}
-
-NS_INTERFACE_MAP_BEGIN(nsDOMScriptObjectFactory)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMScriptObjectFactory)
-  NS_INTERFACE_MAP_ENTRY(nsIObserver)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMScriptObjectFactory)
-NS_INTERFACE_MAP_END
-
-
-NS_IMPL_ADDREF(nsDOMScriptObjectFactory)
-NS_IMPL_RELEASE(nsDOMScriptObjectFactory)
-
-NS_IMETHODIMP_(nsISupports *)
-nsDOMScriptObjectFactory::GetClassInfoInstance(nsDOMClassInfoID aID)
-{
-  return NS_GetDOMClassInfoInstance(aID);
-}
-
-NS_IMETHODIMP_(nsISupports *)
-nsDOMScriptObjectFactory::GetExternalClassInfoInstance(const nsAString& aName)
-{
-  nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
-  NS_ENSURE_TRUE(nameSpaceManager, nullptr);
-
-  const nsGlobalNameStruct *globalStruct = nameSpaceManager->LookupName(aName);
-  if (globalStruct) {
-    if (globalStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfoCreator) {
-      nsresult rv;
-      nsCOMPtr<nsIDOMCIExtension> creator(do_CreateInstance(globalStruct->mCID, &rv));
-      NS_ENSURE_SUCCESS(rv, nullptr);
-
-      rv = creator->RegisterDOMCI(NS_ConvertUTF16toUTF8(aName).get(), this);
-      NS_ENSURE_SUCCESS(rv, nullptr);
-
-      globalStruct = nameSpaceManager->LookupName(aName);
-      NS_ENSURE_TRUE(globalStruct, nullptr);
-
-      NS_ASSERTION(globalStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo,
-                   "The classinfo data for this class didn't get registered.");
-    }
-    if (globalStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
-      return nsDOMClassInfo::GetClassInfoInstance(globalStruct->mData);
-    }
-  }
-  return nullptr;
-}
-
-NS_IMETHODIMP
-nsDOMScriptObjectFactory::Observe(nsISupports *aSubject,
-                                  const char *aTopic,
-                                  const char16_t *someData)
-{
-  if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
-#ifdef MOZ_XUL
-    // Flush the XUL cache since it holds JS roots, and we're about to
-    // start the final GC.
-    nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
-
-    if (cache)
-      cache->Flush();
-#endif
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMScriptObjectFactory::RegisterDOMClassInfo(const char *aName,
-                                               nsDOMClassInfoExternalConstructorFnc aConstructorFptr,
-                                               const nsIID *aProtoChainInterface,
-                                               const nsIID **aInterfaces,
-                                               uint32_t aScriptableFlags,
-                                               bool aHasClassInterface,
-                                               const nsCID *aConstructorCID)
-{
-  nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
-  NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
-
-  return nameSpaceManager->RegisterDOMCIData(aName,
-                                             aConstructorFptr,
-                                             aProtoChainInterface,
-                                             aInterfaces,
-                                             aScriptableFlags,
-                                             aHasClassInterface,
-                                             aConstructorCID);
-}
deleted file mode 100644
--- a/dom/base/nsDOMScriptObjectFactory.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- *
- * This Original Code has been modified by IBM Corporation.
- * Modifications made by IBM described herein are
- * Copyright (c) International Business Machines
- * Corporation, 2000
- *
- * Modifications to Mozilla code or documentation
- * identified per MPL Section 3.3
- *
- * Date         Modified by     Description of modification
- * 03/27/2000   IBM Corp.       Added PR_CALLBACK for Optlink
- *                               use in OS2
- */
-
-#include "nsIDOMScriptObjectFactory.h"
-#include "nsIObserver.h"
-#include "mozilla/Attributes.h"
-
-class nsDOMScriptObjectFactory final : public nsIDOMScriptObjectFactory,
-                                       public nsIObserver
-{
-  ~nsDOMScriptObjectFactory() {}
-
-public:
-  nsDOMScriptObjectFactory();
-
-  NS_DECL_ISUPPORTS
-
-  // nsIObserver
-  NS_DECL_NSIOBSERVER
-
-  // nsIDOMScriptObjectFactory
-  NS_IMETHOD_(nsISupports *) GetClassInfoInstance(nsDOMClassInfoID aID) override;
-  NS_IMETHOD_(nsISupports *) GetExternalClassInfoInstance(const nsAString& aName) override;
-
-  NS_IMETHOD RegisterDOMClassInfo(const char *aName,
-                                  nsDOMClassInfoExternalConstructorFnc aConstructorFptr,
-                                  const nsIID *aProtoChainInterface,
-                                  const nsIID **aInterfaces,
-                                  uint32_t aScriptableFlags,
-                                  bool aHasClassInterface,
-                                  const nsCID *aConstructorCID) override;
-};
-
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -6,16 +6,17 @@
 
 #include "base/basictypes.h"
 
 #include "nsFrameMessageManager.h"
 
 #include "AppProcessChecker.h"
 #include "ContentChild.h"
 #include "nsContentUtils.h"
+#include "nsDOMClassInfoID.h"
 #include "nsError.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsJSUtils.h"
 #include "nsJSPrincipals.h"
 #include "nsNetUtil.h"
 #include "nsScriptLoader.h"
--- a/dom/base/nsIDOMClassInfo.h
+++ b/dom/base/nsIDOMClassInfo.h
@@ -2,22 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsIDOMClassInfo_h___
 #define nsIDOMClassInfo_h___
 
-#include "nsIClassInfoImpl.h"
-#include "nsDOMClassInfoID.h"
 #include "nsIXPCScriptable.h"
-#include "nsIServiceManager.h"
-#include "nsIDOMScriptObjectFactory.h"
-#include "nsDOMCID.h"
 
 #define DOM_BASE_SCRIPTABLE_FLAGS                                          \
   (nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY |                          \
    nsIXPCScriptable::USE_JSSTUB_FOR_DELPROPERTY |                          \
    nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY |                          \
    nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE |                        \
    nsIXPCScriptable::DONT_ASK_INSTANCE_FOR_SCRIPTABLE |                    \
    nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES)
@@ -27,158 +22,9 @@
    nsIXPCScriptable::WANT_RESOLVE |                                        \
    nsIXPCScriptable::WANT_PRECREATE)
 
 #define DOM_DEFAULT_SCRIPTABLE_FLAGS                                       \
   (DEFAULT_SCRIPTABLE_FLAGS |                                              \
    nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE |                           \
    nsIXPCScriptable::CLASSINFO_INTERFACES_ONLY)
 
-
-#ifdef MOZILLA_INTERNAL_API
-
-// See nsDOMClassInfoID.h
-
-#else
-
-#define NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(_class)                       \
-  if (aIID.Equals(NS_GET_IID(nsIClassInfo)) ||                             \
-      aIID.Equals(NS_GET_IID(nsXPCClassInfo))) {                           \
-    static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);   \
-                                                                           \
-    nsresult rv;                                                           \
-    nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID,     \
-                                                          &rv));           \
-    if (NS_FAILED(rv)) {                                                   \
-      *aInstancePtr = nullptr;                                              \
-      return rv;                                                           \
-    }                                                                      \
-                                                                           \
-    foundInterface =                                                       \
-      sof->GetClassInfoInstance(eDOMClassInfo_##_class##_id);              \
-  } else
-
-#endif /* MOZILLA_INTERNAL_API */
-
-// Looks up the nsIClassInfo for a class name registered with the 
-// nsScriptNamespaceManager. Remember to release NS_CLASSINFO_NAME(_class)
-// (eg. when your module unloads).
-#define NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(_class)              \
-  if (aIID.Equals(NS_GET_IID(nsIClassInfo)) ||                             \
-      aIID.Equals(NS_GET_IID(nsXPCClassInfo))) {                           \
-    extern nsISupports *NS_CLASSINFO_NAME(_class);                         \
-    if (NS_CLASSINFO_NAME(_class)) {                                       \
-      foundInterface = NS_CLASSINFO_NAME(_class);                          \
-    } else {                                                               \
-      static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); \
-                                                                           \
-      nsresult rv;                                                         \
-      nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID,   \
-                                                            &rv));         \
-      if (NS_FAILED(rv)) {                                                 \
-        *aInstancePtr = nullptr;                                            \
-        return rv;                                                         \
-      }                                                                    \
-                                                                           \
-      foundInterface =                                                     \
-        sof->GetExternalClassInfoInstance(NS_LITERAL_STRING(#_class));     \
-                                                                           \
-      if (foundInterface) {                                                \
-        NS_CLASSINFO_NAME(_class) = foundInterface;                        \
-        NS_CLASSINFO_NAME(_class)->AddRef();                               \
-      }                                                                    \
-    }                                                                      \
-  } else
-
-
-#define NS_DECL_DOM_CLASSINFO(_class) \
-  nsISupports *NS_CLASSINFO_NAME(_class) = nullptr;
-
-// {891a7b01-1b61-11d6-a7f2-f690b638899c}
-#define NS_IDOMCI_EXTENSION_IID  \
-{ 0x891a7b01, 0x1b61, 0x11d6, \
-{ 0xa7, 0xf2, 0xf6, 0x90, 0xb6, 0x38, 0x89, 0x9c } }
-
-class nsIDOMScriptObjectFactory;
-
-class nsIDOMCIExtension : public nsISupports {
-public:  
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMCI_EXTENSION_IID)
-
-  NS_IMETHOD RegisterDOMCI(const char* aName,
-                           nsIDOMScriptObjectFactory* aDOMSOFactory) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMCIExtension, NS_IDOMCI_EXTENSION_IID)
-
-#define NS_DOMCI_EXTENSION_NAME(_module) ns##_module##DOMCIExtension
-#define NS_DOMCI_EXTENSION_CONSTRUCTOR(_module) \
-  ns##_module##DOMCIExtensionConstructor
-#define NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(_extension) \
-  NS_GENERIC_FACTORY_CONSTRUCTOR(_extension)
-
-#define NS_DOMCI_EXTENSION(_module)                                       \
-class NS_DOMCI_EXTENSION_NAME(_module) : public nsIDOMCIExtension         \
-{                                                                         \
-public:                                                                   \
-  NS_DOMCI_EXTENSION_NAME(_module)();                                     \
-  virtual ~NS_DOMCI_EXTENSION_NAME(_module)();                            \
-                                                                          \
-  NS_DECL_ISUPPORTS                                                       \
-                                                                          \
-  NS_IMETHOD RegisterDOMCI(const char* aName,                             \
-                           nsIDOMScriptObjectFactory* aDOMSOFactory);     \
-};                                                                        \
-                                                                          \
-NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(NS_DOMCI_EXTENSION_NAME(_module))      \
-                                                                          \
-NS_DOMCI_EXTENSION_NAME(_module)::NS_DOMCI_EXTENSION_NAME(_module)()      \
-{                                                                         \
-}                                                                         \
-                                                                          \
-NS_DOMCI_EXTENSION_NAME(_module)::~NS_DOMCI_EXTENSION_NAME(_module)()     \
-{                                                                         \
-}                                                                         \
-                                                                          \
-NS_IMPL_ISUPPORTS(NS_DOMCI_EXTENSION_NAME(_module), nsIDOMCIExtension)    \
-                                                                          \
-NS_IMETHODIMP                                                             \
-NS_DOMCI_EXTENSION_NAME(_module)::RegisterDOMCI(const char* aName,        \
-                                                nsIDOMScriptObjectFactory* aDOMSOFactory) \
-{
-
-#define NS_DOMCI_EXTENSION_ENTRY_BEGIN(_class)                            \
-  if (nsCRT::strcmp(aName, #_class) == 0) {                               \
-    static const nsIID* interfaces[] = {
-
-#define NS_DOMCI_EXTENSION_ENTRY_INTERFACE(_interface)                    \
-      &NS_GET_IID(_interface),
-
-// Don't forget to register the primary interface (_proto) in the 
-// JAVASCRIPT_DOM_INTERFACE category, or prototypes for this class
-// won't work (except if the interface name starts with nsIDOM).
-#define NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, _proto, _hasclassif,  \
-                                            _constructorcid)              \
-      nullptr                                                              \
-    };                                                                    \
-    aDOMSOFactory->RegisterDOMClassInfo(#_class, nullptr, _proto,          \
-                                        interfaces,                       \
-                                        DOM_DEFAULT_SCRIPTABLE_FLAGS,     \
-                                        _hasclassif, _constructorcid);    \
-    return NS_OK;                                                         \
-  }
-
-#define NS_DOMCI_EXTENSION_ENTRY_END(_class, _proto, _hasclassif,         \
-                                     _constructorcid)                     \
-  NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, &NS_GET_IID(_proto),        \
-                                      _hasclassif, _constructorcid)
-
-#define NS_DOMCI_EXTENSION_ENTRY_END_NO_PRIMARY_IF(_class, _hasclassif,   \
-                                                   _constructorcid)       \
-  NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, nullptr, _hasclassif,        \
-                                      _constructorcid)
-
-#define NS_DOMCI_EXTENSION_END                                            \
-  return NS_ERROR_FAILURE;                                                \
-}
-
-
 #endif /* nsIDOMClassInfo_h___ */
deleted file mode 100644
--- a/dom/base/nsIDOMScriptObjectFactory.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsIDOMScriptObjectFactory_h__
-#define nsIDOMScriptObjectFactory_h__
-
-#include "nsISupports.h"
-#include "nsIDOMClassInfo.h"
-#include "nsString.h"
-
-#define NS_IDOM_SCRIPT_OBJECT_FACTORY_IID \
-{ 0x2a50e17c, 0x46ff, 0x4150, \
-  { 0xbb, 0x46, 0xd8, 0x07, 0xb3, 0x36, 0xde, 0xab } }
-
-typedef nsXPCClassInfo* (*nsDOMClassInfoExternalConstructorFnc)
-  (const char* aName);
-
-class nsIDOMScriptObjectFactory : public nsISupports {
-public:  
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOM_SCRIPT_OBJECT_FACTORY_IID)
-
-  NS_IMETHOD_(nsISupports *) GetClassInfoInstance(nsDOMClassInfoID aID) = 0;
-  NS_IMETHOD_(nsISupports *) GetExternalClassInfoInstance(const nsAString& aName) = 0;
-
-  // Register the info for an external class. aName must be static
-  // data, it will not be deleted by the DOM code. aProtoChainInterface
-  // must be registered in the JAVASCRIPT_DOM_INTERFACE category, or
-  // prototypes for this class won't work (except if the interface
-  // name starts with nsIDOM).
-  NS_IMETHOD RegisterDOMClassInfo(const char *aName,
-                                  nsDOMClassInfoExternalConstructorFnc aConstructorFptr,
-                                  const nsIID *aProtoChainInterface,
-                                  const nsIID **aInterfaces,
-                                  uint32_t aScriptableFlags,
-                                  bool aHasClassInterface,
-                                  const nsCID *aConstructorCID) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMScriptObjectFactory,
-                              NS_IDOM_SCRIPT_OBJECT_FACTORY_IID)
-
-#endif /* nsIDOMScriptObjectFactory_h__ */
--- a/dom/base/nsIScriptNameSpaceManager.h
+++ b/dom/base/nsIScriptNameSpaceManager.h
@@ -15,15 +15,9 @@
 
 // a global property that is only accessible to privileged script 
 #define JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY \
   "JavaScript-global-privileged-property"
 
 #define JAVASCRIPT_NAVIGATOR_PROPERTY_CATEGORY \
   "JavaScript-navigator-property"
 
-#define JAVASCRIPT_DOM_CLASS \
-  "JavaScript-DOM-class"
-
-#define JAVASCRIPT_DOM_INTERFACE \
-  "JavaScript-DOM-interface"
-
 #endif /* nsIScriptNameSpaceManager_h__ */
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2557,18 +2557,16 @@ AsmJSCacheOpenEntryForWrite(JS::Handle<J
                             intptr_t* aHandle)
 {
   nsIPrincipal* principal =
     nsJSPrincipals::get(JS_GetCompartmentPrincipals(js::GetObjectCompartment(aGlobal)));
   return asmjscache::OpenEntryForWrite(principal, aInstalled, aBegin, aEnd,
                                        aSize, aMemory, aHandle);
 }
 
-static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
-
 void
 nsJSContext::EnsureStatics()
 {
   if (sIsInitialized) {
     if (!nsContentUtils::XPConnect()) {
       MOZ_CRASH();
     }
     return;
@@ -2690,25 +2688,16 @@ nsJSContext::EnsureStatics()
 
   nsIObserver* observer = new nsJSEnvironmentObserver();
   obs->AddObserver(observer, "memory-pressure", false);
   obs->AddObserver(observer, "user-interaction-inactive", false);
   obs->AddObserver(observer, "user-interaction-active", false);
   obs->AddObserver(observer, "quit-application", false);
   obs->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
 
-  // Bug 907848 - We need to explicitly get the nsIDOMScriptObjectFactory
-  // service in order to force its constructor to run, which registers a
-  // shutdown observer. It would be nice to make this more explicit and less
-  // side-effect-y.
-  nsCOMPtr<nsIDOMScriptObjectFactory> factory = do_GetService(kDOMScriptObjectFactoryCID);
-  if (!factory) {
-    MOZ_CRASH();
-  }
-
   sIsInitialized = true;
 }
 
 void
 nsJSContext::NotifyDidPaint()
 {
   sDidPaintAfterPreviousICCSlice = true;
 }
--- a/dom/base/nsScriptNameSpaceManager.cpp
+++ b/dom/base/nsScriptNameSpaceManager.cpp
@@ -56,28 +56,16 @@ GlobalNameHashMatchEntry(PLDHashTable *t
 static void
 GlobalNameHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
 {
   GlobalNameMapEntry *e = static_cast<GlobalNameMapEntry *>(entry);
 
   // An entry is being cleared, let the key (nsString) do its own
   // cleanup.
   e->mKey.~nsString();
-  if (e->mGlobalName.mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
-    nsIClassInfo* ci = GET_CLEAN_CI_PTR(e->mGlobalName.mData->mCachedClassInfo);
-
-    // If we constructed an internal helper, we'll let the helper delete 
-    // the nsDOMClassInfoData structure, if not we do it here.
-    if (!ci || e->mGlobalName.mData->u.mExternalConstructorFptr) {
-      delete e->mGlobalName.mData;
-    }
-
-    // Release our pointer to the helper.
-    NS_IF_RELEASE(ci);
-  }
 
   // This will set e->mGlobalName.mType to
   // nsGlobalNameStruct::eTypeNotInitialized
   memset(&e->mGlobalName, 0, sizeof(nsGlobalNameStruct));
 }
 
 static void
 GlobalNameHashInitEntry(PLDHashEntryHdr *entry, const void *key)
@@ -165,135 +153,22 @@ nsScriptNameSpaceManager::FillHash(nsICa
     }
   }
 
   return NS_OK;
 }
 
 
 nsresult
-nsScriptNameSpaceManager::RegisterExternalInterfaces(bool aAsProto)
-{
-  nsresult rv;
-  nsCOMPtr<nsICategoryManager> cm =
-    do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIInterfaceInfoManager>
-    iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
-  NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
-
-  nsCOMPtr<nsISimpleEnumerator> enumerator;
-  rv = cm->EnumerateCategory(JAVASCRIPT_DOM_INTERFACE,
-                             getter_AddRefs(enumerator));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsXPIDLCString IID_string;
-  nsAutoCString category_entry;
-  const char* if_name;
-  nsCOMPtr<nsISupports> entry;
-  nsCOMPtr<nsIInterfaceInfo> if_info;
-  bool found_old, dom_prefix;
-
-  while (NS_SUCCEEDED(enumerator->GetNext(getter_AddRefs(entry)))) {
-    nsCOMPtr<nsISupportsCString> category(do_QueryInterface(entry));
-
-    if (!category) {
-      NS_WARNING("Category entry not an nsISupportsCString!");
-
-      continue;
-    }
-
-    rv = category->GetData(category_entry);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = cm->GetCategoryEntry(JAVASCRIPT_DOM_INTERFACE, category_entry.get(),
-                              getter_Copies(IID_string));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsIID primary_IID;
-    if (!primary_IID.Parse(IID_string) ||
-        primary_IID.Equals(NS_GET_IID(nsISupports))) {
-      NS_ERROR("Invalid IID registered with the script namespace manager!");
-      continue;
-    }
-
-    iim->GetInfoForIID(&primary_IID, getter_AddRefs(if_info));
-
-    while (if_info) {
-      const nsIID *iid;
-      if_info->GetIIDShared(&iid);
-      NS_ENSURE_TRUE(iid, NS_ERROR_UNEXPECTED);
-
-      if (iid->Equals(NS_GET_IID(nsISupports))) {
-        break;
-      }
-
-      if_info->GetNameShared(&if_name);
-      dom_prefix = (strncmp(if_name, NS_DOM_INTERFACE_PREFIX,
-                            sizeof(NS_DOM_INTERFACE_PREFIX) - 1) == 0);
-
-      const char* name;
-      if (dom_prefix) {
-        name = if_name + sizeof(NS_DOM_INTERFACE_PREFIX) - 1;
-      } else {
-        name = if_name + sizeof(NS_INTERFACE_PREFIX) - 1;
-      }
-
-      if (aAsProto) {
-        RegisterClassProto(name, iid, &found_old);
-      } else {
-        RegisterInterface(name, iid, &found_old);
-      }
-
-      if (found_old) {
-        break;
-      }
-
-      nsCOMPtr<nsIInterfaceInfo> tmp(if_info);
-      tmp->GetParent(getter_AddRefs(if_info));
-    }
-  }
-
-  return NS_OK;
-}
-
-nsresult
-nsScriptNameSpaceManager::RegisterInterface(const char* aIfName,
-                                            const nsIID *aIfIID,
-                                            bool* aFoundOld)
-{
-  *aFoundOld = false;
-
-  nsGlobalNameStruct *s = AddToHash(&mGlobalNames, aIfName);
-  NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
-
-  if (s->mType != nsGlobalNameStruct::eTypeNotInitialized &&
-      s->mType != nsGlobalNameStruct::eTypeNewDOMBinding) {
-    *aFoundOld = true;
-
-    return NS_OK;
-  }
-
-  s->mType = nsGlobalNameStruct::eTypeInterface;
-  s->mIID = *aIfIID;
-
-  return NS_OK;
-}
-
-nsresult
 nsScriptNameSpaceManager::Init()
 {
   RegisterWeakMemoryReporter(this);
 
   nsresult rv = NS_OK;
 
-  rv = RegisterExternalInterfaces(false);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   nsCOMPtr<nsICategoryManager> cm =
     do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = FillHash(cm, JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = FillHash(cm, JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY);
@@ -366,18 +241,17 @@ nsScriptNameSpaceManager::RegisterClassN
   // If a external constructor is already defined with aClassName we
   // won't overwrite it.
 
   if (s->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
     return NS_OK;
   }
 
   NS_ASSERTION(s->mType == nsGlobalNameStruct::eTypeNotInitialized ||
-               s->mType == nsGlobalNameStruct::eTypeNewDOMBinding ||
-               s->mType == nsGlobalNameStruct::eTypeInterface,
+               s->mType == nsGlobalNameStruct::eTypeNewDOMBinding,
                "Whaaa, JS environment name clash!");
 
   s->mType = nsGlobalNameStruct::eTypeClassConstructor;
   s->mDOMClassInfoID = aDOMClassInfoID;
   s->mChromeOnly = aPrivileged;
   s->mAllowXBL = aXBLAllowed;
 
   return NS_OK;
@@ -391,101 +265,29 @@ nsScriptNameSpaceManager::RegisterClassP
   NS_ENSURE_ARG_POINTER(aConstructorProtoIID);
 
   *aFoundOld = false;
 
   nsGlobalNameStruct *s = AddToHash(&mGlobalNames, aClassName);
   NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
 
   if (s->mType != nsGlobalNameStruct::eTypeNotInitialized &&
-      s->mType != nsGlobalNameStruct::eTypeNewDOMBinding &&
-      s->mType != nsGlobalNameStruct::eTypeInterface) {
+      s->mType != nsGlobalNameStruct::eTypeNewDOMBinding) {
     *aFoundOld = true;
 
     return NS_OK;
   }
 
   s->mType = nsGlobalNameStruct::eTypeClassProto;
   s->mIID = *aConstructorProtoIID;
 
   return NS_OK;
 }
 
 nsresult
-nsScriptNameSpaceManager::RegisterExternalClassName(const char *aClassName,
-                                                    nsCID& aCID)
-{
-  nsGlobalNameStruct *s = AddToHash(&mGlobalNames, aClassName);
-  NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
-
-  // If an external constructor is already defined with aClassName we
-  // won't overwrite it.
-
-  if (s->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
-    return NS_OK;
-  }
-
-  NS_ASSERTION(s->mType == nsGlobalNameStruct::eTypeNotInitialized ||
-               s->mType == nsGlobalNameStruct::eTypeNewDOMBinding ||
-               s->mType == nsGlobalNameStruct::eTypeInterface,
-               "Whaaa, JS environment name clash!");
-
-  s->mType = nsGlobalNameStruct::eTypeExternalClassInfoCreator;
-  s->mCID = aCID;
-
-  return NS_OK;
-}
-
-nsresult
-nsScriptNameSpaceManager::RegisterDOMCIData(const char *aName,
-                                            nsDOMClassInfoExternalConstructorFnc aConstructorFptr,
-                                            const nsIID *aProtoChainInterface,
-                                            const nsIID **aInterfaces,
-                                            uint32_t aScriptableFlags,
-                                            bool aHasClassInterface,
-                                            const nsCID *aConstructorCID)
-{
-  const char16_t* className;
-  nsGlobalNameStruct *s = AddToHash(&mGlobalNames, aName, &className);
-  NS_ENSURE_TRUE(s, NS_ERROR_OUT_OF_MEMORY);
-
-  // If an external constructor is already defined with aClassName we
-  // won't overwrite it.
-
-  if (s->mType == nsGlobalNameStruct::eTypeClassConstructor ||
-      s->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
-    return NS_OK;
-  }
-
-  // XXX Should we bail out here?
-  NS_ASSERTION(s->mType == nsGlobalNameStruct::eTypeNotInitialized ||
-               s->mType == nsGlobalNameStruct::eTypeNewDOMBinding ||
-               s->mType == nsGlobalNameStruct::eTypeExternalClassInfoCreator,
-               "Someone tries to register classinfo data for a class that isn't new or external!");
-
-  s->mData = new nsExternalDOMClassInfoData;
-  s->mType = nsGlobalNameStruct::eTypeExternalClassInfo;
-  s->mData->mName = aName;
-  s->mData->mNameUTF16 = className;
-  if (aConstructorFptr)
-    s->mData->u.mExternalConstructorFptr = aConstructorFptr;
-  else
-    // null constructor will cause us to use nsDOMGenericSH::doCreate
-    s->mData->u.mExternalConstructorFptr = nullptr;
-  s->mData->mCachedClassInfo = nullptr;
-  s->mData->mProtoChainInterface = aProtoChainInterface;
-  s->mData->mInterfaces = aInterfaces;
-  s->mData->mScriptableFlags = aScriptableFlags;
-  s->mData->mHasClassInterface = aHasClassInterface;
-  s->mData->mConstructorCID = aConstructorCID;
-
-  return NS_OK;
-}
-
-nsresult
 nsScriptNameSpaceManager::OperateCategoryEntryHash(nsICategoryManager* aCategoryManager,
                                                    const char* aCategory,
                                                    nsISupports* aEntry,
                                                    bool aRemove)
 {
   MOZ_ASSERT(aCategoryManager);
   // Get the type from the category name.
   // NOTE: we could have passed the type in FillHash() and guessed it in
--- a/dom/base/nsScriptNameSpaceManager.h
+++ b/dom/base/nsScriptNameSpaceManager.h
@@ -34,36 +34,32 @@
 #include "xpcpublic.h"
 
 
 struct nsGlobalNameStruct
 {
   enum nametype {
     eTypeNotInitialized,
     eTypeNewDOMBinding,
-    eTypeInterface,
     eTypeProperty,
     eTypeNavigatorProperty,
     eTypeExternalConstructor,
     eTypeClassConstructor,
     eTypeClassProto,
-    eTypeExternalClassInfoCreator,
-    eTypeExternalClassInfo,
   } mType;
 
   // mChromeOnly is only used for structs that define non-WebIDL things
   // (possibly in addition to WebIDL ones).  In particular, it's not even
   // initialized for eTypeNewDOMBinding structs.
   bool mChromeOnly : 1;
   bool mAllowXBL : 1;
 
   union {
     int32_t mDOMClassInfoID; // eTypeClassConstructor
-    nsIID mIID; // eTypeInterface, eTypeClassProto
-    nsExternalDOMClassInfoData* mData; // eTypeExternalClassInfo
+    nsIID mIID; // eTypeClassProto
     nsCID mCID; // All other types except eTypeNewDOMBinding
   };
 
   // For new style DOM bindings.
   union {
     mozilla::dom::DefineInterface mDefineDOMInterface; // for window
     mozilla::dom::ConstructNavigatorProperty mConstructNavigatorProperty; // for navigator
   };
@@ -123,31 +119,16 @@ public:
                              bool aPrivileged,
                              bool aXBLAllowed,
                              const char16_t **aResult);
 
   nsresult RegisterClassProto(const char *aClassName,
                               const nsIID *aConstructorProtoIID,
                               bool *aFoundOld);
 
-  nsresult RegisterExternalInterfaces(bool aAsProto);
-
-  nsresult RegisterExternalClassName(const char *aClassName,
-                                     nsCID& aCID);
-
-  // Register the info for an external class. aName must be static
-  // data, it will not be deleted by the DOM code.
-  nsresult RegisterDOMCIData(const char *aName,
-                             nsDOMClassInfoExternalConstructorFnc aConstructorFptr,
-                             const nsIID *aProtoChainInterface,
-                             const nsIID **aInterfaces,
-                             uint32_t aScriptableFlags,
-                             bool aHasClassInterface,
-                             const nsCID *aConstructorCID);
-
   void RegisterDefineDOMInterface(const nsAFlatString& aName,
     mozilla::dom::DefineInterface aDefineDOMInterface,
     mozilla::dom::ConstructorEnabled* aConstructorEnabled);
   template<size_t N>
   void RegisterDefineDOMInterface(const char16_t (&aKey)[N],
     mozilla::dom::DefineInterface aDefineDOMInterface,
     mozilla::dom::ConstructorEnabled* aConstructorEnabled)
   {
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -33,17 +33,16 @@
 
 #include "nsIStyleRuleProcessor.h"
 #include "nsRuleProcessorData.h"
 #include "nsIWeakReference.h"
 
 #include "nsWrapperCacheInlines.h"
 #include "nsIXPConnect.h"
 #include "nsDOMCID.h"
-#include "nsIDOMScriptObjectFactory.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsTHashtable.h"
 
 #include "nsIScriptContext.h"
 #include "xpcpublic.h"
 #include "jswrapper.h"
 
 #include "nsThreadUtils.h"
--- a/dom/xbl/nsXBLDocumentInfo.cpp
+++ b/dom/xbl/nsXBLDocumentInfo.cpp
@@ -7,17 +7,16 @@
 #include "mozilla/DebugOnly.h"
 
 #include "nsXBLDocumentInfo.h"
 #include "nsIDocument.h"
 #include "nsXBLPrototypeBinding.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptContext.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMScriptObjectFactory.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsIURI.h"
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
 #include "nsIChromeRegistry.h"
 #include "nsIPrincipal.h"
 #include "nsJSPrincipals.h"
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -31,17 +31,16 @@
 #include "nsPIWindowRoot.h"
 #include "nsIDOMWindow.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptError.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsGkAtoms.h"
 #include "nsIXPConnect.h"
-#include "nsIDOMScriptObjectFactory.h"
 #include "mozilla/AddonPathService.h"
 #include "nsDOMCID.h"
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
 #include "nsXBLEventHandler.h"
 #include "nsXBLSerialize.h"
 #include "nsJSUtils.h"
 #include "mozilla/BasicEvents.h"
--- a/dom/xul/nsXULPrototypeCache.cpp
+++ b/dom/xul/nsXULPrototypeCache.cpp
@@ -98,16 +98,17 @@ nsXULPrototypeCache::GetInstance()
                                       kDisableXULCachePref);
 
         nsCOMPtr<nsIObserverService> obsSvc =
             mozilla::services::GetObserverService();
         if (obsSvc) {
             nsXULPrototypeCache *p = sInstance;
             obsSvc->AddObserver(p, "chrome-flush-skin-caches", false);
             obsSvc->AddObserver(p, "chrome-flush-caches", false);
+            obsSvc->AddObserver(p, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
             obsSvc->AddObserver(p, "startupcache-invalidate", false);
         }
 
     }
     return sInstance;
 }
 
 //----------------------------------------------------------------------
@@ -115,17 +116,18 @@ nsXULPrototypeCache::GetInstance()
 NS_IMETHODIMP
 nsXULPrototypeCache::Observe(nsISupports* aSubject,
                              const char *aTopic,
                              const char16_t *aData)
 {
     if (!strcmp(aTopic, "chrome-flush-skin-caches")) {
         FlushSkinFiles();
     }
-    else if (!strcmp(aTopic, "chrome-flush-caches")) {
+    else if (!strcmp(aTopic, "chrome-flush-caches") ||
+             !strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
         Flush();
     }
     else if (!strcmp(aTopic, "startupcache-invalidate")) {
         AbortCaching();
     }
     else {
         NS_WARNING("Unexpected observer topic.");
     }
--- a/dom/xul/nsXULPrototypeDocument.cpp
+++ b/dom/xul/nsXULPrototypeDocument.cpp
@@ -17,17 +17,16 @@
 #include "nsIServiceManager.h"
 #include "nsIArray.h"
 #include "nsIURI.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsString.h"
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
-#include "nsIDOMScriptObjectFactory.h"
 #include "nsDOMCID.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentUtils.h"
 #include "nsCCUncollectableMarker.h"
 #include "xpcpublic.h"
 #include "mozilla/dom/BindingUtils.h"
 
 using mozilla::dom::DestroyProtoAndIfaceCache;
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -70,17 +70,16 @@
 #include "mozilla/dom/FormData.h"
 #include "nsHostObjectProtocolHandler.h"
 #include "nsHostObjectURI.h"
 #include "nsGlobalWindowCommands.h"
 #include "nsIControllerCommandTable.h"
 #include "nsJSProtocolHandler.h"
 #include "nsScriptNameSpaceManager.h"
 #include "nsIControllerContext.h"
-#include "nsDOMScriptObjectFactory.h"
 #include "DOMStorageManager.h"
 #include "nsJSON.h"
 #include "nsZipArchive.h"
 #include "mozIApplicationClearPrivateDataParams.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMRequest.h"
 #include "mozilla/dom/network/UDPSocketChild.h"
@@ -619,18 +618,16 @@ static nsresult                         
         rv = NS_ERROR_OUT_OF_MEMORY;                                          \
         return rv;                                                            \
     }                                                                         \
     rv = inst->QueryInterface(aIID, aResult);                                 \
                                                                               \
     return rv;                                                                \
 }                                                                             \
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMScriptObjectFactory)
-
 #define NS_GEOLOCATION_CID \
   { 0x1E1C3FF, 0x94A, 0xD048, { 0x44, 0xB4, 0x62, 0xD2, 0x9C, 0x7B, 0x4F, 0x39 } }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(Geolocation, Init)
 
 #define NS_GEOLOCATION_SERVICE_CID \
   { 0x404d02a, 0x1CA, 0xAAAB, { 0x47, 0x62, 0x94, 0x4b, 0x1b, 0xf2, 0xf7, 0xb5 } }
 
@@ -741,17 +738,16 @@ NS_DEFINE_NAMED_CID(NS_NODATAPROTOCOLCON
 NS_DEFINE_NAMED_CID(NS_XULCONTROLLERS_CID);
 #ifdef MOZ_XUL
 NS_DEFINE_NAMED_CID(NS_XULSORTSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_XULTEMPLATEBUILDER_CID);
 NS_DEFINE_NAMED_CID(NS_XULTREEBUILDER_CID);
 NS_DEFINE_NAMED_CID(NS_XULDOCUMENT_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
-NS_DEFINE_NAMED_CID(NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
 NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_JSURI_CID);
 NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID);
 NS_DEFINE_NAMED_CID(NS_WINDOWCONTROLLER_CID);
 NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
 NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_VIDEODOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
@@ -1053,17 +1049,16 @@ static const mozilla::Module::CIDEntry k
   { &kNS_XULCONTROLLERS_CID, false, nullptr, NS_NewXULControllers },
 #ifdef MOZ_XUL
   { &kNS_XULSORTSERVICE_CID, false, nullptr, CreateXULSortService },
   { &kNS_XULTEMPLATEBUILDER_CID, false, nullptr, NS_NewXULContentBuilder },
   { &kNS_XULTREEBUILDER_CID, false, nullptr, NS_NewXULTreeBuilder },
   { &kNS_XULDOCUMENT_CID, false, nullptr, CreateXULDocument },
 #endif
   { &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, nullptr, CreateContentDLF },
-  { &kNS_DOM_SCRIPT_OBJECT_FACTORY_CID, false, nullptr, nsDOMScriptObjectFactoryConstructor },
   { &kNS_JSPROTOCOLHANDLER_CID, false, nullptr, nsJSProtocolHandler::Create },
   { &kNS_JSURI_CID, false, nullptr, nsJSURIConstructor },
   { &kNS_WINDOWCOMMANDTABLE_CID, false, nullptr, CreateWindowCommandTableConstructor },
   { &kNS_WINDOWCONTROLLER_CID, false, nullptr, CreateWindowControllerWithSingletonCommandTable },
   { &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF },
   { &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument },
   { &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument },
   { &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },