Skip to content

Commit

Permalink
Bug 1860887 - Enable JSON.parse with source when configured r=jandem
Browse files Browse the repository at this point in the history
  • Loading branch information
bthrall committed Feb 2, 2024
1 parent e6f387a commit f92f334
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions js/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,24 @@ def enable_decorators(value):
set_config("ENABLE_DECORATORS", enable_decorators)
set_define("ENABLE_DECORATORS", enable_decorators)

# Enable JSON.parse with source
# ===================================================
option(
"--enable-json-parse-with-source",
default=moz_debug,
help="Enable experimental JS JSON.parse with source support",
)


@depends("--enable-json-parse-with-source", moz_debug)
def enable_json_parse_with_source(value, moz_debug):
if value or moz_debug:
return True


set_config("ENABLE_JSON_PARSE_WITH_SOURCE", enable_json_parse_with_source)
set_define("ENABLE_JSON_PARSE_WITH_SOURCE", enable_json_parse_with_source)


# Portable Baseline Intepreter
# =======================================================
Expand Down
9 changes: 9 additions & 0 deletions js/src/builtin/TestingFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,15 @@ static bool GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) {
return false;
}

#ifdef ENABLE_JSON_PARSE_WITH_SOURCE
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "json-parse-with-source", value)) {
return false;
}

#ifdef FUZZING
value = BooleanValue(true);
#else
Expand Down

0 comments on commit f92f334

Please sign in to comment.