Bug 1860889 - Remove build config for JSON.parse with source r=jandem

It should only be available in Nightly for now.

Skip the non262 test in browser reftests because that's what other tests that
require setting a preference do. We should enable it when we remove the
preference.

The ENABLE_JSON_PARSE_WITH_SOURCE #define remains so we can easily find the
places to fix up when the JSON.parse with source feature is permanently
enabled.

The JS shell option '--enable-json-parse-with-source' is present even when
ENABLE_JSON_PARSE_WITH_SOURCE is not defined because test262 tests cannot
successfully evaluate their skip-if conditions if the necessary shell-options
are not present. The option needs to be there, but it only has an effect when
ENABLE_JSON_PARSE_WITH_SOURCE is defined.

Differential Revision: https://phabricator.services.mozilla.com/D203473
This commit is contained in:
Bryan Thrall 2024-03-20 21:17:23 +00:00
parent 98c3e72e80
commit 141a80bfd7
5 changed files with 10 additions and 23 deletions

View File

@ -173,18 +173,12 @@ 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=False,
help="Enable experimental JS JSON.parse with source support",
)
@depends("--enable-json-parse-with-source")
def enable_json_parse_with_source(value):
if value:
@depends(milestone.is_nightly)
def enable_json_parse_with_source(is_nightly):
if is_nightly:
return True

View File

@ -604,15 +604,6 @@ 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

View File

@ -12019,10 +12019,8 @@ bool InitOptionParser(OptionParser& op) {
"property of null or undefined") ||
!op.addBoolOption('\0', "enable-iterator-helpers",
"Enable iterator helpers") ||
#ifdef ENABLE_JSON_PARSE_WITH_SOURCE
!op.addBoolOption('\0', "enable-json-parse-with-source",
"Enable JSON.parse with source") ||
#endif
!op.addBoolOption('\0', "enable-shadow-realms", "Enable ShadowRealms") ||
!op.addBoolOption('\0', "disable-array-grouping",
"Disable Object.groupBy and Map.groupBy") ||
@ -12653,6 +12651,10 @@ bool SetContextOptions(JSContext* cx, const OptionParser& op) {
enableToSource = !op.getBoolOption("disable-tosource");
#ifdef ENABLE_JSON_PARSE_WITH_SOURCE
enableJSONParseWithSource = op.getBoolOption("enable-json-parse-with-source");
#else
if (op.getBoolOption("enable-json-parse-with-source")) {
fprintf(stderr, "JSON.parse with source is not enabled on this build.\n");
}
#endif
enableImportAttributesAssertSyntax =
op.getBoolOption("enable-import-assertions");

View File

@ -1,4 +1,4 @@
// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('json-parse-with-source'))) shell-option(--enable-json-parse-with-source)
// |reftest| shell-option(--enable-json-parse-with-source) skip-if(!JSON.hasOwnProperty('isRawJSON')||!xulRuntime.shell)
var actual;

View File

@ -416,7 +416,7 @@ class MOZ_STACK_CLASS JSONReviveHandler : public JSONFullParseHandler<CharT> {
public:
ParseRecordObject parseRecord;
};
#endif
#endif // ENABLE_JSON_PARSE_WITH_SOURCE
template <typename CharT>
class MOZ_STACK_CLASS JSONSyntaxParseHandler {