Issue #2692 - Part 6: Don't #include js/SourceBufferHolder.h in jsapi.h.

Instead, require users to do so. This is a minor translation-unit size
improvement for anyone who never has to use SourceBufferHolder other than
by reference.
This commit is contained in:
Moonchild
2025-03-04 20:16:54 +01:00
committed by roytam1
parent 40ed1b10f4
commit 2e4620b5af
28 changed files with 43 additions and 8 deletions
+1
View File
@@ -27,6 +27,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsIDOMClassInfo.h"
#include "xpcpublic.h"
#include "js/SourceBufferHolder.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/IntentionalCrash.h"
#include "mozilla/Preferences.h"
+1
View File
@@ -13,6 +13,7 @@
#include "nsJSUtils.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/SourceBufferHolder.h"
#include "nsIScriptContext.h"
#include "nsIScriptGlobalObject.h"
#include "nsIXPConnect.h"
+1
View File
@@ -11,6 +11,7 @@
#include "prsystem.h"
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/SourceBufferHolder.h"
#include "xpcpublic.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContent.h"
+1
View File
@@ -24,6 +24,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/SourceBufferHolder.h"
#include "nsError.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
+1
View File
@@ -37,6 +37,7 @@
#include "ImageContainer.h"
#include "jsfriendapi.h"
#include "js/MemoryMetrics.h"
#include "js/SourceBufferHolder.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/ContentEvents.h"
+1
View File
@@ -13,6 +13,7 @@
#include "mozilla/dom/Response.h"
#include "mozilla/dom/ScriptLoader.h"
#include "mozilla/dom/ScriptSettings.h"
#include "js/SourceBufferHolder.h"
#include "nsIInputStreamPump.h"
#include "nsIThreadRetargetableRequest.h"
#include "nsNetUtil.h"
+1
View File
@@ -88,6 +88,7 @@
#include "mozilla/Preferences.h"
#include "nsTextNode.h"
#include "nsJSUtils.h"
#include "js/SourceBufferHolder.h"
#include "mozilla/dom/URL.h"
#include "nsIContentPolicy.h"
#include "mozAutoDocUpdate.h"
+1
View File
@@ -26,6 +26,7 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "js/SourceBufferHolder.h"
#include "nsFocusManager.h"
#include "nsHTMLStyleSheet.h"
#include "nsNameSpaceManager.h"
+1
View File
@@ -15,6 +15,7 @@
#include "base/basictypes.h"
#include "jsapi.h"
#include "js/SourceBufferHolder.h"
#include "xpcpublic.h"
-1
View File
@@ -113,7 +113,6 @@ using JS::IsAcceptableThis;
using JS::NativeImpl;
using JS::OwningCompileOptions;
using JS::ReadOnlyCompileOptions;
using JS::SourceBufferHolder;
using JS::TransitiveCompileOptions;
using JS::Rooted;
+2
View File
@@ -12,6 +12,7 @@
#include "jshashutil.h"
#include "frontend/BytecodeCompiler.h"
#include "js/SourceBufferHolder.h"
#include "vm/Debugger.h"
#include "vm/GlobalObject.h"
#include "vm/JSONParser.h"
@@ -25,6 +26,7 @@ using mozilla::HashString;
using mozilla::RangedPtr;
using JS::AutoCheckCannotGC;
using JS::SourceBufferHolder;
// We should be able to assert this for *any* fp->environmentChain().
static void
+4
View File
@@ -16,6 +16,7 @@
#include "frontend/FoldConstants.h"
#include "frontend/NameFunctions.h"
#include "frontend/Parser.h"
#include "js/SourceBufferHolder.h"
#include "vm/GlobalObject.h"
#include "vm/TraceLogging.h"
#include "wasm/AsmJS.h"
@@ -27,9 +28,12 @@
using namespace js;
using namespace js::frontend;
using mozilla::Maybe;
using mozilla::Nothing;
using JS::SourceBufferHolder;
class MOZ_STACK_CLASS AutoCompilationTraceLogger
{
public:
+4 -4
View File
@@ -28,7 +28,7 @@ namespace frontend {
JSScript*
CompileGlobalScript(ExclusiveContext* cx, LifoAlloc& alloc, ScopeKind scopeKind,
const ReadOnlyCompileOptions& options,
SourceBufferHolder& srcBuf,
JS::SourceBufferHolder& srcBuf,
SourceCompressionTask* extraSct = nullptr,
ScriptSourceObject** sourceObjectOut = nullptr);
@@ -36,17 +36,17 @@ JSScript*
CompileEvalScript(ExclusiveContext* cx, LifoAlloc& alloc,
HandleObject scopeChain, HandleScope enclosingScope,
const ReadOnlyCompileOptions& options,
SourceBufferHolder& srcBuf,
JS::SourceBufferHolder& srcBuf,
SourceCompressionTask* extraSct = nullptr,
ScriptSourceObject** sourceObjectOut = nullptr);
ModuleObject*
CompileModule(JSContext* cx, const ReadOnlyCompileOptions& options,
SourceBufferHolder& srcBuf);
JS::SourceBufferHolder& srcBuf);
ModuleObject*
CompileModule(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
SourceBufferHolder& srcBuf, LifoAlloc& alloc,
JS::SourceBufferHolder& srcBuf, LifoAlloc& alloc,
ScriptSourceObject** sourceObjectOut = nullptr);
MOZ_MUST_USE bool
@@ -1,6 +1,7 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*/
#include "js/SourceBufferHolder.h"
#include "jsapi-tests/tests.h"
using mozilla::ArrayLength;
+1
View File
@@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "jsfriendapi.h"
#include "js/SourceBufferHolder.h"
#include "jsapi-tests/tests.h"
BEGIN_TEST(testMutedErrors)
+1
View File
@@ -4,6 +4,7 @@
* 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/SourceBufferHolder.h"
#include "jsapi-tests/tests.h"
struct ScriptObjectFixture : public JSAPITest {
+2
View File
@@ -63,6 +63,7 @@
#include "js/Initialization.h"
#include "js/Proxy.h"
#include "js/SliceBudget.h"
#include "js/SourceBufferHolder.h"
#include "js/StructuredClone.h"
#include "js/Utility.h"
#include "vm/AsyncFunction.h"
@@ -106,6 +107,7 @@ using mozilla::PodZero;
using mozilla::Some;
using JS::AutoGCRooter;
using JS::SourceBufferHolder;
using JS::ToInt32;
using JS::ToInteger;
using JS::ToUint32;
-1
View File
@@ -38,7 +38,6 @@
#include "js/Principals.h"
#include "js/Realm.h"
#include "js/RootingAPI.h"
#include "js/SourceBufferHolder.h"
#include "js/Stream.h"
#include "js/TracingAPI.h"
#include "js/Transcoding.h"
+2
View File
@@ -39,6 +39,7 @@
#include "jit/JitFrameIterator.h"
#include "js/CallNonGenericMethod.h"
#include "js/Proxy.h"
#include "js/SourceBufferHolder.h"
#include "vm/AsyncFunction.h"
#include "vm/AsyncIteration.h"
#include "vm/Debugger.h"
@@ -67,6 +68,7 @@ using mozilla::PodCopy;
using mozilla::RangedPtr;
using mozilla::Some;
using JS::SourceBufferHolder;
static bool
fun_enumerate(JSContext* cx, HandleObject obj)
{
+3
View File
@@ -41,6 +41,7 @@
#include "jit/Ion.h"
#include "jit/IonCode.h"
#include "js/MemoryMetrics.h"
#include "js/SourceBufferHolder.h"
#include "js/Utility.h"
#include "vm/ArgumentsObject.h"
#include "vm/Compression.h"
@@ -68,6 +69,8 @@ using mozilla::PodCopy;
using mozilla::PodZero;
using mozilla::RotateLeft;
using JS::SourceBufferHolder;
template<XDRMode mode>
bool
js::XDRScriptConst(XDRState<mode>* xdr, MutableHandleValue vp)
+3 -2
View File
@@ -74,6 +74,7 @@
#include "js/Equality.h" // JS::SameValue
#include "js/GCAPI.h"
#include "js/Initialization.h"
#include "js/SourceBufferHolder.h"
#include "js/StructuredClone.h"
#include "js/TrackedOptimizationInfo.h"
#include "perf/jsperf.h"
@@ -4062,8 +4063,8 @@ ParseModule(JSContext* cx, unsigned argc, Value* vp)
return false;
const char16_t* chars = stableChars.twoByteRange().begin().get();
SourceBufferHolder srcBuf(chars, scriptContents->length(),
SourceBufferHolder::NoOwnership);
JS::SourceBufferHolder srcBuf(chars, scriptContents->length(),
SourceBufferHolder::NoOwnership);
RootedObject module(cx, frontend::CompileModule(cx, options, srcBuf));
if (!module)
+2
View File
@@ -27,6 +27,7 @@
#include "jit/BaselineJIT.h"
#include "js/Date.h"
#include "js/GCAPI.h"
#include "js/SourceBufferHolder.h"
#include "js/UbiNodeBreadthFirst.h"
#include "js/Vector.h"
#include "proxy/ScriptedProxyHandler.h"
@@ -51,6 +52,7 @@ using namespace js;
using JS::dbg::AutoEntryMonitor;
using JS::dbg::Builder;
using js::frontend::IsIdentifier;
using JS::SourceBufferHolder;
using mozilla::ArrayLength;
using mozilla::DebugOnly;
using mozilla::MakeScopeExit;
+3
View File
@@ -10,6 +10,7 @@
#include "jsnativestack.h"
#include "jsnum.h" // For FIX_FPU()
#include "js/SourceBufferHolder.h"
#include "builtin/Promise.h"
#include "frontend/BytecodeCompiler.h"
@@ -33,6 +34,8 @@ using mozilla::DebugOnly;
using mozilla::Unused;
using mozilla::TimeDuration;
using JS::SourceBufferHolder;
namespace js {
GlobalHelperThreadState* gHelperThreadState = nullptr;
+1
View File
@@ -21,6 +21,7 @@
#include "frontend/TokenStream.h"
#include "jit/Ion.h"
#include "js/SourceBufferHolder.h"
#include "threading/ConditionVariable.h"
#include "vm/MutexIDs.h"
+2
View File
@@ -33,6 +33,7 @@
#include "frontend/Parser.h"
#include "gc/Policy.h"
#include "js/MemoryMetrics.h"
#include "js/SourceBufferHolder.h"
#include "vm/SelfHosting.h"
#include "vm/StringBuffer.h"
#include "vm/Time.h"
@@ -67,6 +68,7 @@ using mozilla::PodZero;
using mozilla::PositiveInfinity;
using JS::AsmJSOption;
using JS::GenericNaN;
using JS::SourceBufferHolder;
/*****************************************************************************/
@@ -17,6 +17,7 @@
#endif
#include "jsapi.h"
#include "js/SourceBufferHolder.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIComponentManager.h"
@@ -19,6 +19,7 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js/SourceBufferHolder.h"
#include "nsJSPrincipals.h"
#include "xpcprivate.h" // For xpc::OptionsBase
#include "jswrapper.h"
+1
View File
@@ -10,6 +10,7 @@
#include "AccessCheck.h"
#include "jsfriendapi.h"
#include "js/Proxy.h"
#include "js/SourceBufferHolder.h"
#include "js/StructuredClone.h"
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"