Bug 1501124 - Switch BackstagePass to use WebIDLGlobalNameHash, r=bzbarsky
authorNika Layzell <nika@thelayzells.com>
Wed, 24 Oct 2018 19:14:35 -0400
changeset 491294 01da72655339b6e9182e0cfb06e45ed7f0cb47ae
parent 491293 c8ca4a20631561e4a7a6cf68be07ec2eef2e7bd0
child 491295 2775681c72a3474e217b1790fe17d3afb0aa98bc
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersbzbarsky
bugs1501124
milestone65.0a1
Bug 1501124 - Switch BackstagePass to use WebIDLGlobalNameHash, r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D9736
dom/base/ContentFrameMessageManager.h
dom/base/ContentProcessMessageManager.cpp
dom/base/nsFrameMessageManager.cpp
dom/bindings/BindingUtils.cpp
dom/bindings/Codegen.py
dom/bindings/WebIDLGlobalNameHash.cpp
dom/bindings/WebIDLGlobalNameHash.h
dom/bindings/mozwebidlcodegen/__init__.py
js/xpconnect/src/XPCRuntimeService.cpp
js/xpconnect/src/nsXPConnect.cpp
tools/lint/eslint/eslint-plugin-mozilla/lib/environments/jsm.js
--- a/dom/base/ContentFrameMessageManager.h
+++ b/dom/base/ContentFrameMessageManager.h
@@ -4,17 +4,16 @@
  * 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 mozilla_dom_ContentFrameMessageManager_h
 #define mozilla_dom_ContentFrameMessageManager_h
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/dom/MessageManagerGlobal.h"
-#include "mozilla/dom/ResolveSystemBinding.h"
 #include "nsContentUtils.h"
 #include "xpcpublic.h"
 
 namespace mozilla {
 namespace dom {
 
 #define NS_CONTENTFRAMEMESSAGEMANAGER_IID \
 { 0x97e192a6, 0xab7a, 0x4c8f, \
--- a/dom/base/ContentProcessMessageManager.cpp
+++ b/dom/base/ContentProcessMessageManager.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ContentProcessMessageManager.h"
 
 #include "nsContentCID.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/MessageManagerBinding.h"
 #include "mozilla/dom/ParentProcessMessageManager.h"
-#include "mozilla/dom/ResolveSystemBinding.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/ipc/SharedMap.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 bool ContentProcessMessageManager::sWasCreated = false;
 
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -42,17 +42,16 @@
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/MessageManagerBinding.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ContentProcessMessageManager.h"
 #include "mozilla/dom/ParentProcessMessageManager.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/ProcessMessageManager.h"
-#include "mozilla/dom/ResolveSystemBinding.h"
 #include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "mozilla/dom/ipc/SharedMap.h"
 #include "mozilla/dom/ipc/StructuredCloneData.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "mozilla/recordreplay/ParentIPC.h"
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -51,17 +51,16 @@
 #include "mozilla/dom/HTMLElementBinding.h"
 #include "mozilla/dom/HTMLEmbedElementBinding.h"
 #include "mozilla/dom/XULElementBinding.h"
 #include "mozilla/dom/XULFrameElementBinding.h"
 #include "mozilla/dom/XULMenuElementBinding.h"
 #include "mozilla/dom/XULPopupElementBinding.h"
 #include "mozilla/dom/XULTextElementBinding.h"
 #include "mozilla/dom/Promise.h"
-#include "mozilla/dom/ResolveSystemBinding.h"
 #include "mozilla/dom/WebIDLGlobalNameHash.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerScope.h"
 #include "mozilla/dom/XrayExpandoClass.h"
 #include "mozilla/dom/XULScrollElementBinding.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
 #include "ipc/ErrorIPCUtils.h"
 #include "mozilla/UseCounter.h"
@@ -3507,39 +3506,16 @@ UnwrapWindowProxyImpl(JSContext* cx,
   nsresult rv = UnwrapArg<nsPIDOMWindowInner>(cx, src, getter_AddRefs(inner));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsPIDOMWindowOuter> outer = inner->GetOuterWindow();
   outer.forget(ppArg);
   return NS_OK;
 }
 
-bool
-SystemGlobalResolve(JSContext* cx, JS::Handle<JSObject*> obj,
-                    JS::Handle<jsid> id, bool* resolvedp)
-{
-  if (!ResolveGlobal(cx, obj, id, resolvedp)) {
-    return false;
-  }
-
-  if (*resolvedp) {
-    return true;
-  }
-
-  return ResolveSystemBinding(cx, obj, id, resolvedp);
-}
-
-bool
-SystemGlobalEnumerate(JSContext* cx, JS::Handle<JSObject*> obj)
-{
-  bool ignored = false;
-  return JS_EnumerateStandardClasses(cx, obj) &&
-         ResolveSystemBinding(cx, obj, JSID_VOIDHANDLE, &ignored);
-}
-
 template<decltype(JS::NewMapObject) Method>
 bool
 GetMaplikeSetlikeBackingObject(JSContext* aCx, JS::Handle<JSObject*> aObj,
                                size_t aSlotIndex,
                                JS::MutableHandle<JSObject*> aBackingObj,
                                bool* aBackingObjCreated)
 {
   JS::Rooted<JSObject*> reflector(aCx);
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -13571,131 +13571,16 @@ class CGRegisterWorkletBindings(CGAbstra
                     + condition)
             conditions.append(condition)
         lines = [CGIfWrapper(CGGeneric("return false;\n"), condition) for
                  condition in conditions]
         lines.append(CGGeneric("return true;\n"))
         return CGList(lines, "\n").define()
 
 
-class CGSystemBindingInitIds(CGAbstractMethod):
-    def __init__(self):
-        CGAbstractMethod.__init__(self, None, 'SystemBindingInitIds', 'bool',
-                                  [Argument('JSContext*', 'aCx')])
-
-    def definition_body(self):
-        return dedent("""
-            MOZ_ASSERT(NS_IsMainThread());
-
-            if (!idsInited) {
-              // We can't use range-based for because we need the index to call IdString.
-              for (uint32_t i = 0; i < ArrayLength(properties); ++i) {
-                if (!properties[i].id.init(aCx, IdString(i))) {
-                  return false;
-                }
-              }
-              idsInited = true;
-            }
-
-            return true;
-            """)
-
-
-class CGResolveSystemBinding(CGAbstractMethod):
-    def __init__(self):
-        CGAbstractMethod.__init__(self, None, 'ResolveSystemBinding', 'bool',
-                                  [Argument('JSContext*', 'aCx'),
-                                   Argument('JS::Handle<JSObject*>', 'aObj'),
-                                   Argument('JS::Handle<jsid>', 'aId'),
-                                   Argument('bool*', 'aResolvedp')])
-
-    def definition_body(self):
-        return dedent("""
-            MOZ_ASSERT(NS_IsMainThread());
-            MOZ_ASSERT(idsInited);
-
-            if (JSID_IS_VOID(aId)) {
-              for (const auto& property : properties) {
-                if (!property.enabled || property.enabled(aCx, aObj)) {
-                  if (!property.define(aCx)) {
-                    return false;
-                  }
-                  *aResolvedp = true;
-                }
-              }
-              return true;
-            }
-
-            for (const auto& property : properties) {
-              if (property.id == aId) {
-                if (!property.enabled || property.enabled(aCx, aObj)) {
-                  if (!property.define(aCx)) {
-                    return false;
-                  }
-                  *aResolvedp = true;
-                  break;
-                }
-              }
-            }
-            return true;
-            """)
-
-
-class CGMayResolveAsSystemBindingName(CGAbstractMethod):
-    def __init__(self):
-        CGAbstractMethod.__init__(self, None, 'MayResolveAsSystemBindingName', 'bool',
-                                  [Argument('jsid', 'aId')])
-
-    def definition_body(self):
-        return dedent("""
-            MOZ_ASSERT(NS_IsMainThread());
-            MOZ_ASSERT(idsInited);
-
-            for (const auto& property : properties) {
-              if (aId == property.id) {
-                return true;
-              }
-            }
-            return false;
-            """)
-
-
-class CGGetSystemBindingNames(CGAbstractMethod):
-    def __init__(self):
-        CGAbstractMethod.__init__(self, None, 'GetSystemBindingNames', 'void',
-                                  [Argument('JSContext*', 'aCx'),
-                                   Argument('JS::Handle<JSObject*>', 'aObj'),
-                                   Argument('JS::AutoIdVector&', 'aNames'),
-                                   Argument('bool', 'aEnumerableOnly'),
-                                   Argument('mozilla::ErrorResult&', 'aRv')])
-
-    def definition_body(self):
-        return dedent("""
-            MOZ_ASSERT(NS_IsMainThread());
-
-            if (aEnumerableOnly) {
-              return;
-            }
-
-            if (!SystemBindingInitIds(aCx)) {
-              aRv.NoteJSContextException(aCx);
-              return;
-            }
-
-            for (const auto& property : properties) {
-              if (!property.enabled || property.enabled(aCx, aObj)) {
-                if (!aNames.append(property.id)) {
-                  aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
-                  return;
-                }
-              }
-            }
-            """)
-
-
 def getGlobalNames(config):
     names = []
     for desc in config.getDescriptors(registersGlobalNamesOnWindow=True):
         names.append((desc.name, desc))
         names.extend((n.identifier.name, desc) for n in desc.interface.namedConstructors)
     return names
 
 class CGGlobalNames(CGGeneric):
@@ -17255,80 +17140,16 @@ class GlobalGenRoots():
 
         # Add include guards.
         curr = CGIncludeGuard('RegisterWorkletBindings', curr)
 
         # Done.
         return curr
 
     @staticmethod
-    def ResolveSystemBinding(config):
-        curr = CGList([], "\n")
-
-        descriptors = config.getDescriptors(hasInterfaceObject=True,
-                                            isExposedInWindow=True,
-                                            register=True)
-        properties = [desc.name for desc in descriptors]
-
-        curr.append(CGStringTable("IdString", properties, static=True))
-
-        initValues = []
-        for desc in descriptors:
-            bindingNS = toBindingNamespace(desc.name)
-            if desc.isExposedConditionally():
-                enabled = "%s::ConstructorEnabled" % bindingNS
-            else:
-                enabled = "nullptr"
-            define = "%s::GetConstructorObject" % bindingNS
-            initValues.append("{ %s, %s },\n" % (enabled, define))
-        curr.append(CGGeneric(fill("""
-            struct SystemProperty
-            {
-              WebIDLGlobalNameHash::ConstructorEnabled enabled;
-              ProtoGetter define;
-              PinnedStringId id;
-            };
-
-            static SystemProperty properties[] = {
-              $*{init}
-            };
-
-            static bool idsInited = false;
-            """,
-            init="".join(initValues))))
-
-        curr.append(CGSystemBindingInitIds())
-        curr.append(CGResolveSystemBinding())
-        curr.append(CGMayResolveAsSystemBindingName())
-        curr.append(CGGetSystemBindingNames())
-
-        # Wrap all of that in our namespaces.
-        curr = CGNamespace.build(['mozilla', 'dom'],
-                                 CGWrapper(curr, post='\n'))
-        curr = CGWrapper(curr, post='\n')
-
-        # Add the includes
-        defineIncludes = [CGHeaders.getDeclarationFilename(desc.interface)
-                          for desc in config.getDescriptors(hasInterfaceObject=True,
-                                                            register=True,
-                                                            isExposedInWindow=True)]
-        defineIncludes.append("nsThreadUtils.h")  # For NS_IsMainThread
-        defineIncludes.append("js/Id.h")  # For jsid
-        defineIncludes.append("mozilla/dom/WebIDLGlobalNameHash.h")
-
-        curr = CGHeaders([], [], [], [], [], defineIncludes,
-                         'ResolveSystemBinding', curr)
-
-        # Add include guards.
-        curr = CGIncludeGuard('ResolveSystemBinding', curr)
-
-        # Done.
-        return curr
-
-    @staticmethod
     def UnionTypes(config):
         unionTypes = UnionsForFile(config, None)
         (includes, implincludes, declarations,
          traverseMethods, unlinkMethods,
          unionStructs) = UnionTypes(unionTypes, config)
 
         unions = CGList(traverseMethods +
                         unlinkMethods +
--- a/dom/bindings/WebIDLGlobalNameHash.cpp
+++ b/dom/bindings/WebIDLGlobalNameHash.cpp
@@ -201,10 +201,84 @@ WebIDLGlobalNameHash::GetNames(JSContext
         return false;
       }
     }
   }
 
   return true;
 }
 
+/* static */
+bool
+WebIDLGlobalNameHash::ResolveForSystemGlobal(JSContext* aCx,
+                                             JS::Handle<JSObject*> aObj,
+                                             JS::Handle<jsid> aId,
+                                             bool* aResolvedp)
+{
+  MOZ_ASSERT(JS_IsGlobalObject(aObj));
+
+  // First we try to resolve standard classes.
+  if (!JS_ResolveStandardClass(aCx, aObj, aId, aResolvedp)) {
+    return false;
+  }
+  if (*aResolvedp) {
+    return true;
+  }
+
+  // We don't resolve any non-string entries.
+  if (!JSID_IS_STRING(aId)) {
+    return true;
+  }
+
+  // XXX(nika): In the Window case, we unwrap our global object here to handle
+  // XRays. I don't think we ever create xrays to system globals, so I believe
+  // we can skip this step.
+  MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(aObj), "Xrays not supported!");
+
+  // Look up the corresponding entry in the name table, and resolve if enabled.
+  const WebIDLNameTableEntry* entry = GetEntry(JSID_TO_FLAT_STRING(aId));
+  if (entry && (!entry->mEnabled || entry->mEnabled(aCx, aObj))) {
+    if (NS_WARN_IF(!GetPerInterfaceObjectHandle(aCx, entry->mConstructorId,
+                                                entry->mCreate,
+                                                /* aDefineOnGlobal = */ true))) {
+      return Throw(aCx, NS_ERROR_FAILURE);
+    }
+
+    *aResolvedp = true;
+  }
+  return true;
+}
+
+/* static */
+bool
+WebIDLGlobalNameHash::NewEnumerateSystemGlobal(JSContext* aCx,
+                                               JS::Handle<JSObject*> aObj,
+                                               JS::AutoIdVector& aProperties,
+                                               bool aEnumerableOnly)
+{
+  MOZ_ASSERT(JS_IsGlobalObject(aObj));
+
+  if (!JS_NewEnumerateStandardClasses(aCx, aObj, aProperties, aEnumerableOnly)) {
+    return false;
+  }
+
+  // All properties defined on our global are non-enumerable, so we can skip
+  // remaining properties.
+  if (aEnumerableOnly) {
+    return true;
+  }
+
+  // Enumerate all entries & add enabled ones.
+  for (size_t i = 0; i < sCount; ++i) {
+    const WebIDLNameTableEntry& entry = sEntries[i];
+    if (!entry.mEnabled || entry.mEnabled(aCx, aObj)) {
+      JSString* str = JS_AtomizeStringN(aCx, sNames + entry.mNameOffset,
+                                        entry.mNameLength);
+      if (!str || !aProperties.append(NON_INTEGER_ATOM_TO_JSID(str))) {
+        return false;
+      }
+    }
+  }
+  return true;
+}
+
 } // namespace dom
 } // namespace mozilla
--- a/dom/bindings/WebIDLGlobalNameHash.h
+++ b/dom/bindings/WebIDLGlobalNameHash.h
@@ -59,16 +59,27 @@ public:
     // aObj in the past (and therefore can't have been deleted).
     UnresolvedNamesOnly
   };
   // Returns false if an exception has been thrown on aCx.
   static bool GetNames(JSContext* aCx, JS::Handle<JSObject*> aObj,
                        NameType aNameType,
                        JS::AutoIdVector& aNames);
 
+  // Helpers for resolving & enumerating names on the system global.
+  // NOTE: These are distinct as it currently lacks a ProtoAndIfaceCache, and is
+  // an XPCOM global.
+  static bool ResolveForSystemGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj,
+                                     JS::Handle<jsid> aId, bool* aResolvedp);
+
+  static bool NewEnumerateSystemGlobal(JSContext* aCx,
+                                       JS::Handle<JSObject*> aObj,
+                                       JS::AutoIdVector& aProperties,
+                                       bool aEnumerableOnly);
+
 private:
   friend struct WebIDLNameTableEntry;
 
   // Look up an entry by key name. `nullptr` if the entry was not found.
   // The impl of GetEntry is generated by Codegen.py in RegisterBindings.cpp
   static const WebIDLNameTableEntry* GetEntry(JSFlatString* aKey);
 
   // The total number of names in the hash.
--- a/dom/bindings/mozwebidlcodegen/__init__.py
+++ b/dom/bindings/mozwebidlcodegen/__init__.py
@@ -129,28 +129,26 @@ class WebIDLCodegenManager(LoggingMixin)
     GLOBAL_DECLARE_FILES = {
         'GeneratedAtomList.h',
         'GeneratedEventList.h',
         'PrototypeList.h',
         'RegisterBindings.h',
         'RegisterWorkerBindings.h',
         'RegisterWorkerDebuggerBindings.h',
         'RegisterWorkletBindings.h',
-        'ResolveSystemBinding.h',
         'UnionConversions.h',
         'UnionTypes.h',
     }
 
     # Global parser derived definition files.
     GLOBAL_DEFINE_FILES = {
         'RegisterBindings.cpp',
         'RegisterWorkerBindings.cpp',
         'RegisterWorkerDebuggerBindings.cpp',
         'RegisterWorkletBindings.cpp',
-        'ResolveSystemBinding.cpp',
         'UnionTypes.cpp',
         'PrototypeList.cpp',
     }
 
     def __init__(self, config_path, webidl_root, inputs, exported_header_dir,
                  codegen_dir, state_path, cache_dir=None, make_deps_path=None,
                  make_deps_target=None):
         """Create an instance that manages WebIDLs in the build system.
--- a/js/xpconnect/src/XPCRuntimeService.cpp
+++ b/js/xpconnect/src/XPCRuntimeService.cpp
@@ -5,29 +5,36 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "xpcprivate.h"
 
 #include "nsContentUtils.h"
 #include "BackstagePass.h"
 #include "nsIPrincipal.h"
 #include "mozilla/dom/BindingUtils.h"
+#include "mozilla/dom/WebIDLGlobalNameHash.h"
+
+using namespace mozilla::dom;
 
 NS_IMPL_ISUPPORTS(BackstagePass,
                   nsIXPCScriptable,
                   nsIGlobalObject,
                   nsIClassInfo,
                   nsIScriptObjectPrincipal,
                   nsISupportsWeakReference)
 
+// XXX(nika): It appears we don't have support for mayresolve hooks in
+// nsIXPCScriptable, and I don't really want to add it because I'd rather just
+// kill nsIXPCScriptable alltogether, so we don't use it here.
+
 // The nsIXPCScriptable map declaration that will generate stubs for us...
 #define XPC_MAP_CLASSNAME         BackstagePass
 #define XPC_MAP_QUOTED_CLASSNAME "BackstagePass"
 #define XPC_MAP_FLAGS (XPC_SCRIPTABLE_WANT_RESOLVE | \
-                       XPC_SCRIPTABLE_WANT_ENUMERATE | \
+                       XPC_SCRIPTABLE_WANT_NEWENUMERATE | \
                        XPC_SCRIPTABLE_WANT_FINALIZE | \
                        XPC_SCRIPTABLE_WANT_PRECREATE | \
                        XPC_SCRIPTABLE_USE_JSSTUB_FOR_ADDPROPERTY |  \
                        XPC_SCRIPTABLE_USE_JSSTUB_FOR_DELPROPERTY |  \
                        XPC_SCRIPTABLE_DONT_ENUM_QUERY_INTERFACE |  \
                        XPC_SCRIPTABLE_IS_GLOBAL_OBJECT |  \
                        XPC_SCRIPTABLE_DONT_REFLECT_INTERFACE_NAMES)
 #include "xpc_map_end.h" /* This will #undef the above */
@@ -53,27 +60,31 @@ BackstagePass::SetGlobalObject(JSObject*
 NS_IMETHODIMP
 BackstagePass::Resolve(nsIXPConnectWrappedNative* wrapper,
                        JSContext * cx, JSObject * objArg,
                        jsid idArg, bool* resolvedp,
                        bool* _retval)
 {
     JS::RootedObject obj(cx, objArg);
     JS::RootedId id(cx, idArg);
-    *_retval = mozilla::dom::SystemGlobalResolve(cx, obj, id, resolvedp);
+    *_retval =
+        WebIDLGlobalNameHash::ResolveForSystemGlobal(cx, obj, id, resolvedp);
     return *_retval ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-BackstagePass::Enumerate(nsIXPConnectWrappedNative* wrapper, JSContext* cx,
-                         JSObject* objArg, bool* _retval)
+BackstagePass::NewEnumerate(nsIXPConnectWrappedNative* wrapper, JSContext* cx,
+                            JSObject* objArg, JS::AutoIdVector& properties,
+                            bool enumerableOnly, bool* _retval)
 {
     JS::RootedObject obj(cx, objArg);
-    *_retval = mozilla::dom::SystemGlobalEnumerate(cx, obj);
-    return *_retval ? NS_OK : NS_ERROR_FAILURE;
+    *_retval =
+        WebIDLGlobalNameHash::NewEnumerateSystemGlobal(cx, obj, properties,
+                                                       enumerableOnly);
+    return *_retval ?  NS_OK : NS_ERROR_FAILURE;
 }
 
 /***************************************************************************/
 NS_IMETHODIMP
 BackstagePass::GetInterfaces(uint32_t* aCount, nsIID * **aArray)
 {
     *aCount = 2;
     nsIID** array = static_cast<nsIID**>(moz_xmalloc(2 * sizeof(nsIID*)));
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -22,17 +22,16 @@
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/DOMPrefs.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/Promise.h"
-#include "mozilla/dom/ResolveSystemBinding.h"
 
 #include "nsDOMMutationObserver.h"
 #include "nsICycleCollectorListener.h"
 #include "nsCycleCollector.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsScriptSecurityManager.h"
 #include "nsIPermissionManager.h"
@@ -575,20 +574,16 @@ InitClassesWithNewWrappedGlobal(JSContex
 {
     MOZ_ASSERT(aJSContext, "bad param");
     MOZ_ASSERT(aCOMObj, "bad param");
 
     // We pass null for the 'extra' pointer during global object creation, so
     // we need to have a principal.
     MOZ_ASSERT(aPrincipal);
 
-    if (!SystemBindingInitIds(aJSContext)) {
-      return NS_ERROR_FAILURE;
-    }
-
     InitGlobalObjectOptions(aOptions, aPrincipal);
 
     // Call into XPCWrappedNative to make a new global object, scope, and global
     // prototype.
     xpcObjectHelper helper(aCOMObj);
     MOZ_ASSERT(helper.GetScriptableFlags() & XPC_SCRIPTABLE_IS_GLOBAL_OBJECT);
     RefPtr<XPCWrappedNative> wrappedGlobal;
     nsresult rv =
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/jsm.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/jsm.js
@@ -18,18 +18,18 @@ module.exports = {
     "btoa": false,
     "debug": false,
     "dump": false,
     // These globals are defined in XPCWrappedNativeScope::AttachComponentsObject.
     "Cc": false,
     "Ci": false,
     "Cr": false,
     "Cu": false,
-    // These globals are made available via WebIDL files, see ResolveSystemBinding in:
-    // https://searchfox.org/mozilla-central/source/__GENERATED__/dom/bindings/ResolveSystemBinding.cpp
+    // These globals are made available via WebIDL files, see WebIDLGlobalNameHash.
+    // XXX(nika): We should also explicitly include window-defined globals here now.
     "AbortController": false,
     "AbortSignal": false,
     "AddonManagerPermissions": false,
     "ChannelWrapper": false,
     "ChromeUtils": false,
     "ChromeWorker": false,
     "DOMError": false,
     "DOMException": false,