From 9d7bf3da5c1f2f483bfcacccce3b9faed32f053b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Mar 2018 23:13:29 -0400 Subject: [PATCH] Bug 1442039 part 8. Remove now-unused eTypeClassConstructor type of nsGlobalNameStruct. r=peterv GetXPCProto is now static and not called, so needs to go too. MozReview-Commit-ID: I6DilDx2e2m --- dom/base/nsDOMClassInfo.cpp | 41 ----------------------------- dom/base/nsScriptNameSpaceManager.h | 2 -- 2 files changed, 43 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 635cd8e2280b..2bda14e1d10a 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -491,29 +491,6 @@ nsDOMClassInfo::ShutDown() sIsInitialized = false; } -static nsresult -GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindowInner *aWin, - const nsGlobalNameStruct *aNameStruct, - JS::MutableHandle aProto) -{ - NS_ASSERTION(aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor, - "Wrong type!"); - - int32_t id = aNameStruct->mDOMClassInfoID; - MOZ_ASSERT(id >= 0, "Negative DOM classinfo?!?"); - - nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id; - - nsCOMPtr 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; -} - static nsresult LookupComponentsShim(JSContext *cx, JS::Handle global, nsPIDOMWindowInner *win, @@ -606,24 +583,6 @@ nsWindowSH::GlobalResolve(nsGlobalWindowInner *aWin, JSContext *cx, nsresult rv = NS_OK; - if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) { - // The only eTypeClassConstructor struct left is DOMConstructor. - MOZ_ASSERT(name.EqualsLiteral("DOMConstructor")); - - // 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 dot_prototype(cx); - rv = GetXPCProto(nsDOMClassInfo::sXPConnect, cx, aWin, name_struct, - &dot_prototype); - NS_ENSURE_SUCCESS(rv, rv); - MOZ_ASSERT(dot_prototype); - - // GetXPCProto already defined the property for us if needed. - FillPropertyDescriptor(desc, obj, JS::UndefinedValue(), false); - return NS_OK; - } - if (name_struct->mType == nsGlobalNameStruct::eTypeProperty) { // Before defining a global property, check for a named subframe of the // same name. If it exists, we don't want to shadow it. diff --git a/dom/base/nsScriptNameSpaceManager.h b/dom/base/nsScriptNameSpaceManager.h index c076d0ed4749..798b3a14e8fa 100644 --- a/dom/base/nsScriptNameSpaceManager.h +++ b/dom/base/nsScriptNameSpaceManager.h @@ -24,11 +24,9 @@ struct nsGlobalNameStruct enum nametype { eTypeNotInitialized, eTypeProperty, - eTypeClassConstructor, } mType; union { - int32_t mDOMClassInfoID; // eTypeClassConstructor nsCID mCID; // eTypeProperty }; };