Bug 1442039 part 13. Remove the now-pointless nsWindowSH::NameStructEnabled. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 21 Mar 2018 23:13:29 -0400
changeset 409448 4a94ee5c9105a1c5ecea35a7d1b5114277969905
parent 409447 a9a5c2206177b487b3b3dc4ed7e93c14e7551e29
child 409449 b68c19a47cab2a8cd03b6a675ac1e75125edea22
push id33687
push userapavel@mozilla.com
push dateThu, 22 Mar 2018 09:31:48 +0000
treeherdermozilla-central@7771df14ea18 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1442039
milestone61.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 1442039 part 13. Remove the now-pointless nsWindowSH::NameStructEnabled. r=peterv MozReview-Commit-ID: 9lawfsdyyZq
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsGlobalWindowInner.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -114,27 +114,16 @@ nsDOMClassInfo::ShutDown()
   sIsInitialized = false;
 }
 
 static nsresult
 LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
                      nsPIDOMWindowInner *win,
                      JS::MutableHandle<JS::PropertyDescriptor> desc);
 
-// static
-bool
-nsWindowSH::NameStructEnabled(JSContext* aCx, nsGlobalWindowInner *aWin,
-                              const nsAString& aName,
-                              const nsGlobalNameStruct& aNameStruct)
-{
-  // DOMConstructor is special: creating its proto does not actually define it
-  // as a property on the global.  So we don't want to expose its name either.
-  return !aName.EqualsLiteral("DOMConstructor");
-}
-
 #ifdef RELEASE_OR_BETA
 #define USE_CONTROLLERS_SHIM
 #endif
 
 #ifdef USE_CONTROLLERS_SHIM
 static const JSClass ControllersShimClass = {
     "Controllers", 0
 };
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -10,26 +10,21 @@
 #include "mozilla/Attributes.h"
 #include "nsDOMClassInfoID.h"
 #include "nsIXPCScriptable.h"
 #include "nsIScriptGlobalObject.h"
 #include "js/Class.h"
 #include "js/Id.h"
 #include "nsIXPConnect.h"
 
-struct nsGlobalNameStruct;
 class nsGlobalWindowInner;
 class nsGlobalWindowOuter;
 
-class nsWindowSH;
-
 class nsDOMClassInfo
 {
-  friend class nsWindowSH;
-
 public:
   static nsresult Init();
   static void ShutDown();
 
 protected:
   static bool sIsInitialized;
 };
 
@@ -39,20 +34,16 @@ class nsWindowSH
 {
 protected:
   static nsresult GlobalResolve(nsGlobalWindowInner *aWin, JSContext *cx,
                                 JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
                                 JS::MutableHandle<JS::PropertyDescriptor> desc);
 
   friend class nsGlobalWindowInner;
   friend class nsGlobalWindowOuter;
-public:
-  static bool NameStructEnabled(JSContext* aCx, nsGlobalWindowInner *aWin,
-                                const nsAString& aName,
-                                const nsGlobalNameStruct& aNameStruct);
 };
 
 
 // Event handler 'this' translator class, this is called by XPConnect
 // when a "function interface" (nsIDOMEventListener) is called, this
 // class extracts 'this' fomr the first argument to the called
 // function (nsIDOMEventListener::HandleEvent(in nsIDOMEvent)), this
 // class will pass back nsIDOMEvent::currentTarget to be used as
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -2937,20 +2937,18 @@ void
 nsGlobalWindowInner::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
                                          bool aEnumerableOnly, ErrorResult& aRv)
 {
   if (aEnumerableOnly) {
     // The names we would return from here get defined on the window via one of
     // two codepaths.  The ones coming from the WebIDLGlobalNameHash will end up
     // in the DefineConstructor function in BindingUtils, which always defines
     // things as non-enumerable.  The ones coming from the script namespace
-    // manager get defined by nsDOMClassInfo::PostCreatePrototype calling
-    // ResolvePrototype and using the resulting descriptot to define the
-    // property.  ResolvePrototype always passes 0 to the FillPropertyDescriptor
-    // for the property attributes, so all those are non-enumerable as well.
+    // manager get defined by our resolve hook using FillPropertyDescriptor with
+    // 0 for the property attributes, so non-enumerable as well.
     //
     // So in the aEnumerableOnly case we have nothing to do.
     return;
   }
 
   // "Components" is marked as enumerable but only resolved on demand :-/.
   //aNames.AppendElement(NS_LITERAL_STRING("Components"));
 
@@ -2973,27 +2971,24 @@ nsGlobalWindowInner::GetOwnPropertyNames
         WebIDLGlobalNameHash::UnresolvedNamesOnly :
         WebIDLGlobalNameHash::AllNames;
     if (!WebIDLGlobalNameHash::GetNames(aCx, wrapper, nameType, aNames)) {
       aRv.NoteJSContextException(aCx);
     }
 
     for (auto i = nameSpaceManager->GlobalNameIter(); !i.Done(); i.Next()) {
       const GlobalNameMapEntry* entry = i.Get();
-      if (nsWindowSH::NameStructEnabled(aCx, this, entry->mKey,
-                                        entry->mGlobalName)) {
-        // Just append all of these; even if they get deleted our resolve hook
-        // just goes ahead and recreates them.
-        JSString* str = JS_AtomizeUCStringN(aCx,
-                                            entry->mKey.BeginReading(),
-                                            entry->mKey.Length());
-        if (!str || !aNames.append(NON_INTEGER_ATOM_TO_JSID(str))) {
-          aRv.NoteJSContextException(aCx);
-          return;
-        }
+      // Just append all of these; even if they get deleted our resolve hook
+      // just goes ahead and recreates them.
+      JSString* str = JS_AtomizeUCStringN(aCx,
+                                          entry->mKey.BeginReading(),
+                                          entry->mKey.Length());
+      if (!str || !aNames.append(NON_INTEGER_ATOM_TO_JSID(str))) {
+        aRv.NoteJSContextException(aCx);
+        return;
       }
     }
   }
 }
 
 /* static */ bool
 nsGlobalWindowInner::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj)
 {