Bug 1726123 - Part 1: Remove unnecessary includes to jsapi.h and jsfriendapi.h. r=arai
authorAndré Bargull <andre.bargull@gmail.com>
Tue, 17 Aug 2021 15:45:37 +0000
changeset 589112 fb7bc8bee56b869843e355626f32b14b131a9df6
parent 589111 d6e1ffa0037226b64e43614f9c4faab77d89d425
child 589113 a9112502282244b5d783bdc1d2287ce0475c471c
push id38714
push usernbeleuzu@mozilla.com
push dateTue, 17 Aug 2021 21:49:10 +0000
treeherdermozilla-central@659f053820bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1726123
milestone93.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 1726123 - Part 1: Remove unnecessary includes to jsapi.h and jsfriendapi.h. r=arai Remove includes to "jsapi.h" and "jsfriendapi.h" based on IWYU. And then fix any missing transitive includes. Only removes includes to "jsapi.h" and "jsfriendapi.h", no other missing or unnecessary includes were updated! Differential Revision: https://phabricator.services.mozilla.com/D122839
js/public/UbiNodeCensus.h
js/src/builtin/Array.cpp
js/src/builtin/AtomicsObject.cpp
js/src/builtin/BigInt.cpp
js/src/builtin/Boolean.cpp
js/src/builtin/DataViewObject.cpp
js/src/builtin/Object.h
js/src/builtin/String.cpp
js/src/builtin/WeakMapObject.cpp
js/src/builtin/WeakSetObject.cpp
js/src/builtin/intl/Collator.cpp
js/src/builtin/intl/DateTimeFormat.cpp
js/src/builtin/intl/DisplayNames.cpp
js/src/builtin/intl/IntlObject.cpp
js/src/builtin/intl/LanguageTag.cpp
js/src/builtin/intl/Locale.cpp
js/src/builtin/streams/MiscellaneousOperations.cpp
js/src/builtin/streams/PipeToState.cpp
js/src/builtin/streams/QueueWithSizes.cpp
js/src/builtin/streams/ReadableStream.cpp
js/src/builtin/streams/ReadableStreamBYOBReader.cpp
js/src/builtin/streams/ReadableStreamDefaultController.cpp
js/src/builtin/streams/ReadableStreamDefaultReader.cpp
js/src/builtin/streams/StreamAPI.cpp
js/src/builtin/streams/WritableStream.cpp
js/src/builtin/streams/WritableStreamDefaultControllerOperations.cpp
js/src/builtin/streams/WritableStreamDefaultWriter.cpp
js/src/builtin/streams/WritableStreamOperations.cpp
js/src/builtin/streams/WritableStreamWriterOperations.cpp
js/src/debugger/DebugScript.cpp
js/src/debugger/DebugScript.h
js/src/debugger/Debugger.h
js/src/debugger/DebuggerMemory.h
js/src/debugger/Environment.cpp
js/src/debugger/Frame.cpp
js/src/debugger/Frame.h
js/src/debugger/NoExecute.cpp
js/src/debugger/NoExecute.h
js/src/debugger/Object.h
js/src/debugger/Script.cpp
js/src/debugger/Script.h
js/src/debugger/Source.cpp
js/src/debugger/Source.h
js/src/gc/Pretenuring.h
js/src/jit/ProcessExecutableMemory.cpp
js/src/jsexn.h
js/src/proxy/DeadObjectProxy.cpp
js/src/proxy/Proxy.cpp
js/src/proxy/SecurityWrapper.cpp
js/src/shell/OSObject.h
js/src/shell/jsshell.h
js/src/util/CompleteFile.cpp
js/src/vm/ArrayBufferObject.cpp
js/src/vm/BigIntType.cpp
js/src/vm/EqualityOperations.cpp
js/src/vm/ErrorObject.cpp
js/src/vm/ErrorReporting.h
js/src/vm/Exception.cpp
js/src/vm/Modules.cpp
js/src/vm/NativeObject.h
js/src/vm/ObjectOperations-inl.h
js/src/vm/ObjectOperations.h
js/src/vm/PropertyAndElement.cpp
js/src/vm/PropertyDescriptor.cpp
js/src/vm/Runtime.cpp
js/src/vm/SavedStacks.cpp
js/src/vm/SelfHosting.h
js/src/vm/Shape.h
js/src/vm/SharedArrayObject.cpp
js/src/vm/SharedArrayObject.h
js/src/vm/StringType.h
js/src/vm/StructuredClone.cpp
js/src/vm/SymbolType.h
js/src/vm/ToSource.cpp
js/src/vm/TraceLogging.h
js/src/vm/TypedArrayObject.cpp
js/src/vm/Warnings.cpp
js/src/vm/WindowProxy.cpp
js/src/vm/Xdr.cpp
--- a/js/public/UbiNodeCensus.h
+++ b/js/public/UbiNodeCensus.h
@@ -7,18 +7,16 @@
 #ifndef js_UbiNodeCensus_h
 #define js_UbiNodeCensus_h
 
 #include "mozilla/Attributes.h"
 
 #include <algorithm>
 #include <utility>
 
-#include "jsapi.h"
-
 #include "js/UbiNode.h"
 #include "js/UbiNodeBreadthFirst.h"
 
 // A census is a ubi::Node traversal that assigns each node to one or more
 // buckets, and returns a report with the size of each bucket.
 //
 // We summarize the results of a census with counts broken down according to
 // criteria selected by the API consumer code that is requesting the census. For
--- a/js/src/builtin/Array.cpp
+++ b/js/src/builtin/Array.cpp
@@ -10,17 +10,16 @@
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/TextUtils.h"
 
 #include <algorithm>
 #include <iterator>
 
-#include "jsapi.h"
 #include "jsfriendapi.h"
 #include "jsnum.h"
 #include "jstypes.h"
 
 #include "ds/Sort.h"
 #include "gc/Allocator.h"
 #include "jit/InlinableNatives.h"
 #include "js/CallAndConstruct.h"  // JS::Construct, JS::IsCallable, JS::IsConstructor
--- a/js/src/builtin/AtomicsObject.cpp
+++ b/js/src/builtin/AtomicsObject.cpp
@@ -15,17 +15,16 @@
 
 #include "mozilla/Atomics.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/ScopeExit.h"
 
 #include "jsapi.h"
-#include "jsfriendapi.h"
 #include "jsnum.h"
 
 #include "jit/AtomicOperations.h"
 #include "jit/InlinableNatives.h"
 #include "js/Class.h"
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/PropertySpec.h"
 #include "js/Result.h"
--- a/js/src/builtin/BigInt.cpp
+++ b/js/src/builtin/BigInt.cpp
@@ -1,18 +1,16 @@
 /* -*- 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/. */
 
 #include "builtin/BigInt.h"
 
-#include "jsapi.h"
-
 #include "gc/Tracer.h"
 #include "jit/InlinableNatives.h"
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/PropertySpec.h"
 #include "js/TracingAPI.h"
 #include "vm/ArrayBufferObject.h"
 #include "vm/BigIntType.h"
 #include "vm/SelfHosting.h"
--- a/js/src/builtin/Boolean.cpp
+++ b/js/src/builtin/Boolean.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * JS boolean implementation.
  */
 
 #include "builtin/Boolean-inl.h"
 
-#include "jsapi.h"
 #include "jstypes.h"
 
 #include "jit/InlinableNatives.h"
 #include "js/PropertySpec.h"
 #include "util/StringBuffer.h"
 #include "vm/BigIntType.h"
 #include "vm/GlobalObject.h"
 #include "vm/JSAtom.h"
--- a/js/src/builtin/DataViewObject.cpp
+++ b/js/src/builtin/DataViewObject.cpp
@@ -10,17 +10,16 @@
 #include "mozilla/EndianUtils.h"
 #include "mozilla/IntegerTypeTraits.h"
 #include "mozilla/WrappingOperations.h"
 
 #include <algorithm>
 #include <string.h>
 #include <type_traits>
 
-#include "jsapi.h"
 #include "jsnum.h"
 
 #include "builtin/Array.h"
 #include "jit/AtomicOperations.h"
 #include "jit/InlinableNatives.h"
 #include "js/CallAndConstruct.h"  // JS::Construct
 #include "js/Conversions.h"
 #include "js/experimental/TypedData.h"  // JS_NewDataView
--- a/js/src/builtin/Object.h
+++ b/js/src/builtin/Object.h
@@ -2,18 +2,16 @@
  * 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 builtin_Object_h
 #define builtin_Object_h
 
-#include "jsapi.h"
-
 #include "js/Value.h"
 #include "vm/NativeObject.h"
 
 namespace js {
 
 class PlainObject;
 
 // Object constructor native. Exposed only so the JIT can know its address.
--- a/js/src/builtin/String.cpp
+++ b/js/src/builtin/String.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/Range.h"
 #include "mozilla/TextUtils.h"
 
 #include <algorithm>
 #include <limits>
 #include <string.h>
 #include <type_traits>
 
-#include "jsapi.h"
 #include "jsnum.h"
 #include "jstypes.h"
 
 #include "builtin/Array.h"
 #include "builtin/Boolean.h"
 #if JS_HAS_INTL_API
 #  include "builtin/intl/CommonFunctions.h"
 #endif
--- a/js/src/builtin/WeakMapObject.cpp
+++ b/js/src/builtin/WeakMapObject.cpp
@@ -1,18 +1,16 @@
 /* -*- 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/. */
 
 #include "builtin/WeakMapObject-inl.h"
 
-#include "jsapi.h"
-
 #include "builtin/WeakSetObject.h"
 #include "gc/FreeOp.h"
 #include "js/friend/ErrorMessages.h"  // JSMSG_*
 #include "js/PropertySpec.h"
 #include "vm/JSContext.h"
 #include "vm/SelfHosting.h"
 
 #include "vm/Interpreter-inl.h"
--- a/js/src/builtin/WeakSetObject.cpp
+++ b/js/src/builtin/WeakSetObject.cpp
@@ -1,18 +1,16 @@
 /* -*- 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/. */
 
 #include "builtin/WeakSetObject.h"
 
-#include "jsapi.h"
-
 #include "builtin/MapObject.h"
 #include "js/friend/ErrorMessages.h"  // JSMSG_*
 #include "js/PropertySpec.h"
 #include "vm/GlobalObject.h"
 #include "vm/Iteration.h"
 #include "vm/JSContext.h"
 #include "vm/SelfHosting.h"
 
--- a/js/src/builtin/intl/Collator.cpp
+++ b/js/src/builtin/intl/Collator.cpp
@@ -7,18 +7,16 @@
 /* Intl.Collator implementation. */
 
 #include "builtin/intl/Collator.h"
 
 #include "mozilla/Assertions.h"
 #include "mozilla/intl/Collator.h"
 #include "mozilla/Span.h"
 
-#include "jsapi.h"
-
 #include "builtin/Array.h"
 #include "builtin/intl/CommonFunctions.h"
 #include "builtin/intl/LanguageTag.h"
 #include "builtin/intl/ScopedICUObject.h"
 #include "builtin/intl/SharedIntlData.h"
 #include "gc/FreeOp.h"
 #include "js/CharacterEncoding.h"
 #include "js/PropertySpec.h"
--- a/js/src/builtin/intl/DateTimeFormat.cpp
+++ b/js/src/builtin/intl/DateTimeFormat.cpp
@@ -11,18 +11,16 @@
 #include "mozilla/Assertions.h"
 #include "mozilla/EnumSet.h"
 #include "mozilla/intl/Calendar.h"
 #include "mozilla/intl/DateTimeFormat.h"
 #include "mozilla/intl/DateTimePatternGenerator.h"
 #include "mozilla/Range.h"
 #include "mozilla/Span.h"
 
-#include "jsfriendapi.h"
-
 #include "builtin/Array.h"
 #include "builtin/intl/CommonFunctions.h"
 #include "builtin/intl/FormatBuffer.h"
 #include "builtin/intl/LanguageTag.h"
 #include "builtin/intl/ScopedICUObject.h"
 #include "builtin/intl/SharedIntlData.h"
 #include "builtin/intl/TimeZoneDataGenerated.h"
 #include "gc/FreeOp.h"
--- a/js/src/builtin/intl/DisplayNames.cpp
+++ b/js/src/builtin/intl/DisplayNames.cpp
@@ -12,18 +12,16 @@
 #include "mozilla/intl/DateTimePatternGenerator.h"
 #include "mozilla/Span.h"
 #include "mozilla/TextUtils.h"
 
 #include <algorithm>
 #include <cstring>
 #include <iterator>
 
-#include "jsapi.h"
-#include "jsfriendapi.h"
 #include "jsnum.h"
 #include "jspubtd.h"
 
 #include "builtin/intl/CommonFunctions.h"
 #include "builtin/intl/LanguageTag.h"
 #include "builtin/intl/ScopedICUObject.h"
 #include "builtin/intl/SharedIntlData.h"
 #include "builtin/String.h"
--- a/js/src/builtin/intl/IntlObject.cpp
+++ b/js/src/builtin/intl/IntlObject.cpp
@@ -10,18 +10,16 @@
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Likely.h"
 #include "mozilla/Range.h"
 
 #include <algorithm>
 #include <iterator>
 
-#include "jsapi.h"
-
 #include "builtin/Array.h"
 #include "builtin/intl/Collator.h"
 #include "builtin/intl/CommonFunctions.h"
 #include "builtin/intl/DateTimeFormat.h"
 #include "builtin/intl/LanguageTag.h"
 #include "builtin/intl/NumberFormat.h"
 #include "builtin/intl/PluralRules.h"
 #include "builtin/intl/RelativeTimeFormat.h"
--- a/js/src/builtin/intl/LanguageTag.cpp
+++ b/js/src/builtin/intl/LanguageTag.cpp
@@ -17,19 +17,16 @@
 #include <iterator>
 #include <stddef.h>
 #include <stdint.h>
 #include <string>
 #include <string.h>
 #include <type_traits>
 #include <utility>
 
-#include "jsapi.h"
-#include "jsfriendapi.h"
-
 #include "builtin/intl/CommonFunctions.h"
 #include "ds/Sort.h"
 #include "gc/Tracer.h"
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/Result.h"
 #include "js/TracingAPI.h"
 #include "js/Utility.h"
 #include "js/Vector.h"
--- a/js/src/builtin/intl/Locale.cpp
+++ b/js/src/builtin/intl/Locale.cpp
@@ -16,19 +16,16 @@
 #include "mozilla/TextUtils.h"
 
 #include <algorithm>
 #include <iterator>
 #include <string>
 #include <string.h>
 #include <utility>
 
-#include "jsapi.h"
-#include "jsfriendapi.h"
-
 #include "builtin/Boolean.h"
 #include "builtin/intl/CommonFunctions.h"
 #include "builtin/intl/LanguageTag.h"
 #include "builtin/String.h"
 #include "gc/Rooting.h"
 #include "js/Conversions.h"
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/TypeDecls.h"
--- a/js/src/builtin/streams/MiscellaneousOperations.cpp
+++ b/js/src/builtin/streams/MiscellaneousOperations.cpp
@@ -6,20 +6,19 @@
 
 /* Miscellaneous operations. */
 
 #include "builtin/streams/MiscellaneousOperations.h"
 
 #include "mozilla/Assertions.h"     // MOZ_ASSERT
 #include "mozilla/FloatingPoint.h"  // mozilla::IsNaN
 
-#include "jsapi.h"  // JS_ReportErrorNumberASCII
-
 #include "js/CallAndConstruct.h"      // JS::IsCallable
 #include "js/Conversions.h"           // JS::ToNumber
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/RootingAPI.h"            // JS::{,Mutable}Handle, JS::Rooted
 #include "vm/Interpreter.h"           // js::{Call,GetAndClearException}
 #include "vm/JSContext.h"             // JSContext
 #include "vm/ObjectOperations.h"      // js::GetProperty
 #include "vm/PromiseObject.h"         // js::PromiseObject
 #include "vm/StringType.h"            // js::PropertyName
 
--- a/js/src/builtin/streams/PipeToState.cpp
+++ b/js/src/builtin/streams/PipeToState.cpp
@@ -6,27 +6,26 @@
 
 /* ReadableStream.prototype.pipeTo state. */
 
 #include "builtin/streams/PipeToState-inl.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 #include "mozilla/Maybe.h"  // mozilla::Maybe, mozilla::Nothing, mozilla::Some
 
-#include "jsapi.h"  // JS_ReportErrorNumberASCII
-
 #include "builtin/Promise.h"  // js::RejectPromiseWithPendingError
 #include "builtin/streams/ReadableStream.h"        // js::ReadableStream
 #include "builtin/streams/ReadableStreamReader.h"  // js::CreateReadableStreamDefaultReader, js::ForAuthorCodeBool, js::ReadableStreamDefaultReader, js::ReadableStreamReaderGenericRelease
 #include "builtin/streams/WritableStream.h"        // js::WritableStream
 #include "builtin/streams/WritableStreamDefaultWriter.h"  // js::CreateWritableStreamDefaultWriter, js::WritableStreamDefaultWriter
 #include "builtin/streams/WritableStreamOperations.h"  // js::WritableStreamCloseQueuedOrInFlight
 #include "builtin/streams/WritableStreamWriterOperations.h"  // js::WritableStreamDefaultWriter{GetDesiredSize,Release,Write}
 #include "js/CallArgs.h"              // JS::CallArgsFromVp, JS::CallArgs
 #include "js/Class.h"                 // JSClass, JSCLASS_HAS_RESERVED_SLOTS
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/Promise.h"               // JS::AddPromiseReactions
 #include "js/RootingAPI.h"            // JS::Handle, JS::Rooted
 #include "js/Value.h"  // JS::{,Int32,Magic,Object}Value, JS::UndefinedHandleValue
 #include "vm/JSContext.h"      // JSContext
 #include "vm/PromiseObject.h"  // js::PromiseObject
 #include "vm/Runtime.h"        // JSRuntime
 
--- a/js/src/builtin/streams/QueueWithSizes.cpp
+++ b/js/src/builtin/streams/QueueWithSizes.cpp
@@ -6,21 +6,20 @@
 
 /* Queue-with-sizes operations. */
 
 #include "builtin/streams/QueueWithSizes-inl.h"
 
 #include "mozilla/Assertions.h"     // MOZ_ASSERT
 #include "mozilla/FloatingPoint.h"  // mozilla::Is{Infinite,NaN}
 
-#include "jsapi.h"  // JS_ReportErrorNumberASCII
-
 #include "builtin/streams/StreamController.h"  // js::StreamController
 #include "js/Class.h"                 // JSClass, JSCLASS_HAS_RESERVED_SLOTS
 #include "js/Conversions.h"           // JS::ToNumber
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/RootingAPI.h"            // JS::Rooted
 #include "js/Value.h"                 // JS::Value, JS::{Number,Object}Value
 #include "vm/Compartment.h"           // JSCompartment
 #include "vm/JSContext.h"             // JSContext
 #include "vm/List.h"                  // js::ListObject
 #include "vm/NativeObject.h"          // js::NativeObject
 
--- a/js/src/builtin/streams/ReadableStream.cpp
+++ b/js/src/builtin/streams/ReadableStream.cpp
@@ -5,31 +5,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Class ReadableStream. */
 
 #include "builtin/streams/ReadableStream.h"
 
 #include "mozilla/Maybe.h"  // mozilla::Maybe, mozilla::Some
 
-#include "jsapi.h"    // JS_ReportErrorNumberASCII
 #include "jspubtd.h"  // JSProto_ReadableStream
 
 #include "builtin/Array.h"                   // js::NewDenseFullyAllocatedArray
 #include "builtin/streams/ClassSpecMacro.h"  // JS_STREAMS_CLASS_SPEC
 #include "builtin/streams/MiscellaneousOperations.h"  // js::MakeSizeAlgorithmFromSizeFunction, js::ValidateAndNormalizeHighWaterMark, js::ReturnPromiseRejectedWithPendingError
 #include "builtin/streams/ReadableStreamController.h"  // js::ReadableStream{,Default}Controller, js::ReadableByteStreamController
 #include "builtin/streams/ReadableStreamDefaultControllerOperations.h"  // js::SetUpReadableStreamDefaultControllerFromUnderlyingSource
 #include "builtin/streams/ReadableStreamInternals.h"  // js::ReadableStreamCancel
 #include "builtin/streams/ReadableStreamOperations.h"  // js::ReadableStream{PipeTo,Tee}
 #include "builtin/streams/ReadableStreamReader.h"  // js::CreateReadableStream{BYOB,Default}Reader, js::ForAuthorCodeBool
 #include "builtin/streams/WritableStream.h"  // js::WritableStream
 #include "js/CallArgs.h"                     // JS::CallArgs{,FromVp}
 #include "js/Class.h"        // JSCLASS_SLOT0_IS_NSISUPPORTS, JS_NULL_CLASS_OPS
 #include "js/Conversions.h"  // JS::ToBoolean
+#include "js/ErrorReport.h"  // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/PropertySpec.h"  // JS{Function,Property}Spec, JS_FN, JS_PSG, JS_{FS,PS}_END
 #include "js/RootingAPI.h"        // JS::Handle, JS::Rooted, js::CanGC
 #include "js/Stream.h"            // JS::ReadableStream{Mode,UnderlyingSource}
 #include "js/Value.h"             // JS::Value
 #include "vm/JSContext.h"         // JSContext
 #include "vm/JSObject.h"          // js::GetPrototypeFromBuiltinConstructor
 #include "vm/ObjectOperations.h"  // js::GetProperty
--- a/js/src/builtin/streams/ReadableStreamBYOBReader.cpp
+++ b/js/src/builtin/streams/ReadableStreamBYOBReader.cpp
@@ -7,18 +7,16 @@
 /*
  * Class ReadableStreamBYOBReader.
  *
  * Byte streams and BYOB readers are unimplemented, so this is skeletal -- yet
  * helpful to ensure certain trivial tests of the functionality in wpt, that
  * don't actually test fully-constructed byte streams/BYOB readers, pass.  🙄
  */
 
-#include "jsapi.h"  // JS_ReportErrorNumberASCII
-
 #include "builtin/streams/ReadableStream.h"  // js::ReadableStream
 #include "builtin/streams/ReadableStreamReader.h"  // js::CreateReadableStreamBYOBReader, js::ForAuthorCodeBool
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 
 using JS::Handle;
 
 /*** 3.7. Class ReadableStreamBYOBReader *********************************/
 
--- a/js/src/builtin/streams/ReadableStreamDefaultController.cpp
+++ b/js/src/builtin/streams/ReadableStreamDefaultController.cpp
@@ -3,33 +3,33 @@
  * 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/. */
 
 /* Class ReadableStreamDefaultController. */
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT{,_IF}
 
-#include "jsapi.h"        // JS_ReportErrorNumberASCII
 #include "jsfriendapi.h"  // js::AssertSameCompartment
 
 #include "builtin/streams/ClassSpecMacro.h"           // JS_STREAMS_CLASS_SPEC
 #include "builtin/streams/MiscellaneousOperations.h"  // js::IsMaybeWrapped
 #include "builtin/streams/PullIntoDescriptor.h"       // js::PullIntoDescriptor
 #include "builtin/streams/QueueWithSizes.h"  // js::{DequeueValue,ResetQueue}
 #include "builtin/streams/ReadableStream.h"  // js::ReadableStream, js::SetUpExternalReadableByteStreamController
 #include "builtin/streams/ReadableStreamController.h"  // js::ReadableStream{,Default}Controller, js::ReadableByteStreamController, js::CheckReadableStreamControllerCanCloseOrEnqueue, js::ReadableStreamControllerCancelSteps, js::ReadableStreamDefaultControllerPullSteps, js::ReadableStreamControllerStart{,Failed}Handler
 #include "builtin/streams/ReadableStreamDefaultControllerOperations.h"  // js::ReadableStreamController{CallPullIfNeeded,ClearAlgorithms,Error,GetDesiredSizeUnchecked}, js::ReadableStreamDefaultController{Close,Enqueue}
 #include "builtin/streams/ReadableStreamInternals.h"  // js::ReadableStream{AddReadOrReadIntoRequest,CloseInternal,CreateReadResult}
 #include "builtin/streams/ReadableStreamOperations.h"  // js::ReadableStreamTee_Cancel
 #include "builtin/streams/ReadableStreamReader.h"  // js::ReadableStream{,Default}Reader
 #include "builtin/streams/StreamController.h"  // js::StreamController
 #include "builtin/streams/TeeState.h"          // js::TeeState
 #include "js/ArrayBuffer.h"                    // JS::NewArrayBuffer
 #include "js/Class.h"                          // js::ClassSpec
+#include "js/ErrorReport.h"                    // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"           // js::GetErrorMessage, JSMSG_*
 #include "js/PropertySpec.h"
 #include "vm/Interpreter.h"
 #include "vm/JSContext.h"
 #include "vm/PlainObject.h"  // js::PlainObject
 #include "vm/PromiseObject.h"  // js::PromiseObject, js::PromiseResolvedWithUndefined
 #include "vm/SelfHosting.h"
 
--- a/js/src/builtin/streams/ReadableStreamDefaultReader.cpp
+++ b/js/src/builtin/streams/ReadableStreamDefaultReader.cpp
@@ -1,24 +1,23 @@
 /* -*- 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/. */
 
 /* Class ReadableStreamDefaultReader. */
 
-#include "jsapi.h"  // JS_ReportErrorNumberASCII
-
 #include "builtin/streams/ClassSpecMacro.h"  // JS_STREAMS_CLASS_SPEC
 #include "builtin/streams/MiscellaneousOperations.h"  // js::ReturnPromiseRejectedWithPendingError
 #include "builtin/streams/ReadableStream.h"  // js::ReadableStream
 #include "builtin/streams/ReadableStreamReader.h"  // js::ForAuthorCodeBool, js::ReadableStream{,Default}Reader
 #include "js/CallArgs.h"              // JS::CallArgs{,FromVp}
 #include "js/Class.h"                 // JSClass, JS_NULL_CLASS_OPS
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/RootingAPI.h"            // JS::Handle, JS::Rooted
 #include "vm/PromiseObject.h"         // js::PromiseObject
 
 #include "vm/Compartment-inl.h"   // js::UnwrapAndTypeCheckThis
 #include "vm/JSObject-inl.h"      // js::NewObjectWithClassProto
 #include "vm/NativeObject-inl.h"  // js::ThrowIfNotConstructing
 
--- a/js/src/builtin/streams/StreamAPI.cpp
+++ b/js/src/builtin/streams/StreamAPI.cpp
@@ -5,29 +5,30 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Public and friend stream APIs for external use. */
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT{,_IF}
 
 #include <stdint.h>  // uint32_t, uintptr_t
 
-#include "jsapi.h"        // js::AssertHeapIsIdle, JS_ReportErrorNumberASCII
 #include "jsfriendapi.h"  // js::IsObjectInContextCompartment
 #include "jstypes.h"      // JS_{FRIEND,PUBLIC}_API
 
 #include "builtin/Stream.h"  // js::ReadableByteStreamController{,Close}, js::ReadableStreamDefaultController{,Close}, js::StreamController
 #include "builtin/streams/ReadableStream.h"  // js::ReadableStream
 #include "builtin/streams/ReadableStreamController.h"  // js::CheckReadableStreamControllerCanCloseOrEnqueue
 #include "builtin/streams/ReadableStreamDefaultControllerOperations.h"  // js::ReadableStreamController{Error,GetDesiredSizeUnchecked}, js::SetUpReadableStreamDefaultControllerFromUnderlyingSource
 #include "builtin/streams/ReadableStreamInternals.h"  // js::ReadableStream{Cancel,FulfillReadOrReadIntoRequest,GetNumReadRequests,HasDefaultReader}
 #include "builtin/streams/ReadableStreamOperations.h"  // js::ReadableStreamTee
 #include "builtin/streams/ReadableStreamReader.h"  // js::ReadableStream{,Default}Reader, js::ForAuthorCodeBool
 #include "builtin/streams/StreamController.h"  // js::StreamController
 #include "gc/Zone.h"                           // JS::Zone
+#include "js/Context.h"                        // js::AssertHeapIsIdle
+#include "js/ErrorReport.h"                    // JS_ReportErrorNumberASCII
 #include "js/experimental/TypedData.h"  // JS_GetArrayBufferViewData, JS_NewUint8Array
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/GCAPI.h"       // JS::AutoCheckCannotGC, JS::AutoSuppressGCAnalysis
 #include "js/Object.h"      // JS::SetObjectISupports
 #include "js/RootingAPI.h"  // JS::{,Mutable}Handle, JS::Rooted
 #include "js/Stream.h"      // JS::ReadableStreamUnderlyingSource
 #include "js/Value.h"       // JS::{,Object,Undefined}Value
 #include "vm/ArrayBufferViewObject.h"  // js::ArrayBufferViewObject
--- a/js/src/builtin/streams/WritableStream.cpp
+++ b/js/src/builtin/streams/WritableStream.cpp
@@ -5,26 +5,26 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Class WritableStream. */
 
 #include "builtin/streams/WritableStream.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
-#include "jsapi.h"    // JS_ReportErrorNumberASCII
 #include "jspubtd.h"  // JSProto_WritableStream
 
 #include "builtin/streams/ClassSpecMacro.h"           // JS_STREAMS_CLASS_SPEC
 #include "builtin/streams/MiscellaneousOperations.h"  // js::MakeSizeAlgorithmFromSizeFunction, js::ReturnPromiseRejectedWithPendingError, js::ValidateAndNormalizeHighWaterMark
 #include "builtin/streams/WritableStreamDefaultControllerOperations.h"  // js::SetUpWritableStreamDefaultControllerFromUnderlyingSink
 #include "builtin/streams/WritableStreamDefaultWriter.h"  // js::CreateWritableStreamDefaultWriter
 #include "builtin/streams/WritableStreamOperations.h"  // js::WritableStream{Abort,Close{,QueuedOrInFlight}}
 #include "js/CallArgs.h"                               // JS::CallArgs{,FromVp}
 #include "js/Class.h"  // JS{Function,Property}Spec, JS_{FS,PS}_END, JSCLASS_SLOT0_IS_NSISUPPORTS, JS_NULL_CLASS_OPS
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/RealmOptions.h"          // JS::RealmCreationOptions
 #include "js/RootingAPI.h"            // JS::Handle, JS::Rooted
 #include "js/Value.h"                 // JS::{,Object}Value
 #include "vm/JSContext.h"             // JSContext
 #include "vm/JSObject.h"              // js::GetPrototypeFromBuiltinConstructor
 #include "vm/ObjectOperations.h"      // js::GetProperty
 #include "vm/PlainObject.h"           // js::PlainObject
--- a/js/src/builtin/streams/WritableStreamDefaultControllerOperations.cpp
+++ b/js/src/builtin/streams/WritableStreamDefaultControllerOperations.cpp
@@ -5,18 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Writable stream default controller abstract operations. */
 
 #include "builtin/streams/WritableStreamDefaultControllerOperations.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
-#include "jsapi.h"  // JS_ReportErrorASCII
-
 #include "builtin/streams/MiscellaneousOperations.h"  // js::CreateAlgorithmFromUnderlyingMethod, js::InvokeOrNoop
 #include "builtin/streams/QueueWithSizes.h"  // js::{EnqueueValueWithSize,QueueIsEmpty,ResetQueue}
 #include "builtin/streams/WritableStream.h"  // js::WritableStream
 #include "builtin/streams/WritableStreamDefaultController.h"  // js::WritableStreamDefaultController
 #include "builtin/streams/WritableStreamOperations.h"  // js::WritableStream{CloseQueuedOrInFlight,DealWithRejection,{Start,Finish}Erroring,UpdateBackpressure,Mark{Close,FirstWrite}RequestInFlight}
 #include "js/CallAndConstruct.h"                       // JS::IsCallable
 #include "js/CallArgs.h"                               // JS::CallArgs{,FromVp}
 #include "js/Promise.h"     // JS::AddPromiseReactions
--- a/js/src/builtin/streams/WritableStreamDefaultWriter.cpp
+++ b/js/src/builtin/streams/WritableStreamDefaultWriter.cpp
@@ -5,25 +5,24 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Class WritableStreamDefaultWriter. */
 
 #include "builtin/streams/WritableStreamDefaultWriter-inl.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
-#include "jsapi.h"  // JS_ReportErrorASCII, JS_ReportErrorNumberASCII
-
 #include "builtin/streams/ClassSpecMacro.h"  // JS_STREAMS_CLASS_SPEC
 #include "builtin/streams/MiscellaneousOperations.h"  // js::ReturnPromiseRejectedWithPendingError
 #include "builtin/streams/WritableStream.h"  // js::WritableStream
 #include "builtin/streams/WritableStreamOperations.h"  // js::WritableStreamCloseQueuedOrInFlight
 #include "builtin/streams/WritableStreamWriterOperations.h"  // js::WritableStreamDefaultWriter{Abort,GetDesiredSize,Release,Write}
 #include "js/CallArgs.h"              // JS::CallArgs{,FromVp}
 #include "js/Class.h"                 // js::ClassSpec, JS_NULL_CLASS_OPS
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/PropertySpec.h"  // JS{Function,Property}Spec, JS_{FS,PS}_END, JS_{FN,PSG}
 #include "js/RootingAPI.h"   // JS::Handle
 #include "js/Value.h"        // JS::Value
 #include "vm/Compartment.h"  // JS::Compartment
 #include "vm/JSContext.h"    // JSContext
 #include "vm/PromiseObject.h"  // js::PromiseObject, js::PromiseResolvedWithUndefined
 
--- a/js/src/builtin/streams/WritableStreamOperations.cpp
+++ b/js/src/builtin/streams/WritableStreamOperations.cpp
@@ -7,24 +7,23 @@
 /* Writable stream abstract operations. */
 
 #include "builtin/streams/WritableStreamOperations.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
 #include <stdint.h>  // uint32_t
 
-#include "jsapi.h"  // JS_ReportErrorASCII
-
 #include "builtin/streams/MiscellaneousOperations.h"  // js::PromiseRejectedWithPendingError
 #include "builtin/streams/WritableStream.h"  // js::WritableStream
 #include "builtin/streams/WritableStreamDefaultController.h"  // js::WritableStreamDefaultController{,Close}, js::WritableStream::controller
 #include "builtin/streams/WritableStreamDefaultControllerOperations.h"  // js::WritableStreamControllerErrorSteps
 #include "builtin/streams/WritableStreamWriterOperations.h"  // js::WritableStreamDefaultWriterEnsureReadyPromiseRejected
 #include "js/CallArgs.h"              // JS::CallArgs{,FromVp}
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/Promise.h"               // JS::{Reject,Resolve}Promise
 #include "js/RootingAPI.h"            // JS::Handle, JS::Rooted
 #include "js/Value.h"  // JS::Value, JS::ObjecValue, JS::UndefinedHandleValue
 #include "vm/Compartment.h"  // JS::Compartment
 #include "vm/JSContext.h"    // JSContext
 #include "vm/List.h"         // js::ListObject
 #include "vm/PromiseObject.h"  // js::PromiseObject, js::PromiseResolvedWithUndefined
--- a/js/src/builtin/streams/WritableStreamWriterOperations.cpp
+++ b/js/src/builtin/streams/WritableStreamWriterOperations.cpp
@@ -5,24 +5,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Writable stream writer abstract operations. */
 
 #include "builtin/streams/WritableStreamWriterOperations.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
-#include "jsapi.h"  // JS_ReportErrorNumberASCII, JS_ReportErrorASCII
-
 #include "builtin/streams/MiscellaneousOperations.h"  // js::PromiseRejectedWithPendingError
 #include "builtin/streams/WritableStream.h"  // js::WritableStream
 #include "builtin/streams/WritableStreamDefaultController.h"  // js::WritableStream::controller
 #include "builtin/streams/WritableStreamDefaultControllerOperations.h"  // js::WritableStreamDefaultController{Close,GetDesiredSize}
 #include "builtin/streams/WritableStreamDefaultWriter.h"  // js::WritableStreamDefaultWriter
 #include "builtin/streams/WritableStreamOperations.h"  // js::WritableStream{Abort,CloseQueuedOrInFlight}
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberASCII
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/Promise.h"               // JS::PromiseState
 #include "js/Value.h"                 // JS::Value, JS::{Int32,Null}Value
 #include "vm/Compartment.h"           // JS::Compartment
 #include "vm/Interpreter.h"           // js::GetAndClearException
 #include "vm/JSContext.h"             // JSContext
 #include "vm/PromiseObject.h"  // js::PromiseObject, js::PromiseResolvedWithUndefined
 
--- a/js/src/debugger/DebugScript.cpp
+++ b/js/src/debugger/DebugScript.cpp
@@ -7,18 +7,16 @@
 #include "debugger/DebugScript.h"
 
 #include "mozilla/Assertions.h"  // for AssertionConditionType
 #include "mozilla/HashTable.h"   // for HashMapEntry, HashTable<>::Ptr, HashMap
 #include "mozilla/UniquePtr.h"   // for UniquePtr
 
 #include <utility>  // for std::move
 
-#include "jsapi.h"
-
 #include "debugger/DebugAPI.h"    // for DebugAPI
 #include "debugger/Debugger.h"    // for JSBreakpointSite, Breakpoint
 #include "gc/Cell.h"              // for TenuredCell
 #include "gc/FreeOp.h"            // for JSFreeOp
 #include "gc/GCEnum.h"            // for MemoryUse, MemoryUse::BreakpointSite
 #include "gc/Marking.h"           // for IsAboutToBeFinalized
 #include "gc/Zone.h"              // for Zone
 #include "gc/ZoneAllocator.h"     // for AddCellMemory
--- a/js/src/debugger/DebugScript.h
+++ b/js/src/debugger/DebugScript.h
@@ -6,17 +6,16 @@
 
 #ifndef dbg_DebugScript_h
 #define dbg_DebugScript_h
 
 #include <stddef.h>  // for offsetof
 #include <stddef.h>  // for size_t
 #include <stdint.h>  // for uint32_t
 
-#include "jsapi.h"
 #include "jstypes.h"
 
 #include "gc/WeakMap.h"
 #include "vm/NativeObject.h"
 
 namespace JS {
 class JS_PUBLIC_API Realm;
 }
--- a/js/src/debugger/Debugger.h
+++ b/js/src/debugger/Debugger.h
@@ -17,31 +17,32 @@
 #include "mozilla/Result.h"            // for Result
 #include "mozilla/TimeStamp.h"         // for TimeStamp
 #include "mozilla/Variant.h"           // for Variant
 
 #include <stddef.h>  // for size_t
 #include <stdint.h>  // for uint32_t, uint64_t, uintptr_t
 #include <utility>   // for std::move
 
-#include "jsapi.h"             // for Handle, UnsafeTraceRoot
 #include "jstypes.h"           // for JS_GC_ZEAL
 #include "NamespaceImports.h"  // for Value, HandleObject
 
 #include "debugger/DebugAPI.h"      // for DebugAPI
 #include "debugger/Object.h"        // for DebuggerObject
 #include "ds/TraceableFifo.h"       // for TraceableFifo
 #include "gc/Barrier.h"             // for WeakHeapPtrGlobalObject, HeapPtr
 #include "gc/Marking.h"             // for IsAboutToBeFinalized, ToMarkable
 #include "gc/Rooting.h"             // for HandleSavedFrame, HandleAtom
 #include "gc/Tracer.h"              // for TraceNullableEdge, TraceEdge
 #include "gc/WeakMap.h"             // for WeakMap
 #include "gc/ZoneAllocator.h"       // for ZoneAllocPolicy
 #include "js/GCAPI.h"               // for GarbageCollectionEvent
 #include "js/Proxy.h"               // for PropertyDescriptor
+#include "js/RootingAPI.h"          // for Handle
+#include "js/TracingAPI.h"          // for UnsafeTraceRoot
 #include "js/Wrapper.h"             // for UncheckedUnwrap
 #include "proxy/DeadObjectProxy.h"  // for IsDeadProxyObject
 #include "vm/GeneratorObject.h"     // for AbstractGeneratorObject
 #include "vm/GlobalObject.h"        // for GlobalObject
 #include "vm/JSContext.h"           // for JSContext
 #include "vm/JSObject.h"            // for JSObject
 #include "vm/JSScript.h"            // for JSScript, ScriptSourceObject
 #include "vm/NativeObject.h"        // for NativeObject
--- a/js/src/debugger/DebuggerMemory.h
+++ b/js/src/debugger/DebuggerMemory.h
@@ -2,18 +2,16 @@
  * 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 debugger_DebuggerMemory_h
 #define debugger_DebuggerMemory_h
 
-#include "jsapi.h"
-
 #include "js/Class.h"
 #include "js/Value.h"
 #include "vm/JSContext.h"
 #include "vm/JSObject.h"
 
 namespace js {
 
 class DebuggerMemory : public NativeObject {
--- a/js/src/debugger/Environment.cpp
+++ b/js/src/debugger/Environment.cpp
@@ -8,26 +8,26 @@
 
 #include "mozilla/Assertions.h"  // for AssertionConditionType
 #include "mozilla/Maybe.h"       // for Maybe, Some, Nothing
 #include "mozilla/Vector.h"      // for Vector
 
 #include <string.h>  // for strlen, size_t
 #include <utility>   // for move
 
-#include "jsapi.h"  // for Rooted, CallArgs, MutableHandle
-
 #include "debugger/Debugger.h"          // for Env, Debugger, ValueToIdentifier
 #include "debugger/Object.h"            // for DebuggerObject
 #include "debugger/Script.h"            // for DebuggerScript
 #include "frontend/BytecodeCompiler.h"  // for IsIdentifier
 #include "gc/Rooting.h"                 // for RootedDebuggerEnvironment
-#include "gc/Tracer.h"  // for TraceManuallyBarrieredCrossCompartmentEdge
+#include "gc/Tracer.h"    // for TraceManuallyBarrieredCrossCompartmentEdge
+#include "js/CallArgs.h"  // for CallArgs
 #include "js/friend/ErrorMessages.h"  // for GetErrorMessage, JSMSG_*
 #include "js/HeapAPI.h"               // for IsInsideNursery
+#include "js/RootingAPI.h"            // for Rooted, MutableHandle
 #include "vm/Compartment.h"           // for Compartment
 #include "vm/JSAtom.h"                // for Atomize, PinAtom
 #include "vm/JSContext.h"             // for JSContext
 #include "vm/JSFunction.h"            // for JSFunction
 #include "vm/JSObject.h"              // for JSObject, RequireObject,
 #include "vm/NativeObject.h"          // for NativeObject, JSObject::is
 #include "vm/Realm.h"                 // for AutoRealm, ErrorCopier
 #include "vm/Scope.h"                 // for ScopeKind, ScopeKindString
--- a/js/src/debugger/Frame.cpp
+++ b/js/src/debugger/Frame.cpp
@@ -16,17 +16,16 @@
 #include "mozilla/ThreadLocal.h"  // for ThreadLocal
 #include "mozilla/Vector.h"       // for Vector
 
 #include <stddef.h>  // for size_t
 #include <stdint.h>  // for int32_t
 #include <string.h>  // for strlen
 #include <utility>   // for std::move
 
-#include "jsapi.h"  // for CallArgs, Handle
 #include "jsnum.h"  // for Int32ToString
 
 #include "builtin/Array.h"      // for NewDenseCopiedArray
 #include "debugger/Debugger.h"  // for Completion, Debugger
 #include "debugger/DebugScript.h"
 #include "debugger/Environment.h"          // for DebuggerEnvironment
 #include "debugger/NoExecute.h"            // for LeaveDebuggeeNoExecute
 #include "debugger/Object.h"               // for DebuggerObject
@@ -37,19 +36,21 @@
 #include "gc/FreeOp.h"                     // for JSFreeOp
 #include "gc/GC.h"                         // for MemoryUse
 #include "gc/Marking.h"                    // for IsAboutToBeFinalized
 #include "gc/Rooting.h"                    // for RootedDebuggerFrame
 #include "gc/Tracer.h"                     // for TraceCrossCompartmentEdge
 #include "gc/ZoneAllocator.h"              // for AddCellMemory
 #include "jit/JSJitFrameIter.h"            // for InlineFrameIterator
 #include "jit/RematerializedFrame.h"       // for RematerializedFrame
+#include "js/CallArgs.h"                   // for CallArgs
 #include "js/friend/ErrorMessages.h"       // for GetErrorMessage, JSMSG_*
 #include "js/Object.h"                     // for SetReservedSlot
 #include "js/Proxy.h"                      // for PrivateValue
+#include "js/RootingAPI.h"                 // for Handle
 #include "js/SourceText.h"                 // for SourceText, SourceOwnership
 #include "js/StableStringChars.h"          // for AutoStableStringChars
 #include "vm/ArgumentsObject.h"            // for ArgumentsObject
 #include "vm/ArrayObject.h"                // for ArrayObject
 #include "vm/AsyncFunction.h"              // for AsyncFunctionGeneratorObject
 #include "vm/AsyncIteration.h"             // for AsyncGeneratorObject
 #include "vm/BytecodeUtil.h"               // for JSDVG_SEARCH_STACK
 #include "vm/Compartment.h"                // for Compartment
--- a/js/src/debugger/Frame.h
+++ b/js/src/debugger/Frame.h
@@ -8,28 +8,28 @@
 #define debugger_Frame_h
 
 #include "mozilla/Maybe.h"   // for Maybe
 #include "mozilla/Range.h"   // for Range
 #include "mozilla/Result.h"  // for Result
 
 #include <stddef.h>  // for size_t
 
-#include "jsapi.h"  // for JSContext, CallArgs
-
 #include "NamespaceImports.h"   // for Value, MutableHandleValue, HandleObject
 #include "debugger/DebugAPI.h"  // for ResumeMode
 #include "debugger/Debugger.h"  // for ResumeMode, Handler, Debugger
 #include "gc/Barrier.h"         // for HeapPtr
 #include "gc/Rooting.h"         // for HandleDebuggerFrame, HandleNativeObject
 #include "vm/FrameIter.h"       // for FrameIter
 #include "vm/JSObject.h"        // for JSObject
 #include "vm/NativeObject.h"    // for NativeObject
 #include "vm/Stack.h"           // for AbstractFramePtr
 
+struct JS_PUBLIC_API JSContext;
+
 namespace js {
 
 class AbstractGeneratorObject;
 class GlobalObject;
 
 /*
  * An OnStepHandler represents a handler function that is called when a small
  * amount of progress is made in a frame.
--- a/js/src/debugger/NoExecute.cpp
+++ b/js/src/debugger/NoExecute.cpp
@@ -5,22 +5,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "debugger/NoExecute.h"
 
 #include "mozilla/Sprintf.h"  // for SprintfLiteral
 
 #include <stdio.h>  // for fprintf, stdout
 
-#include "jsapi.h"  // for Handle
-
 #include "debugger/Debugger.h"        // for Debugger
 #include "js/friend/DumpFunctions.h"  // for DumpBacktrace
 #include "js/friend/ErrorMessages.h"  // for GetErrorMessage, JSMSG_DEBUGGEE_WOULD_RUN
 #include "js/Promise.h"               // for AutoDebuggerJobQueueInterruption
+#include "js/RootingAPI.h"            // for Handle
 #include "vm/JSContext.h"             // for ProtectedDataContextArg, JSContext
 #include "vm/JSScript.h"              // for JSScript
 #include "vm/Realm.h"                 // for AutoRealm, Realm
 #include "vm/Warnings.h"              // for WarnNumberLatin1
 
 #include "vm/Realm-inl.h"  // for AutoRealm::AutoRealm
 
 using namespace js;
--- a/js/src/debugger/NoExecute.h
+++ b/js/src/debugger/NoExecute.h
@@ -5,18 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef debugger_NoExecute_h
 #define debugger_NoExecute_h
 
 #include "mozilla/Assertions.h"  // for AssertionConditionType, MOZ_ASSERT
 #include "mozilla/Attributes.h"  // for MOZ_RAII
 
-#include "jsapi.h"
-
 #include "NamespaceImports.h"  // for HandleScript
 #include "js/Promise.h"        // for JS::AutoDebuggerJobQueueInterruption
 
 namespace js {
 
 class Debugger;
 class LeaveDebuggeeNoExecute;
 
--- a/js/src/debugger/Object.h
+++ b/js/src/debugger/Object.h
@@ -7,27 +7,27 @@
 #ifndef debugger_Object_h
 #define debugger_Object_h
 
 #include "mozilla/Assertions.h"  // for AssertionConditionType, MOZ_ASSERT
 #include "mozilla/Maybe.h"       // for Maybe
 #include "mozilla/Range.h"       // for Range
 #include "mozilla/Result.h"      // for Result
 
-#include "jsapi.h"             // for JSContext
 #include "jstypes.h"           // for JS_PUBLIC_API
 #include "NamespaceImports.h"  // for Value, MutableHandleValue, HandleId
 
 #include "gc/Rooting.h"       // for HandleDebuggerObject
 #include "js/Promise.h"       // for PromiseState
 #include "js/Proxy.h"         // for PropertyDescriptor
 #include "vm/JSObject.h"      // for JSObject (ptr only)
 #include "vm/NativeObject.h"  // for NativeObject
 
 class JS_PUBLIC_API JSAtom;
+struct JS_PUBLIC_API JSContext;
 
 namespace js {
 
 class Completion;
 class Debugger;
 class EvalOptions;
 class GlobalObject;
 class PromiseObject;
--- a/js/src/debugger/Script.cpp
+++ b/js/src/debugger/Script.cpp
@@ -8,32 +8,33 @@
 
 #include "mozilla/Maybe.h"   // for Some, Maybe
 #include "mozilla/Span.h"    // for Span
 #include "mozilla/Vector.h"  // for Vector
 
 #include <stddef.h>  // for ptrdiff_t
 #include <stdint.h>  // for uint32_t, SIZE_MAX, int32_t
 
-#include "jsapi.h"             // for CallArgs, Rooted, CallArgsFromVp
 #include "jsnum.h"             // for ToNumber
 #include "NamespaceImports.h"  // for CallArgs, RootedValue
 
 #include "builtin/Array.h"         // for NewDenseEmptyArray
 #include "debugger/Debugger.h"     // for DebuggerScriptReferent, Debugger
 #include "debugger/DebugScript.h"  // for DebugScript
 #include "debugger/Source.h"       // for DebuggerSource
 #include "gc/Barrier.h"            // for ImmutablePropertyNamePtr
 #include "gc/GC.h"                 // for MemoryUse, MemoryUse::Breakpoint
 #include "gc/Rooting.h"            // for RootedDebuggerScript
 #include "gc/Tracer.h"         // for TraceManuallyBarrieredCrossCompartmentEdge
 #include "gc/Zone.h"           // for Zone
 #include "gc/ZoneAllocator.h"  // for AddCellMemory
+#include "js/CallArgs.h"       // for CallArgs, CallArgsFromVp
 #include "js/friend/ErrorMessages.h"  // for GetErrorMessage, JSMSG_*
 #include "js/HeapAPI.h"               // for GCCellPtr
+#include "js/RootingAPI.h"            // for Rooted
 #include "js/Wrapper.h"               // for UncheckedUnwrap
 #include "vm/ArrayObject.h"           // for ArrayObject
 #include "vm/BytecodeUtil.h"          // for GET_JUMP_OFFSET
 #include "vm/GlobalObject.h"          // for GlobalObject
 #include "vm/JSContext.h"             // for JSContext, ReportValueError
 #include "vm/JSFunction.h"            // for JSFunction
 #include "vm/JSObject.h"              // for RequireObject, JSObject
 #include "vm/ObjectOperations.h"      // for DefineDataProperty, HasOwnProperty
--- a/js/src/debugger/Script.h
+++ b/js/src/debugger/Script.h
@@ -2,25 +2,26 @@
  * 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 debugger_Script_h
 #define debugger_Script_h
 
-#include "jsapi.h"  // for Handle, JSFunctionSpec, JSPropertySpec
-
 #include "jstypes.h"            // for JS_PUBLIC_API
 #include "NamespaceImports.h"   // for Value, HandleObject, CallArgs
 #include "debugger/Debugger.h"  // for DebuggerScriptReferent
 #include "gc/Rooting.h"         // for HandleNativeObject
+#include "js/TypeDecls.h"       // for Handle
 #include "vm/NativeObject.h"    // for NativeObject
 
 class JS_PUBLIC_API JSObject;
+struct JSFunctionSpec;
+struct JSPropertySpec;
 
 namespace js {
 
 class BaseScript;
 class GlobalObject;
 
 namespace gc {
 struct Cell;
--- a/js/src/debugger/Source.cpp
+++ b/js/src/debugger/Source.cpp
@@ -9,29 +9,29 @@
 #include "mozilla/Assertions.h"  // for AssertionConditionType, MOZ_ASSERT
 #include "mozilla/Maybe.h"       // for Some, Maybe, Nothing
 #include "mozilla/Variant.h"     // for AsVariant, Variant
 
 #include <stdint.h>  // for uint32_t
 #include <string.h>  // for memcpy
 #include <utility>   // for move
 
-#include "jsapi.h"  // for JS_ReportErrorNumberASCII, JS_CopyStringCharsZ
-
 #include "debugger/Debugger.h"  // for DebuggerSourceReferent, Debugger
 #include "debugger/Script.h"    // for DebuggerScript
 #include "gc/Tracer.h"  // for TraceManuallyBarrieredCrossCompartmentEdge
 #include "js/CompilationAndEvaluation.h"  // for Compile
-#include "js/experimental/TypedData.h"    // for JS_NewUint8Array
-#include "js/friend/ErrorMessages.h"      // for GetErrorMessage, JSMSG_*
-#include "js/SourceText.h"                // for JS::SourceOwnership
-#include "vm/BytecodeUtil.h"              // for JSDVG_SEARCH_STACK
-#include "vm/JSContext.h"                 // for JSContext (ptr only)
-#include "vm/JSObject.h"                  // for JSObject, RequireObject
-#include "vm/JSScript.h"          // for ScriptSource, ScriptSourceObject
+#include "js/ErrorReport.h"  // for JS_ReportErrorASCII,  JS_ReportErrorNumberASCII
+#include "js/experimental/TypedData.h"  // for JS_NewUint8Array
+#include "js/friend/ErrorMessages.h"    // for GetErrorMessage, JSMSG_*
+#include "js/SourceText.h"              // for JS::SourceOwnership
+#include "js/String.h"                  // for JS_CopyStringCharsZ
+#include "vm/BytecodeUtil.h"            // for JSDVG_SEARCH_STACK
+#include "vm/JSContext.h"               // for JSContext (ptr only)
+#include "vm/JSObject.h"                // for JSObject, RequireObject
+#include "vm/JSScript.h"                // for ScriptSource, ScriptSourceObject
 #include "vm/StringType.h"        // for NewStringCopyZ, JSString (ptr only)
 #include "vm/TypedArrayObject.h"  // for TypedArrayObject, JSObject::is
 #include "wasm/WasmCode.h"        // for Metadata
 #include "wasm/WasmDebug.h"       // for DebugState
 #include "wasm/WasmInstance.h"    // for Instance
 #include "wasm/WasmJS.h"          // for WasmInstanceObject
 #include "wasm/WasmTypeDecls.h"   // for Bytes, RootedWasmInstanceObject
 
--- a/js/src/debugger/Source.h
+++ b/js/src/debugger/Source.h
@@ -2,18 +2,16 @@
  * 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 dbg_Source_h
 #define dbg_Source_h
 
-#include "jsapi.h"
-
 #include "NamespaceImports.h"   // for Value, HandleObject, CallArgs
 #include "debugger/Debugger.h"  // for DebuggerSourceReferent
 #include "gc/Rooting.h"         // for HandleNativeObject
 #include "vm/NativeObject.h"    // for NativeObject
 
 namespace js {
 class GlobalObject;
 }
--- a/js/src/gc/Pretenuring.h
+++ b/js/src/gc/Pretenuring.h
@@ -17,16 +17,18 @@
  */
 
 #ifndef gc_Pretenuring_h
 #define gc_Pretenuring_h
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Maybe.h"
 
+#include <algorithm>
+
 #include "gc/AllocKind.h"
 #include "js/TypeDecls.h"
 
 class JS_PUBLIC_API JSTracer;
 
 namespace JS {
 enum class GCReason;
 }  // namespace JS
--- a/js/src/jit/ProcessExecutableMemory.cpp
+++ b/js/src/jit/ProcessExecutableMemory.cpp
@@ -10,16 +10,17 @@
 #include "mozilla/Atomics.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/TaggedAnonymousMemory.h"
 #include "mozilla/XorShift128PlusRNG.h"
 
 #include <errno.h>
 
+#include "jsfriendapi.h"
 #include "jsmath.h"
 
 #include "gc/Memory.h"
 #ifdef JS_CODEGEN_ARM64
 #  include "jit/arm64/vixl/Cpu-vixl.h"
 #endif
 #include "jit/FlushICache.h"  // js::jit::FlushICache
 #include "threading/LockGuard.h"
--- a/js/src/jsexn.h
+++ b/js/src/jsexn.h
@@ -8,22 +8,22 @@
  * JS runtime exception classes.
  */
 
 #ifndef jsexn_h
 #define jsexn_h
 
 #include "mozilla/Assertions.h"
 
-#include "jsapi.h"
 #include "jspubtd.h"
 #include "jstypes.h"
 #include "NamespaceImports.h"
 
 #include "js/ErrorReport.h"
+#include "js/Exception.h"
 #include "js/friend/ErrorMessages.h"  // JSErr_Limit
 #include "js/RootingAPI.h"
 #include "js/TypeDecls.h"
 #include "js/UniquePtr.h"
 #include "js/Utility.h"
 
 extern const JSErrorFormatString js_ErrorFormatString[JSErr_Limit];
 
--- a/js/src/proxy/DeadObjectProxy.cpp
+++ b/js/src/proxy/DeadObjectProxy.cpp
@@ -1,18 +1,16 @@
 /* -*- 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/. */
 
 #include "proxy/DeadObjectProxy.h"
 
-#include "jsapi.h"
-
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "vm/JSFunction.h"            // XXXefaust Bug 1064662
 #include "vm/ProxyObject.h"
 
 using namespace js;
 
 const DeadObjectProxy DeadObjectProxy::singleton;
 const char DeadObjectProxy::family = 0;
--- a/js/src/proxy/Proxy.cpp
+++ b/js/src/proxy/Proxy.cpp
@@ -6,18 +6,16 @@
 
 #include "js/Proxy.h"
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 
 #include <string.h>
 
-#include "jsapi.h"
-
 #include "js/friend/ErrorMessages.h"  // JSMSG_*
 #include "js/friend/StackLimits.h"  // js::AutoCheckRecursionLimit, js::GetNativeStackLimit
 #include "js/friend/WindowProxy.h"  // js::IsWindow, js::IsWindowProxy, js::ToWindowProxyIfWindow
 #include "js/PropertySpec.h"
 #include "js/Value.h"  // JS::ObjectValue
 #include "js/Wrapper.h"
 #include "proxy/DeadObjectProxy.h"
 #include "proxy/ScriptedProxyHandler.h"
--- a/js/src/proxy/SecurityWrapper.cpp
+++ b/js/src/proxy/SecurityWrapper.cpp
@@ -1,16 +1,14 @@
 /* -*- 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/. */
 
-#include "jsapi.h"
-#include "jsfriendapi.h"
 #include "NamespaceImports.h"
 
 #include "js/friend/ErrorMessages.h"  // JSMSG_*
 #include "js/Wrapper.h"
 #include "vm/JSObject.h"
 #include "vm/StringType.h"
 
 using namespace js;
--- a/js/src/shell/OSObject.h
+++ b/js/src/shell/OSObject.h
@@ -4,17 +4,20 @@
  * 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/. */
 
 // OSObject.h - os object for exposing posix system calls in the JS shell
 
 #ifndef shell_OSObject_h
 #define shell_OSObject_h
 
-#include "jsapi.h"
+#include "js/TypeDecls.h"
+#include "js/Utility.h"
+
+class JSLinearString;
 
 namespace js {
 namespace shell {
 
 #ifdef XP_WIN
 constexpr char PathSeparator = '\\';
 #else
 constexpr char PathSeparator = '/';
--- a/js/src/shell/jsshell.h
+++ b/js/src/shell/jsshell.h
@@ -6,18 +6,16 @@
 
 #ifndef jsshell_js_h
 #define jsshell_js_h
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/TimeStamp.h"
 
-#include "jsapi.h"
-
 #include "builtin/MapObject.h"
 #include "js/GCVector.h"
 #include "shell/ModuleLoader.h"
 #include "threading/ConditionVariable.h"
 #include "threading/LockGuard.h"
 #include "threading/Mutex.h"
 #include "threading/Thread.h"
 #include "vm/GeckoProfiler.h"
--- a/js/src/util/CompleteFile.cpp
+++ b/js/src/util/CompleteFile.cpp
@@ -9,18 +9,17 @@
 #include <cstring>     // std::strcmp
 #include <stdio.h>     // FILE, fileno, fopen, getc, getc_unlocked, _getc_nolock
 #include <sys/stat.h>  // stat, fstat
 
 #ifdef __wasi__
 #  include "js/Vector.h"
 #endif  // __wasi__
 
-#include "jsapi.h"  // JS_ReportErrorNumberLatin1
-
+#include "js/ErrorReport.h"           // JS_ReportErrorNumberLatin1
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_CANT_OPEN
 
 bool js::ReadCompleteFile(JSContext* cx, FILE* fp, FileContents& buffer) {
   /* Get the complete length of the file, if possible. */
   struct stat st;
   int ok = fstat(fileno(fp), &st);
   if (ok != 0) {
     // Use the Latin1 variant here (and below), because the encoding of
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -25,18 +25,16 @@
 #if !defined(XP_WIN) && !defined(__wasi__)
 #  include <sys/mman.h>
 #endif
 #include <tuple>  // std::tuple
 #ifdef MOZ_VALGRIND
 #  include <valgrind/memcheck.h>
 #endif
 
-#include "jsapi.h"
-#include "jsfriendapi.h"
 #include "jsnum.h"
 #include "jstypes.h"
 
 #include "builtin/Array.h"
 #include "builtin/DataViewObject.h"
 #include "gc/Barrier.h"
 #include "gc/Memory.h"
 #include "js/ArrayBuffer.h"
--- a/js/src/vm/BigIntType.cpp
+++ b/js/src/vm/BigIntType.cpp
@@ -90,17 +90,16 @@
 #include "mozilla/WrappingOperations.h"
 
 #include <functional>
 #include <limits>
 #include <math.h>
 #include <memory>
 #include <type_traits>  // std::is_same_v
 
-#include "jsapi.h"
 #include "jsnum.h"
 
 #include "builtin/BigInt.h"
 #include "gc/Allocator.h"
 #include "js/BigInt.h"
 #include "js/Conversions.h"
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/Initialization.h"
--- a/js/src/vm/EqualityOperations.cpp
+++ b/js/src/vm/EqualityOperations.cpp
@@ -3,20 +3,20 @@
  * 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 "vm/EqualityOperations.h"  // js::LooselyEqual, js::StrictlyEqual, js::SameValue
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT, MOZ_ASSERT_IF
 
-#include "jsapi.h"    // js::AssertHeapIsIdle
 #include "jsnum.h"    // js::StringToNumber
 #include "jstypes.h"  // JS_PUBLIC_API
 
+#include "js/Context.h"   // js::AssertHeapIsIdle
 #include "js/Equality.h"  // JS::LooselyEqual, JS::StrictlyEqual, JS::SameValue
 #include "js/Result.h"    // JS_TRY_VAR_OR_RETURN_FALSE
 #include "js/RootingAPI.h"  // JS::Rooted
 #include "js/Value.h"       // JS::Int32Value, JS::SameType, JS::Value
 #include "vm/BigIntType.h"  // JS::BigInt
 #include "vm/JSContext.h"   // CHECK_THREAD
 #include "vm/JSObject.h"    // js::ToPrimitive
 #include "vm/StringType.h"  // js::EqualStrings
--- a/js/src/vm/ErrorObject.cpp
+++ b/js/src/vm/ErrorObject.cpp
@@ -11,17 +11,16 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Maybe.h"
 
 #include <utility>
 
 #include "jsapi.h"
 #include "jsexn.h"
-#include "jsfriendapi.h"
 #include "jsnum.h"
 #include "jspubtd.h"
 #include "NamespaceImports.h"
 
 #include "builtin/Array.h"
 #include "gc/AllocKind.h"
 #include "gc/FreeOp.h"
 #include "gc/Rooting.h"
--- a/js/src/vm/ErrorReporting.h
+++ b/js/src/vm/ErrorReporting.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef vm_ErrorReporting_h
 #define vm_ErrorReporting_h
 
 #include <stdarg.h>
 #include <utility>
 
-#include "jsapi.h"        // for JSErrorNotes, JSErrorReport
 #include "jsfriendapi.h"  // for ScriptEnvironmentPreparer
 
 #include "js/UniquePtr.h"  // for UniquePtr
 #include "js/Utility.h"    // for UniqueTwoByteChars
 
 namespace js {
 
 /**
--- a/js/src/vm/Exception.cpp
+++ b/js/src/vm/Exception.cpp
@@ -1,17 +1,17 @@
 /* -*- 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/. */
 
 #include "js/Exception.h"
 
-#include "jsapi.h"  // AssertHeapIsIdle
+#include "js/Context.h"  // js::AssertHeapIsIdle
 #include "vm/JSContext.h"
 #include "vm/SavedFrame.h"
 
 using namespace js;
 
 bool JS::StealPendingExceptionStack(JSContext* cx,
                                     JS::ExceptionStack* exceptionStack) {
   if (!GetPendingExceptionStack(cx, exceptionStack)) {
--- a/js/src/vm/Modules.cpp
+++ b/js/src/vm/Modules.cpp
@@ -8,21 +8,21 @@
 
 #include "js/Modules.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 #include "mozilla/Utf8.h"        // mozilla::Utf8Unit
 
 #include <stdint.h>  // uint32_t
 
-#include "jsapi.h"    // js::AssertHeapIsIdle
 #include "jstypes.h"  // JS_PUBLIC_API
 
 #include "builtin/ModuleObject.h"  // js::FinishDynamicModuleImport, js::{,Requested}ModuleObject
 #include "frontend/BytecodeCompiler.h"  // js::frontend::CompileModule
+#include "js/Context.h"                 // js::AssertHeapIsIdle
 #include "js/RootingAPI.h"              // JS::MutableHandle
 #include "js/Value.h"                   // JS::Value
 #include "vm/JSContext.h"               // CHECK_THREAD, JSContext
 #include "vm/JSObject.h"                // JSObject
 #include "vm/Runtime.h"                 // JSRuntime
 
 #include "vm/JSContext-inl.h"  // JSContext::{c,releaseC}heck
 
--- a/js/src/vm/NativeObject.h
+++ b/js/src/vm/NativeObject.h
@@ -9,17 +9,16 @@
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 
 #include <algorithm>
 #include <stdint.h>
 
-#include "jsfriendapi.h"
 #include "NamespaceImports.h"
 
 #include "gc/Barrier.h"
 #include "gc/Marking.h"
 #include "gc/MaybeRooted.h"
 #include "gc/ZoneAllocator.h"
 #include "js/shadow/Object.h"  // JS::shadow::Object
 #include "js/shadow/Zone.h"    // JS::shadow::Zone
--- a/js/src/vm/ObjectOperations-inl.h
+++ b/js/src/vm/ObjectOperations-inl.h
@@ -12,26 +12,25 @@
 #include "vm/ObjectOperations.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 #include "mozilla/Attributes.h"  // MOZ_ALWAYS_INLINE
 #include "mozilla/Likely.h"      // MOZ_UNLIKELY
 
 #include <stdint.h>  // uint32_t
 
-#include "jsapi.h"  // JSPROP_ENUMERATE, JS::PropertyDescriptor
-
 #include "js/Class.h"  // js::{Delete,Get,Has}PropertyOp, JSMayResolveOp, JS::ObjectOpResult
-#include "js/GCAPI.h"         // JS::AutoSuppressGCAnalysis
-#include "js/Id.h"            // INT_TO_JSID, jsid, JSID_INT_MAX, SYMBOL_TO_JSID
-#include "js/RootingAPI.h"    // JS::Handle, JS::MutableHandle, JS::Rooted
-#include "js/Value.h"         // JS::ObjectValue, JS::Value
-#include "proxy/Proxy.h"      // js::Proxy
-#include "vm/JSContext.h"     // JSContext
-#include "vm/JSObject.h"      // JSObject
+#include "js/GCAPI.h"  // JS::AutoSuppressGCAnalysis
+#include "js/Id.h"     // INT_TO_JSID, jsid, JSID_INT_MAX, SYMBOL_TO_JSID
+#include "js/PropertyDescriptor.h"  // JSPROP_ENUMERATE, JS::PropertyDescriptor
+#include "js/RootingAPI.h"          // JS::Handle, JS::MutableHandle, JS::Rooted
+#include "js/Value.h"               // JS::ObjectValue, JS::Value
+#include "proxy/Proxy.h"            // js::Proxy
+#include "vm/JSContext.h"           // JSContext
+#include "vm/JSObject.h"            // JSObject
 #include "vm/NativeObject.h"  // js::NativeObject, js::Native{Get,Has,Set}Property, js::NativeGetPropertyNoGC, js::Qualified
 #include "vm/ProxyObject.h"   // js::ProxyObject
 #include "vm/StringType.h"    // js::NameToId
 #include "vm/SymbolType.h"    // JS::Symbol
 
 #include "vm/JSAtom-inl.h"  // js::IndexToId
 
 namespace js {
--- a/js/src/vm/ObjectOperations.h
+++ b/js/src/vm/ObjectOperations.h
@@ -9,26 +9,25 @@
 #ifndef vm_ObjectOperations_h
 #define vm_ObjectOperations_h
 
 #include "mozilla/Attributes.h"  // MOZ_ALWAYS_INLINE
 #include "mozilla/Maybe.h"
 
 #include <stdint.h>  // uint32_t
 
-#include "jsapi.h"  // JSPROP_ENUMERATE, JS::PropertyDescriptor
-
-#include "js/Class.h"       // JS::ObjectOpResult
-#include "js/Id.h"          // INT_TO_JSID, jsid, JSID_INT_MAX, SYMBOL_TO_JSID
-#include "js/RootingAPI.h"  // JS::Handle, JS::MutableHandle, JS::Rooted
-#include "js/Value.h"       // JS::Value
-#include "vm/JSContext.h"   // JSContext
-#include "vm/JSObject.h"    // JSObject
-#include "vm/StringType.h"  // js::NameToId
-#include "vm/SymbolType.h"  // JS::Symbol
+#include "js/Class.h"  // JS::ObjectOpResult
+#include "js/Id.h"     // INT_TO_JSID, jsid, JSID_INT_MAX, SYMBOL_TO_JSID
+#include "js/PropertyDescriptor.h"  // JSPROP_ENUMERATE, JS::PropertyDescriptor
+#include "js/RootingAPI.h"          // JS::Handle, JS::MutableHandle, JS::Rooted
+#include "js/Value.h"               // JS::Value
+#include "vm/JSContext.h"           // JSContext
+#include "vm/JSObject.h"            // JSObject
+#include "vm/StringType.h"          // js::NameToId
+#include "vm/SymbolType.h"          // JS::Symbol
 
 namespace js {
 
 class PropertyName;
 
 // The functions below are the fundamental operations on objects. See the
 // comment about "Standard internal methods" in jsapi.h.
 
--- a/js/src/vm/PropertyAndElement.cpp
+++ b/js/src/vm/PropertyAndElement.cpp
@@ -6,17 +6,16 @@
 
 #include "js/PropertyAndElement.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
 #include <stddef.h>  // size_t
 #include <stdint.h>  // uint32_t
 
-#include "jsapi.h"        // JS::IdVector
 #include "jsfriendapi.h"  // js::GetPropertyKeys, JSITER_OWNONLY
 #include "jstypes.h"      // JS_PUBLIC_API
 
 #include "js/CallArgs.h"            // JSNative
 #include "js/Class.h"               // JS::ObjectOpResult
 #include "js/Context.h"             // AssertHeapIsIdle
 #include "js/GCVector.h"            // JS::GCVector, JS::RootedVector
 #include "js/Id.h"                  // JS::PropertyKey, jsid
--- a/js/src/vm/PropertyDescriptor.cpp
+++ b/js/src/vm/PropertyDescriptor.cpp
@@ -6,18 +6,18 @@
 
 #include "js/PropertyDescriptor.h"
 
 #include "mozilla/Maybe.h"  // mozilla::Maybe
 
 #include <stddef.h>  // size_t
 #include <string.h>  // strlen
 
-#include "jsapi.h"                // AssertHeapIsIdle
 #include "jstypes.h"              // JS_PUBLIC_API
+#include "js/Context.h"           // js::AssertHeapIsIdle
 #include "js/Id.h"                // jsid
 #include "js/RootingAPI.h"        // JS::Rooted, JS::Handle, JS::MutableHandle
 #include "vm/JSAtom.h"            // JSAtom, Atomize, AtomizeChars
 #include "vm/JSContext.h"         // JSContext, CHECK_THREAD
 #include "vm/JSObject.h"          // JSObject
 #include "vm/ObjectOperations.h"  // GetOwnPropertyDescriptor
 
 #include "vm/JSAtom-inl.h"     // AtomToId
--- a/js/src/vm/Runtime.cpp
+++ b/js/src/vm/Runtime.cpp
@@ -1,14 +1,16 @@
 /* -*- 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/. */
 
+#include "vm/Runtime.h"
+
 #include "mozilla/Atomics.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/ThreadLocal.h"
 
 #if defined(XP_DARWIN)
 #  include <mach/mach.h>
 #elif defined(XP_UNIX)
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -9,17 +9,16 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/DebugOnly.h"
 
 #include <algorithm>
 #include <math.h>
 #include <utility>
 
 #include "jsapi.h"
-#include "jsfriendapi.h"
 #include "jsmath.h"
 #include "jsnum.h"
 
 #include "gc/FreeOp.h"
 #include "gc/HashUtil.h"
 #include "gc/Marking.h"
 #include "gc/Policy.h"
 #include "gc/Rooting.h"
--- a/js/src/vm/SelfHosting.h
+++ b/js/src/vm/SelfHosting.h
@@ -2,17 +2,16 @@
  * 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 vm_SelfHosting_h_
 #define vm_SelfHosting_h_
 
-#include "jsapi.h"
 #include "NamespaceImports.h"
 
 #include "vm/Stack.h"
 
 namespace js {
 
 ScriptSourceObject* SelfHostingScriptSourceObject(JSContext* cx);
 
--- a/js/src/vm/Shape.h
+++ b/js/src/vm/Shape.h
@@ -13,18 +13,16 @@
 #include "mozilla/HashFunctions.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/TemplateLib.h"
 
 #include <algorithm>
 
-#include "jsapi.h"
-#include "jsfriendapi.h"
 #include "jstypes.h"
 #include "NamespaceImports.h"
 
 #include "gc/Barrier.h"
 #include "gc/FreeOp.h"
 #include "gc/MaybeRooted.h"
 #include "gc/Rooting.h"
 #include "js/HashTable.h"
--- a/js/src/vm/SharedArrayObject.cpp
+++ b/js/src/vm/SharedArrayObject.cpp
@@ -5,18 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "vm/SharedArrayObject.h"
 
 #include "mozilla/Atomics.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/DebugOnly.h"
 
-#include "jsfriendapi.h"
-
 #include "gc/FreeOp.h"
 #include "jit/AtomicOperations.h"
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/PropertySpec.h"
 #include "js/SharedArrayBuffer.h"
 #include "js/Wrapper.h"
 #include "util/Memory.h"
 #include "vm/SharedMem.h"
--- a/js/src/vm/SharedArrayObject.h
+++ b/js/src/vm/SharedArrayObject.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 vm_SharedArrayObject_h
 #define vm_SharedArrayObject_h
 
 #include "mozilla/Atomics.h"
 
-#include "jsapi.h"
 #include "jstypes.h"
 
 #include "gc/Barrier.h"
 #include "gc/Memory.h"
 #include "vm/ArrayBufferObject.h"
 #include "vm/JSObject.h"
 #include "wasm/WasmMemory.h"
 
--- a/js/src/vm/StringType.h
+++ b/js/src/vm/StringType.h
@@ -9,17 +9,16 @@
 
 #include "mozilla/Maybe.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Range.h"
 #include "mozilla/TextUtils.h"
 
 #include <type_traits>  // std::is_same
 
-#include "jsapi.h"
 #include "jstypes.h"  // js::Bit
 
 #include "gc/Allocator.h"
 #include "gc/Barrier.h"
 #include "gc/Cell.h"
 #include "gc/MaybeRooted.h"
 #include "gc/Nursery.h"
 #include "gc/RelocationOverlay.h"
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -34,17 +34,16 @@
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/RangedPtr.h"
 #include "mozilla/ScopeExit.h"
 
 #include <algorithm>
 #include <memory>
 #include <utility>
 
-#include "jsapi.h"
 #include "jsdate.h"
 
 #include "builtin/DataViewObject.h"
 #include "builtin/MapObject.h"
 #include "js/Array.h"        // JS::GetArrayLength, JS::IsArrayObject
 #include "js/ArrayBuffer.h"  // JS::{ArrayBufferHasData,DetachArrayBuffer,IsArrayBufferObject,New{,Mapped}ArrayBufferWithContents,ReleaseMappedArrayBufferContents}
 #include "js/Date.h"
 #include "js/experimental/TypedData.h"  // JS_NewDataView, JS_New{{Ui,I}nt{8,16,32},Float{32,64},Uint8Clamped,Big{Ui,I}nt64}ArrayWithBuffer
--- a/js/src/vm/SymbolType.h
+++ b/js/src/vm/SymbolType.h
@@ -4,18 +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 vm_SymbolType_h
 #define vm_SymbolType_h
 
 #include <stdio.h>
 
-#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/shadow/Symbol.h"  // JS::shadow::Symbol
 #include "js/Symbol.h"
--- a/js/src/vm/ToSource.cpp
+++ b/js/src/vm/ToSource.cpp
@@ -7,18 +7,16 @@
 #include "vm/ToSource.h"
 
 #include "mozilla/Assertions.h"     // MOZ_ASSERT
 #include "mozilla/FloatingPoint.h"  // mozilla::IsNegativeZero
 
 #include <iterator>  // std::size
 #include <stdint.h>  // uint32_t
 
-#include "jsfriendapi.h"  // CheckRecursionLimit
-
 #include "builtin/Array.h"          // ArrayToSource
 #include "builtin/Boolean.h"        // BooleanToString
 #include "builtin/Object.h"         // ObjectToSource
 #include "gc/Allocator.h"           // CanGC
 #include "js/CallAndConstruct.h"    // JS::IsCallable
 #include "js/Class.h"               // ESClass
 #include "js/friend/StackLimits.h"  // js::AutoCheckRecursionLimit
 #include "js/Object.h"              // JS::GetBuiltinClass
--- a/js/src/vm/TraceLogging.h
+++ b/js/src/vm/TraceLogging.h
@@ -9,20 +9,18 @@
 
 #include "mozilla/LinkedList.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Vector.h"
 
 #include <utility>
 
-#include "jsapi.h"
-#include "jsfriendapi.h"
-
 #include "js/AllocPolicy.h"
+#include "js/ErrorReport.h"
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage, JSMSG_*
 #include "js/HashTable.h"
 #include "js/TraceLoggerAPI.h"
 #include "js/TypeDecls.h"
 #include "js/Utility.h"
 #include "js/Vector.h"
 #include "threading/LockGuard.h"
 #include "vm/MutexIDs.h"
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -13,17 +13,16 @@
 #include "mozilla/TextUtils.h"
 
 #include <string>
 #include <string.h>
 #if !defined(XP_WIN) && !defined(__wasi__)
 #  include <sys/mman.h>
 #endif
 
-#include "jsapi.h"
 #include "jsnum.h"
 #include "jstypes.h"
 
 #include "builtin/Array.h"
 #include "builtin/DataViewObject.h"
 #include "builtin/TypedArrayConstants.h"
 #include "gc/Barrier.h"
 #include "gc/Marking.h"
--- a/js/src/vm/Warnings.cpp
+++ b/js/src/vm/Warnings.cpp
@@ -4,19 +4,19 @@
  * 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/Warnings.h"
 #include "vm/Warnings.h"
 
 #include <stdarg.h>  // va_{list,start,end}
 
-#include "jsapi.h"    // js::AssertHeapIsIdle
 #include "jstypes.h"  // JS_PUBLIC_API
 
+#include "js/Context.h"               // js::AssertHeapIsIdle
 #include "js/friend/ErrorMessages.h"  // js::GetErrorMessage
 #include "vm/ErrorReporting.h"        // IsWarning
 #include "vm/JSContext.h"  // js::ArgumentsAre{ASCII,Latin1,UTF8}, js::ReportError{Number}VA
 
 using js::ArgumentsAreASCII;
 using js::ArgumentsAreLatin1;
 using js::ArgumentsAreUTF8;
 using js::AssertHeapIsIdle;
--- a/js/src/vm/WindowProxy.cpp
+++ b/js/src/vm/WindowProxy.cpp
@@ -5,18 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* WindowProxy and Window implementation, for the web browser embedding. */
 
 #include "js/friend/WindowProxy.h"
 
 #include "mozilla/Assertions.h"  // MOZ_ASSERT
 
-#include "jsapi.h"  // js::AssertHeapIsIdle
-
+#include "js/Context.h"       // js::AssertHeapIsIdle
 #include "vm/GlobalObject.h"  // js::GlobalObject
 #include "vm/JSContext.h"     // JSContext, CHECK_THREAD
 #include "vm/JSObject.h"      // JSObject
 #include "vm/Runtime.h"       // JSRuntime
 
 #include "vm/JSContext-inl.h"  // JSContext::check
 #include "vm/JSObject-inl.h"   // JSObject::nonCCWGlobal
 
--- a/js/src/vm/Xdr.cpp
+++ b/js/src/vm/Xdr.cpp
@@ -10,18 +10,16 @@
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Utf8.h"
 
 #include <algorithm>  // std::transform
 #include <string.h>
 #include <type_traits>  // std::is_same
 #include <utility>      // std::move
 
-#include "jsapi.h"
-
 #include "builtin/ModuleObject.h"
 #include "debugger/DebugAPI.h"
 #include "frontend/CompilationStencil.h"  // frontend::{CompilationStencil, ExtensibleCompilationStencil, CompilationStencilMerger, BorrowingCompilationStencil}
 #include "frontend/StencilXdr.h"          // frontend::StencilXDR
 #include "js/BuildId.h"                   // JS::BuildIdCharVector
 #include "vm/JSContext.h"
 #include "vm/JSScript.h"
 #include "vm/SharedStencil.h"  // js::SourceExtent