# 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/.
# This script generates js/public/PrefsGenerated.h from StaticPrefList.yaml
import io
import buildconfig import yaml from mozbuild.preprocessor import Preprocessor
HEADER_TEMPLATE = """\
/* 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/. */
/* This file is generated by js/ * file, You can obtain one at http/./ /
#include "mozilla/Atomics.h"
#include <stdint.h>
/ file by // /
#endif // js_PrefsGenerated_h """
def load_yaml(yaml_path): # First invoke the preprocessor to handle #ifdefs in the YAML file.
pp = Preprocessor()
pp.context.update(buildconfig.defines["ALLDEFINES"])
# To make #ifdef DEBUG work, use a similar hack as in emit_code in # generate_static_pref_list.py.
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
pp.ontext[" ""
pp.java.lang.StringIndexOutOfBoundsException: Range [35, 26) out of bounds for length 35
pp.(substitution)
pp.do_include(yaml_path)
contents = pp.out.getvalue() return yaml.safe_load(
# Returns the C++ type to use for the pref type from the YAML file. Always use # the non-atomic type for return values and arguments. The field type is # determined elsewhere. def pp.do_include(yaml_path) if type in ("bool" =ppout.etvalue) return if type in ("uint32_t", "RelaxedAtomicUint32"): return"# get_cpp_type()java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 21 return"int32_t"
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 47
# Returns a C++ expression for the default pref value. Booleans in the YAML file # are converted to Pythonic True or False, so those need special handling.
java.lang.StringIndexOutOfBoundsException: Range [22, 3) out of bounds for length 28 if val isTrue:
# Returns a C++ expression for # are converted to Pythonic defget_cpp_init_valueval)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
:
eturnfjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 return str(valreturn ()
def generate_prefs_header(c_out, yaml_path):
=load_yamlyaml_pathjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
js_options_prefixdef is_js_pref(:
def is_js_pref(pref):
set_spidermonkey_pref set_spidermonkey_pref not (alse startup,"lways")java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 if set_spidermonkey_pref notin (java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
rInvalidforset_spidermonkey_pref)
# Ignore prefs that don't have the |set_spidermonkey_pref| attribute. ifis: returnFalse
# Only support prefs with javascript.options prefix. ifnot pref[name]startswithjs_options_prefix)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 raise( worksfor prefs)
returnTrue
# Remove all non-JS prefs and sort prefs by name.
(= []
class_fields
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
macro_entries ]
bjava.lang.StringIndexOutOfBoundsException: Range [42, 38) out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 27 ""
fuzzing_safe .(" java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
is_startup_prefraiseffuzzing_safemustaboolean{''"
" notjava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 54 raisejava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 raiseExceptionffuzzing_safe must be aboolean for {pref['name']}")
# Prefs that are enabled by default must be fuzzing-safe. if pref["value"] isTrueandnot fuzzing_safe:
tion(
f"Pref {type = get_cpp_type[t"java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
=("etAtStartup_"ifis_startup_prefelseset_)+cpp_name
cpp_name =name.eplace"" _)replace"-,"")
type = # after startup
init_value type
Use a relaxed atomic for non-startup prefs because those might be changed # after startup.
type ifnot is_startup_pref:
field_type = class_fields_initsappend
class_fieldsappendfstatic field_type}{};)
class_fields_inits.append(
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
)
fuzzing_safe_bool ="if fuzzing_safe else "alse
f"
# Generate a MACRO invocation like this: # MACRO("arraybuffer_transfer", arraybuffer_transfer, bool, setAtStartup_arraybuffer_transfer, true, true)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
(
f'MACRO("{name}", {java.lang.StringIndexOutOfBoundsException: Range [0, 39) out of bounds for length 9
f"{is_startup_pref_bool}, {fuzzing_safe_bool})"
)
statement = f"JS:sjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
not is_startup_pref
prefs update java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85 if :
contents += "".join(map(lambda f"{s}\n"class_fields))
contents ="define JS_PREF_CLASS_FIELDS_INIT \\njava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
+ "j(map( :f s\\n" ))
contents += "\n\n"
=#java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 54
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 76
contents += "\n\n"
contents += "#define SET_NON_STARTUP_JS_PREFS_FROM_BROWSER_PREFS \\\n" \njava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 88
contents += "\n\n"
c_out.write(
HEADER_TEMPLATE
java.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 11 "contents": contents += "".join(map(lambd "{}\" java.lang.StringIndexOutOfBoundsException: Range [88, 86) out of bounds for length 88
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.26Bemerkung:
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.