Bug 1510012 - Move Symbol-related APIs out of jsapi.h into js/public/Symbol.h. r=sfink, r=mccr8 for the bindings change
authorJeff Walden <jwalden@mit.edu>
Sat, 24 Nov 2018 12:21:40 -0800
changeset 504869 5634ba04016cfeef11e590311e4df234a5a2f1f8
parent 504868 6f83d4f776a707e3c642015fde291c1ad78a4189
child 504870 ef565bd9da88dc5d5e09ae2f181436a50848afea
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink, mccr8
bugs1510012
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1510012 - Move Symbol-related APIs out of jsapi.h into js/public/Symbol.h. r=sfink, r=mccr8 for the bindings change
dom/bindings/BindingUtils.cpp
dom/bindings/Codegen.py
dom/plugins/base/nsJSNPRuntime.cpp
js/ipc/JavaScriptShared.cpp
js/public/Symbol.h
js/src/builtin/Symbol.cpp
js/src/gdb/tests/test-GCCellPtr.cpp
js/src/gdb/tests/test-JSSymbol.cpp
js/src/gdb/tests/test-jsid.cpp
js/src/gdb/tests/test-jsval.cpp
js/src/jsapi-tests/testInformalValueTypeName.cpp
js/src/jsapi-tests/testSymbol.cpp
js/src/jsapi.cpp
js/src/jsapi.h
js/src/moz.build
js/src/vm/BytecodeUtil.cpp
js/src/vm/JSAtom.cpp
js/src/vm/Runtime.h
js/src/vm/StringType.cpp
js/src/vm/SymbolType.h
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/wrappers/FilteringWrapper.cpp
xpcom/reflect/xptinfo/xptinfo.cpp
xpcom/reflect/xptinfo/xptinfo.h
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -15,16 +15,17 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 #include "mozilla/UseCounter.h"
 
 #include "AccessCheck.h"
 #include "js/JSON.h"
 #include "js/StableStringChars.h"
+#include "js/Symbol.h"
 #include "jsfriendapi.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsGlobalWindow.h"
 #include "nsHTMLTags.h"
 #include "nsIDocShell.h"
 #include "nsIDOMGlobalPropertyInitializer.h"
 #include "nsINode.h"
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -13953,16 +13953,23 @@ class CGBindingRoot(CGThing):
                         props.isCrossOriginSetter)
 
             return any(hasCrossOriginProperty(m) for m in desc.interface.members)
 
         bindingDeclareHeaders["jsapi.h"] = any(descriptorHasCrossOriginProperties(d) for d in descriptors)
         bindingDeclareHeaders["jspubtd.h"] = not bindingDeclareHeaders["jsapi.h"]
         bindingDeclareHeaders["js/RootingAPI.h"] = not bindingDeclareHeaders["jsapi.h"]
 
+        def descriptorHasIteratorAlias(desc):
+            def hasIteratorAlias(m):
+                return m.isMethod() and "@@iterator" in m.aliases
+            return any(hasIteratorAlias(m) for m in desc.interface.members)
+
+        bindingHeaders["js/Symbol.h"] = any(descriptorHasIteratorAlias(d) for d in descriptors)
+
         def descriptorRequiresPreferences(desc):
             iface = desc.interface
             return any(m.getExtendedAttribute("Pref") for m in iface.members + [iface])
 
         def descriptorDeprecated(desc):
             iface = desc.interface
             return any(m.getExtendedAttribute("Deprecated") for m in iface.members + [iface])
 
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -20,16 +20,17 @@
 #include "nsJSUtils.h"
 #include "nsIDocument.h"
 #include "nsIXPConnect.h"
 #include "xpcpublic.h"
 #include "nsIContent.h"
 #include "nsPluginInstanceOwner.h"
 #include "nsWrapperCacheInlines.h"
 #include "js/GCHashTable.h"
+#include "js/Symbol.h"
 #include "js/TracingAPI.h"
 #include "js/Wrapper.h"
 #include "mozilla/HashFunctions.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/dom/ScriptSettings.h"
 
 #define NPRUNTIME_JSCLASS_NAME "NPObject JS wrapper class"
 
--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -5,16 +5,17 @@
  * 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/. */
 
 #include "JavaScriptShared.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/CPOWManagerGetter.h"
 #include "mozilla/dom/TabChild.h"
 #include "jsfriendapi.h"
+#include "js/Symbol.h"
 #include "xpcprivate.h"
 #include "WrapperFactory.h"
 #include "mozilla/Preferences.h"
 
 using namespace js;
 using namespace JS;
 using namespace mozilla;
 using namespace mozilla::jsipc;
new file mode 100644
--- /dev/null
+++ b/js/public/Symbol.h
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+/* Symbols. */
+
+#ifndef js_Symbol_h
+#define js_Symbol_h
+
+#include <stddef.h> // size_t
+#include <stdint.h> // uintptr_t, uint32_t
+
+#include "jstypes.h" // JS_PUBLIC_API
+
+#include "js/RootingAPI.h" // JS::Handle
+
+struct JSContext;
+class JSString;
+
+namespace JS {
+
+class Symbol;
+
+/**
+ * Create a new Symbol with the given description. This function never returns
+ * a Symbol that is in the Runtime-wide symbol registry.
+ *
+ * If description is null, the new Symbol's [[Description]] attribute is
+ * undefined.
+ */
+extern JS_PUBLIC_API Symbol*
+NewSymbol(JSContext* cx, Handle<JSString*> description);
+
+/**
+ * Symbol.for as specified in ES6.
+ *
+ * Get a Symbol with the description 'key' from the Runtime-wide symbol registry.
+ * If there is not already a Symbol with that description in the registry, a new
+ * Symbol is created and registered. 'key' must not be null.
+ */
+extern JS_PUBLIC_API Symbol*
+GetSymbolFor(JSContext* cx, Handle<JSString*> key);
+
+/**
+ * Get the [[Description]] attribute of the given symbol.
+ *
+ * This function is infallible. If it returns null, that means the symbol's
+ * [[Description]] is undefined.
+ */
+extern JS_PUBLIC_API JSString*
+GetSymbolDescription(Handle<Symbol*> symbol);
+
+/* Well-known symbols. */
+#define JS_FOR_EACH_WELL_KNOWN_SYMBOL(MACRO) \
+    MACRO(isConcatSpreadable) \
+    MACRO(iterator) \
+    MACRO(match) \
+    MACRO(replace) \
+    MACRO(search) \
+    MACRO(species) \
+    MACRO(hasInstance) \
+    MACRO(split) \
+    MACRO(toPrimitive) \
+    MACRO(toStringTag) \
+    MACRO(unscopables) \
+    MACRO(asyncIterator)
+
+enum class SymbolCode : uint32_t
+{
+    // There is one SymbolCode for each well-known symbol.
+#define JS_DEFINE_SYMBOL_ENUM(name) name,
+    JS_FOR_EACH_WELL_KNOWN_SYMBOL(JS_DEFINE_SYMBOL_ENUM)  // SymbolCode::iterator, etc.
+#undef JS_DEFINE_SYMBOL_ENUM
+    Limit,
+    WellKnownAPILimit = 0x80000000, // matches JS::shadow::Symbol::WellKnownAPILimit for inline use
+    InSymbolRegistry = 0xfffffffe,  // created by Symbol.for() or JS::GetSymbolFor()
+    UniqueSymbol = 0xffffffff       // created by Symbol() or JS::NewSymbol()
+};
+
+/* For use in loops that iterate over the well-known symbols. */
+const size_t WellKnownSymbolLimit = size_t(SymbolCode::Limit);
+
+/**
+ * Return the SymbolCode telling what sort of symbol `symbol` is.
+ *
+ * A symbol's SymbolCode never changes once it is created.
+ */
+extern JS_PUBLIC_API SymbolCode
+GetSymbolCode(Handle<Symbol*> symbol);
+
+/**
+ * Get one of the well-known symbols defined by ES6. A single set of well-known
+ * symbols is shared by all compartments in a JSRuntime.
+ *
+ * `which` must be in the range [0, WellKnownSymbolLimit).
+ */
+extern JS_PUBLIC_API Symbol*
+GetWellKnownSymbol(JSContext* cx, SymbolCode which);
+
+/**
+ * Return true if the given JSPropertySpec::name or JSFunctionSpec::name value
+ * is actually a symbol code and not a string. See JS_SYM_FN.
+ */
+inline bool
+PropertySpecNameIsSymbol(const char* name)
+{
+    uintptr_t u = reinterpret_cast<uintptr_t>(name);
+    return u != 0 && u - 1 < WellKnownSymbolLimit;
+}
+
+} // namespace JS
+
+#endif /* js_Symbol_h */
--- a/js/src/builtin/Symbol.cpp
+++ b/js/src/builtin/Symbol.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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/. */
 
 #include "builtin/Symbol.h"
 
+#include "js/Symbol.h"
 #include "util/StringBuffer.h"
 #include "vm/SymbolType.h"
 
 #include "vm/JSObject-inl.h"
 #include "vm/NativeObject-inl.h"
 
 using JS::Symbol;
 using namespace js;
--- a/js/src/gdb/tests/test-GCCellPtr.cpp
+++ b/js/src/gdb/tests/test-GCCellPtr.cpp
@@ -1,12 +1,13 @@
 #include "gdb-tests.h"
 #include "jsapi.h"
 
 #include "js/HeapAPI.h"
+#include "js/Symbol.h"
 
 FRAGMENT(GCCellPtr, simple) {
   JS::GCCellPtr nulll(nullptr);
 
   JS::Rooted<JSObject*> glob(cx, JS::CurrentGlobalOrNull(cx));
   JS::Rooted<JSString*> empty(cx, JS_NewStringCopyN(cx, nullptr, 0));
   JS::Rooted<JS::Symbol*> unique(cx, JS::NewSymbol(cx, nullptr));
 
--- a/js/src/gdb/tests/test-JSSymbol.cpp
+++ b/js/src/gdb/tests/test-JSSymbol.cpp
@@ -1,11 +1,13 @@
 #include "gdb-tests.h"
 #include "jsapi.h"
 
+#include "js/Symbol.h"
+
 FRAGMENT(JSSymbol, simple) {
   using namespace JS;
 
   RootedString hello(cx, JS_NewStringCopyZ(cx, "Hello!"));
 
   Rooted<Symbol*> unique(cx, NewSymbol(cx, nullptr));
   Rooted<Symbol*> unique_with_desc(cx, NewSymbol(cx, hello));
   Rooted<Symbol*> registry(cx, GetSymbolFor(cx, hello));
--- a/js/src/gdb/tests/test-jsid.cpp
+++ b/js/src/gdb/tests/test-jsid.cpp
@@ -1,11 +1,13 @@
 #include "gdb-tests.h"
 #include "jsapi.h"
 
+#include "js/Symbol.h"
+
 FRAGMENT(jsid, simple) {
   JS::Rooted<JSString*> string(cx, JS_NewStringCopyZ(cx, "moon"));
   JS::Rooted<JSString*> interned(cx, JS_AtomizeAndPinJSString(cx, string));
   JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
   jsid int_id = INT_TO_JSID(1729);
   JS::Rooted<jsid> unique_symbol_id(
       cx, SYMBOL_TO_JSID(JS::NewSymbol(cx, interned)));
   JS::Rooted<jsid> registry_symbol_id(
--- a/js/src/gdb/tests/test-jsval.cpp
+++ b/js/src/gdb/tests/test-jsval.cpp
@@ -1,11 +1,12 @@
 #include "gdb-tests.h"
 #include "jsapi.h"
 
+#include "js/Symbol.h"
 #ifdef ENABLE_BIGINT
 #include "vm/BigIntType.h"
 #endif
 
 FRAGMENT(jsval, simple) {
   using namespace JS;
 
   RootedValue fortytwo(cx, Int32Value(42));
--- a/js/src/jsapi-tests/testInformalValueTypeName.cpp
+++ b/js/src/jsapi-tests/testInformalValueTypeName.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  */
 /* 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/. */
 
+#include "js/Symbol.h"
 #include "jsapi-tests/tests.h"
 
 BEGIN_TEST(testInformalValueTypeName)
 {
     JS::RootedValue v1(cx, JS::ObjectOrNullValue(JS_NewPlainObject(cx)));
     CHECK(strcmp(JS::InformalValueTypeName(v1), "Object") == 0);
 
     JS::RootedValue v2(cx, JS::ObjectOrNullValue(JS_NewArrayObject(cx, 0)));
--- a/js/src/jsapi-tests/testSymbol.cpp
+++ b/js/src/jsapi-tests/testSymbol.cpp
@@ -1,12 +1,13 @@
 /* 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/. */
 
+#include "js/Symbol.h"
 #include "jsapi-tests/tests.h"
 
 BEGIN_TEST(testSymbol_New)
 {
     using namespace JS;
 
     RootedString desc(cx, nullptr);
     RootedSymbol sym1(cx);
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -61,16 +61,17 @@
 #include "js/JSON.h"
 #include "js/LocaleSensitive.h"
 #include "js/MemoryFunctions.h"
 #include "js/Proxy.h"
 #include "js/SliceBudget.h"
 #include "js/SourceText.h"
 #include "js/StableStringChars.h"
 #include "js/StructuredClone.h"
+#include "js/Symbol.h"
 #include "js/Utility.h"
 #include "js/Wrapper.h"
 #include "util/CompleteFile.h"
 #include "util/StringBuffer.h"
 #include "util/Text.h"
 #include "vm/AsyncFunction.h"
 #include "vm/AsyncIteration.h"
 #include "vm/DateObject.h"
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -4018,109 +4018,18 @@ JS_GetStringEncodingLength(JSContext* cx
  * encoded into bytes with no error reported. Otherwise it returns the number
  * of bytes that are necessary to encode the string. If that exceeds the
  * length parameter, the string will be cut and only length bytes will be
  * written into the buffer.
  */
 MOZ_MUST_USE JS_PUBLIC_API bool
 JS_EncodeStringToBuffer(JSContext* cx, JSString* str, char* buffer, size_t length);
 
-/************************************************************************/
-/*
- * Symbols
- */
-
 namespace JS {
 
-/**
- * Create a new Symbol with the given description. This function never returns
- * a Symbol that is in the Runtime-wide symbol registry.
- *
- * If description is null, the new Symbol's [[Description]] attribute is
- * undefined.
- */
-JS_PUBLIC_API Symbol*
-NewSymbol(JSContext* cx, HandleString description);
-
-/**
- * Symbol.for as specified in ES6.
- *
- * Get a Symbol with the description 'key' from the Runtime-wide symbol registry.
- * If there is not already a Symbol with that description in the registry, a new
- * Symbol is created and registered. 'key' must not be null.
- */
-JS_PUBLIC_API Symbol*
-GetSymbolFor(JSContext* cx, HandleString key);
-
-/**
- * Get the [[Description]] attribute of the given symbol.
- *
- * This function is infallible. If it returns null, that means the symbol's
- * [[Description]] is undefined.
- */
-JS_PUBLIC_API JSString*
-GetSymbolDescription(HandleSymbol symbol);
-
-/* Well-known symbols. */
-#define JS_FOR_EACH_WELL_KNOWN_SYMBOL(MACRO) \
-    MACRO(isConcatSpreadable) \
-    MACRO(iterator) \
-    MACRO(match) \
-    MACRO(replace) \
-    MACRO(search) \
-    MACRO(species) \
-    MACRO(hasInstance) \
-    MACRO(split) \
-    MACRO(toPrimitive) \
-    MACRO(toStringTag) \
-    MACRO(unscopables) \
-    MACRO(asyncIterator)
-
-enum class SymbolCode : uint32_t {
-    // There is one SymbolCode for each well-known symbol.
-#define JS_DEFINE_SYMBOL_ENUM(name) name,
-    JS_FOR_EACH_WELL_KNOWN_SYMBOL(JS_DEFINE_SYMBOL_ENUM)  // SymbolCode::iterator, etc.
-#undef JS_DEFINE_SYMBOL_ENUM
-    Limit,
-    WellKnownAPILimit = 0x80000000, // matches JS::shadow::Symbol::WellKnownAPILimit for inline use
-    InSymbolRegistry = 0xfffffffe,  // created by Symbol.for() or JS::GetSymbolFor()
-    UniqueSymbol = 0xffffffff       // created by Symbol() or JS::NewSymbol()
-};
-
-/* For use in loops that iterate over the well-known symbols. */
-const size_t WellKnownSymbolLimit = size_t(SymbolCode::Limit);
-
-/**
- * Return the SymbolCode telling what sort of symbol `symbol` is.
- *
- * A symbol's SymbolCode never changes once it is created.
- */
-JS_PUBLIC_API SymbolCode
-GetSymbolCode(Handle<Symbol*> symbol);
-
-/**
- * Get one of the well-known symbols defined by ES6. A single set of well-known
- * symbols is shared by all compartments in a JSRuntime.
- *
- * `which` must be in the range [0, WellKnownSymbolLimit).
- */
-JS_PUBLIC_API Symbol*
-GetWellKnownSymbol(JSContext* cx, SymbolCode which);
-
-/**
- * Return true if the given JSPropertySpec::name or JSFunctionSpec::name value
- * is actually a symbol code and not a string. See JS_SYM_FN.
- */
-inline bool
-PropertySpecNameIsSymbol(const char* name)
-{
-    uintptr_t u = reinterpret_cast<uintptr_t>(name);
-    return u != 0 && u - 1 < WellKnownSymbolLimit;
-}
-
 JS_PUBLIC_API bool
 PropertySpecNameEqualsId(const char* name, HandleId id);
 
 /**
  * Create a jsid that does not need to be marked for GC.
  *
  * 'name' is a JSPropertySpec::name or JSFunctionSpec::name value. The
  * resulting jsid, on success, is either an interned string or a well-known
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -151,16 +151,17 @@ EXPORTS.js += [
     '../public/RootingAPI.h',
     '../public/SavedFrameAPI.h',
     '../public/SliceBudget.h',
     '../public/SourceText.h',
     '../public/StableStringChars.h',
     '../public/Stream.h',
     '../public/StructuredClone.h',
     '../public/SweepingAPI.h',
+    '../public/Symbol.h',
     '../public/TraceKind.h',
     '../public/TraceLoggerAPI.h',
     '../public/TracingAPI.h',
     '../public/TrackedOptimizationInfo.h',
     '../public/Transcoding.h',
     '../public/TypeDecls.h',
     '../public/UbiNode.h',
     '../public/UbiNodeBreadthFirst.h',
--- a/js/src/vm/BytecodeUtil.cpp
+++ b/js/src/vm/BytecodeUtil.cpp
@@ -30,16 +30,17 @@
 
 #include "builtin/String.h"
 #include "frontend/BytecodeCompiler.h"
 #include "frontend/SourceNotes.h"
 #include "gc/FreeOp.h"
 #include "gc/GCInternals.h"
 #include "js/CharacterEncoding.h"
 #include "js/Printf.h"
+#include "js/Symbol.h"
 #include "util/StringBuffer.h"
 #include "util/Text.h"
 #include "vm/CodeCoverage.h"
 #include "vm/EnvironmentObject.h"
 #include "vm/JSAtom.h"
 #include "vm/JSContext.h"
 #include "vm/JSFunction.h"
 #include "vm/JSObject.h"
--- a/js/src/vm/JSAtom.cpp
+++ b/js/src/vm/JSAtom.cpp
@@ -17,16 +17,17 @@
 
 #include <string.h>
 
 #include "jstypes.h"
 
 #include "builtin/String.h"
 #include "gc/Marking.h"
 #include "js/CharacterEncoding.h"
+#include "js/Symbol.h"
 #include "util/Text.h"
 #include "vm/JSContext.h"
 #include "vm/SymbolType.h"
 #include "vm/Xdr.h"
 
 #include "gc/AtomMarking-inl.h"
 #include "vm/JSContext-inl.h"
 #include "vm/JSObject-inl.h"
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -32,16 +32,17 @@
 #include "irregexp/RegExpStack.h"
 #include "js/Debug.h"
 #include "js/GCVector.h"
 #include "js/HashTable.h"
 #ifdef DEBUG
 # include "js/Proxy.h" // For AutoEnterPolicy
 #endif
 #include "js/Stream.h"
+#include "js/Symbol.h"
 #include "js/UniquePtr.h"
 #include "js/Utility.h"
 #include "js/Vector.h"
 #include "threading/Thread.h"
 #include "vm/Caches.h"
 #include "vm/CodeCoverage.h"
 #include "vm/CommonPropertyNames.h"
 #include "vm/GeckoProfiler.h"
--- a/js/src/vm/StringType.cpp
+++ b/js/src/vm/StringType.cpp
@@ -22,16 +22,17 @@
 #include "jsfriendapi.h"
 
 #include "frontend/BytecodeCompiler.h"
 #include "gc/GCInternals.h"
 #include "gc/Marking.h"
 #include "gc/Nursery.h"
 #include "js/CharacterEncoding.h"
 #include "js/StableStringChars.h"
+#include "js/Symbol.h"
 #include "js/UbiNode.h"
 #include "util/StringBuffer.h"
 #include "vm/GeckoProfiler.h"
 
 #include "vm/GeckoProfiler-inl.h"
 #include "vm/JSContext-inl.h"
 #include "vm/JSObject-inl.h"
 #include "vm/Realm-inl.h"
--- a/js/src/vm/SymbolType.h
+++ b/js/src/vm/SymbolType.h
@@ -14,16 +14,17 @@
 #include "jsapi.h"
 
 #include "gc/Barrier.h"
 #include "gc/Tracer.h"
 #include "js/AllocPolicy.h"
 #include "js/GCHashTable.h"
 #include "js/HeapAPI.h"
 #include "js/RootingAPI.h"
+#include "js/Symbol.h"
 #include "js/TypeDecls.h"
 #include "js/Utility.h"
 #include "vm/Printer.h"
 #include "vm/StringType.h"
 
 namespace js {
 class AutoAccessAtomsZone;
 } // namespace js
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* An xpcom implementation of the JavaScript nsIID and nsCID objects. */
 
 #include "xpcprivate.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
+#include "js/Symbol.h"
 
 using namespace mozilla::dom;
 using namespace JS;
 
 namespace xpc {
 
 /******************************************************************************
  * # Generic IDs #
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -8,16 +8,17 @@
 
 #include "xpcprivate.h"
 #include "xpc_make_class.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/Preferences.h"
 #include "js/CharacterEncoding.h"
 #include "js/Class.h"
 #include "js/Printf.h"
+#include "js/Symbol.h"
 
 using namespace mozilla;
 using namespace JS;
 
 /***************************************************************************/
 
 // All of the exceptions thrown into JS from this file go through here.
 // That makes this a nice place to set a breakpoint.
--- a/js/xpconnect/wrappers/FilteringWrapper.cpp
+++ b/js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -7,16 +7,17 @@
 #include "FilteringWrapper.h"
 #include "AccessCheck.h"
 #include "ChromeObjectWrapper.h"
 #include "XrayWrapper.h"
 #include "nsJSUtils.h"
 #include "mozilla/ErrorResult.h"
 
 #include "jsapi.h"
+#include "js/Symbol.h"
 
 using namespace JS;
 using namespace js;
 
 namespace xpc {
 
 static JS::SymbolCode sCrossOriginWhitelistedSymbolCodes[] = {
     JS::SymbolCode::toStringTag,
--- a/xpcom/reflect/xptinfo/xptinfo.cpp
+++ b/xpcom/reflect/xptinfo/xptinfo.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 #include "xptinfo.h"
 #include "nsISupports.h"
 #include "mozilla/dom/DOMJSClass.h"
 #include "mozilla/ArrayUtils.h"
 
 #include "jsfriendapi.h"
+#include "js/Symbol.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace xpt::detail;
 
 
 ////////////////////////////////////
 // Constant Lookup Helper Methods //
--- a/xpcom/reflect/xptinfo/xptinfo.h
+++ b/xpcom/reflect/xptinfo/xptinfo.h
@@ -12,16 +12,17 @@
 
 #ifndef xptinfo_h
 #define xptinfo_h
 
 #include <stdint.h>
 #include "nsID.h"
 #include "mozilla/Assertions.h"
 #include "jsapi.h"
+#include "js/Symbol.h"
 #include "js/Value.h"
 #include "nsString.h"
 #include "nsTArray.h"
 
 // Forward Declarations
 namespace mozilla {
 namespace dom {
 struct NativePropertyHooks;