tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit d9d668339bcea640886b8797108a11581cec67bb
parent 36a2c8719e7b1c08aab600ca0d976699061657b2
Author: André Bargull <andre.bargull@gmail.com>
Date:   Mon, 22 Dec 2025 15:17:59 +0000

Bug 1504045 - Part 1: Add moz.build for js/src/builtin. r=jandem

Add "js-compileflags.mozbuild" to disable "BASE_INCLUDES", which prevents
adding "js/src/builtin" to the include path. This is necessary so that
"js/src/builtin/String.h" doesn't conflict with the standard header
"string.h" on case-insensitive file systems.

Differential Revision: https://phabricator.services.mozilla.com/D276613

Diffstat:
Ajs/src/builtin/moz.build | 123+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ajs/src/js-compileflags.mozbuild | 16++++++++++++++++
Mjs/src/moz.build | 97+------------------------------------------------------------------------------
3 files changed, 140 insertions(+), 96 deletions(-)

diff --git a/js/src/builtin/moz.build b/js/src/builtin/moz.build @@ -0,0 +1,123 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +FINAL_LIBRARY = "js" + +# Includes should be relative to parent path +LOCAL_INCLUDES += ["!..", ".."] + +include("../js-compileflags.mozbuild") +include("../js-config.mozbuild") +include("../js-cxxflags.mozbuild") + +UNIFIED_SOURCES += [ + "Array.cpp", + "AtomicsObject.cpp", + "BigInt.cpp", + "Boolean.cpp", + "DataViewObject.cpp", + "Eval.cpp", + "FinalizationRegistryObject.cpp", + "JSON.cpp", + "MapObject.cpp", + "ModuleObject.cpp", + "Object.cpp", + "ParseRecordObject.cpp", + "Profilers.cpp", + "Promise.cpp", + "RawJSONObject.cpp", + "Reflect.cpp", + "ReflectParse.cpp", + "ShadowRealm.cpp", + "String.cpp", + "Symbol.cpp", + "TestingFunctions.cpp", + "TestingUtility.cpp", + "WeakMapObject.cpp", + "WeakRefObject.cpp", + "WeakSetObject.cpp", + "WrappedFunctionObject.cpp", +] + +if CONFIG["ENABLE_EXPLICIT_RESOURCE_MANAGEMENT"]: + UNIFIED_SOURCES += [ + "AsyncDisposableStackObject.cpp", + "DisposableStackObject.cpp", + "DisposableStackObjectBase.cpp", + ] + +# builtin/RegExp.cpp cannot be built in unified mode because it causes huge +# win32 test slowdowns +SOURCES += [ + "RegExp.cpp", +] + +selfhosted_inputs = [ + "../../public/friend/ErrorNumbers.msg", + # ProfilingCategoryList.h is being indirectly included, and it must be passed + # here as an input, so it's generated before this self-hosted JS code + # generation. Otherwise, it will intermittently fail to build. + "!/mozglue/baseprofiler/public/ProfilingCategoryList.h", + "TypedArrayConstants.h", + "SelfHostingDefines.h", + "Utilities.js", + "Array.js", + "AsyncFunction.js", + "AsyncIteration.js", + "Error.js", + "Generator.js", + "Iterator.js", + "Map.js", + "Number.js", + "Object.js", + "Promise.js", + "Reflect.js", + "RegExp.js", + "RegExpGlobalReplaceOpt.h.js", + "RegExpLocalReplaceOpt.h.js", + "String.js", + "Set.js", + "TypedArray.js", + "WeakMap.js", + "WeakSet.js", +] + ( + [ + "intl/NumberingSystemsGenerated.h", + "intl/Collator.js", + "intl/CommonFunctions.js", + "intl/CurrencyDataGenerated.js", + "intl/DateTimeFormat.js", + "intl/DisplayNames.js", + "intl/DurationFormat.js", + "intl/IntlObject.js", + "intl/ListFormat.js", + "intl/NumberFormat.js", + "intl/PluralRules.js", + "intl/RelativeTimeFormat.js", + "intl/SanctionedSimpleUnitIdentifiersGenerated.js", + "intl/Segmenter.js", + ] + if CONFIG["JS_HAS_INTL_API"] + else [] +) + +if CONFIG["ENABLE_EXPLICIT_RESOURCE_MANAGEMENT"]: + selfhosted_inputs += [ + "AsyncDisposableStack.js", + "DisposableStack.js", + ] + +# Prepare self-hosted JS code for embedding +GeneratedFile( + "../selfhosted.out.h", + "../selfhosted.js", + script="embedjs.py", + entry_point="generate_selfhosted", + inputs=selfhosted_inputs, +) + +if CONFIG["FUZZING_JS_FUZZILLI"]: + include("/tools/fuzzing/libfuzzer-config.mozbuild") diff --git a/js/src/js-compileflags.mozbuild b/js/src/js-compileflags.mozbuild @@ -0,0 +1,16 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +# Don't add the current directory to the include path. +# +# All includes are relative to the parent path, so the current directory doesn't +# need to be added explicitly. +# +# This also avoids include conflicts when headers have the same name, but in a +# different case, as standard headers on case-insensitive file systems. For +# example "builtin/String.h" and the standard header "string.h". +COMPILE_FLAGS["BASE_INCLUDES"] = [] +HOST_COMPILE_FLAGS["BASE_INCLUDES"] = [] diff --git a/js/src/moz.build b/js/src/moz.build @@ -301,32 +301,6 @@ EXPORTS.js.shadow += [ ] UNIFIED_SOURCES += [ - "builtin/Array.cpp", - "builtin/AtomicsObject.cpp", - "builtin/BigInt.cpp", - "builtin/Boolean.cpp", - "builtin/DataViewObject.cpp", - "builtin/Eval.cpp", - "builtin/FinalizationRegistryObject.cpp", - "builtin/JSON.cpp", - "builtin/MapObject.cpp", - "builtin/ModuleObject.cpp", - "builtin/Object.cpp", - "builtin/ParseRecordObject.cpp", - "builtin/Profilers.cpp", - "builtin/Promise.cpp", - "builtin/RawJSONObject.cpp", - "builtin/Reflect.cpp", - "builtin/ReflectParse.cpp", - "builtin/ShadowRealm.cpp", - "builtin/String.cpp", - "builtin/Symbol.cpp", - "builtin/TestingFunctions.cpp", - "builtin/TestingUtility.cpp", - "builtin/WeakMapObject.cpp", - "builtin/WeakRefObject.cpp", - "builtin/WeakSetObject.cpp", - "builtin/WrappedFunctionObject.cpp", "ds/Bitmap.cpp", "ds/LifoAlloc.cpp", "jsapi.cpp", @@ -451,14 +425,11 @@ UNIFIED_SOURCES += [ "vm/Xdr.cpp", ] -# builtin/RegExp.cpp cannot be built in unified mode because it causes huge -# win32 test slowdowns # jsmath.cpp cannot be built in unified mode because it needs to re-#define the # RtlGenRandom declaration's calling convention in <ntsecapi.h> on Windows. # vm/Interpreter.cpp is gigantic and destroys incremental build times for any # files unlucky enough to be unified with it. SOURCES += [ - "builtin/RegExp.cpp", "jsmath.cpp", "vm/Interpreter.cpp", "vm/ProfilingStack.cpp", @@ -471,9 +442,6 @@ if CONFIG["ENABLE_PORTABLE_BASELINE_INTERP"]: if CONFIG["ENABLE_EXPLICIT_RESOURCE_MANAGEMENT"]: UNIFIED_SOURCES += [ - "builtin/AsyncDisposableStackObject.cpp", - "builtin/DisposableStackObject.cpp", - "builtin/DisposableStackObjectBase.cpp", "vm/DisposableRecord.cpp", ] @@ -557,6 +525,7 @@ if CONFIG["MOZ_VTUNE"]: DIRS += [ "build", + "builtin", "debugger", "frontend", "gc", @@ -589,70 +558,6 @@ if CONFIG["JS_JITSPEW"]: FINAL_LIBRARY = "js" -selfhosted_inputs = [ - "../public/friend/ErrorNumbers.msg", - # ProfilingCategoryList.h is being indirectly included, and it must be passed - # here as an input, so it's generated before this self-hosted JS code - # generation. Otherwise, it will intermittently fail to build. - "!/mozglue/baseprofiler/public/ProfilingCategoryList.h", - "builtin/TypedArrayConstants.h", - "builtin/SelfHostingDefines.h", - "builtin/Utilities.js", - "builtin/Array.js", - "builtin/AsyncFunction.js", - "builtin/AsyncIteration.js", - "builtin/Error.js", - "builtin/Generator.js", - "builtin/Iterator.js", - "builtin/Map.js", - "builtin/Number.js", - "builtin/Object.js", - "builtin/Promise.js", - "builtin/Reflect.js", - "builtin/RegExp.js", - "builtin/RegExpGlobalReplaceOpt.h.js", - "builtin/RegExpLocalReplaceOpt.h.js", - "builtin/String.js", - "builtin/Set.js", - "builtin/TypedArray.js", - "builtin/WeakMap.js", - "builtin/WeakSet.js", -] + ( - [ - "builtin/intl/NumberingSystemsGenerated.h", - "builtin/intl/Collator.js", - "builtin/intl/CommonFunctions.js", - "builtin/intl/CurrencyDataGenerated.js", - "builtin/intl/DateTimeFormat.js", - "builtin/intl/DisplayNames.js", - "builtin/intl/DurationFormat.js", - "builtin/intl/IntlObject.js", - "builtin/intl/ListFormat.js", - "builtin/intl/NumberFormat.js", - "builtin/intl/PluralRules.js", - "builtin/intl/RelativeTimeFormat.js", - "builtin/intl/SanctionedSimpleUnitIdentifiersGenerated.js", - "builtin/intl/Segmenter.js", - ] - if CONFIG["JS_HAS_INTL_API"] - else [] -) - -if CONFIG["ENABLE_EXPLICIT_RESOURCE_MANAGEMENT"]: - selfhosted_inputs += [ - "builtin/AsyncDisposableStack.js", - "builtin/DisposableStack.js", - ] - -# Prepare self-hosted JS code for embedding -GeneratedFile( - "selfhosted.out.h", - "selfhosted.js", - script="builtin/embedjs.py", - entry_point="generate_selfhosted", - inputs=selfhosted_inputs, -) - GeneratedFile( "../public/PrefsGenerated.h", script="GeneratePrefs.py",