Bug 1851084 - remove javascript.options.weakrefs from Prefs r=mgaudet
Differential Revision: https://phabricator.services.mozilla.com/D236487
This commit is contained in:
@@ -106,26 +106,6 @@ class Prefs {
|
|||||||
#undef DEF_GETSET
|
#undef DEF_GETSET
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Specification for whether weak refs should be enabled and if so whether the
|
|
||||||
* FinalizationRegistry.cleanupSome method should be present.
|
|
||||||
*/
|
|
||||||
enum class WeakRefSpecifier {
|
|
||||||
Disabled,
|
|
||||||
EnabledWithCleanupSome,
|
|
||||||
EnabledWithoutCleanupSome
|
|
||||||
};
|
|
||||||
|
|
||||||
inline WeakRefSpecifier GetWeakRefsEnabled() {
|
|
||||||
if (!Prefs::weakrefs()) {
|
|
||||||
return WeakRefSpecifier::Disabled;
|
|
||||||
}
|
|
||||||
if (Prefs::experimental_weakrefs_expose_cleanupSome()) {
|
|
||||||
return WeakRefSpecifier::EnabledWithCleanupSome;
|
|
||||||
}
|
|
||||||
return WeakRefSpecifier::EnabledWithoutCleanupSome;
|
|
||||||
}
|
|
||||||
|
|
||||||
}; // namespace JS
|
}; // namespace JS
|
||||||
|
|
||||||
#endif /* js_Prefs_h */
|
#endif /* js_Prefs_h */
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ static void jsfuzz_uninit(JSContext* cx) {
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
// Override prefs for fuzz-tests.
|
// Override prefs for fuzz-tests.
|
||||||
JS::Prefs::setAtStartup_weakrefs(true);
|
|
||||||
JS::Prefs::setAtStartup_experimental_weakrefs_expose_cleanupSome(true);
|
JS::Prefs::setAtStartup_experimental_weakrefs_expose_cleanupSome(true);
|
||||||
|
|
||||||
if (!JS_Init()) {
|
if (!JS_Init()) {
|
||||||
|
|||||||
@@ -231,7 +231,6 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Override prefs for jsapi-tests.
|
// Override prefs for jsapi-tests.
|
||||||
JS::Prefs::setAtStartup_weakrefs(true);
|
|
||||||
JS::Prefs::setAtStartup_experimental_weakrefs_expose_cleanupSome(true);
|
JS::Prefs::setAtStartup_experimental_weakrefs_expose_cleanupSome(true);
|
||||||
#ifdef NIGHTLY_BUILD
|
#ifdef NIGHTLY_BUILD
|
||||||
JS::Prefs::setAtStartup_experimental_symbols_as_weakmap_keys(true);
|
JS::Prefs::setAtStartup_experimental_symbols_as_weakmap_keys(true);
|
||||||
|
|||||||
@@ -12427,7 +12427,6 @@ bool InitOptionParser(OptionParser& op) {
|
|||||||
!op.addBoolOption('\0', "less-debug-code",
|
!op.addBoolOption('\0', "less-debug-code",
|
||||||
"Emit less machine code for "
|
"Emit less machine code for "
|
||||||
"checking assertions under DEBUG.") ||
|
"checking assertions under DEBUG.") ||
|
||||||
!op.addBoolOption('\0', "disable-weak-refs", "Disable weak references") ||
|
|
||||||
!op.addBoolOption('\0', "disable-tosource", "Disable toSource/uneval") ||
|
!op.addBoolOption('\0', "disable-tosource", "Disable toSource/uneval") ||
|
||||||
!op.addBoolOption('\0', "disable-property-error-message-fix",
|
!op.addBoolOption('\0', "disable-property-error-message-fix",
|
||||||
"Disable fix for the error message when accessing "
|
"Disable fix for the error message when accessing "
|
||||||
@@ -12933,9 +12932,6 @@ bool SetGlobalOptionsPreJSInit(const OptionParser& op) {
|
|||||||
JS::Prefs::set_experimental_json_parse_with_source(true);
|
JS::Prefs::set_experimental_json_parse_with_source(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op.getBoolOption("disable-weak-refs")) {
|
|
||||||
JS::Prefs::setAtStartup_weakrefs(false);
|
|
||||||
}
|
|
||||||
JS::Prefs::setAtStartup_experimental_weakrefs_expose_cleanupSome(true);
|
JS::Prefs::setAtStartup_experimental_weakrefs_expose_cleanupSome(true);
|
||||||
|
|
||||||
if (op.getBoolOption("disable-destructuring-fuse")) {
|
if (op.getBoolOption("disable-destructuring-fuse")) {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ user_pref("privacy.trackingprotection.enabled", false);
|
|||||||
user_pref("privacy.trackingprotection.pbmode.enabled", false);
|
user_pref("privacy.trackingprotection.pbmode.enabled", false);
|
||||||
user_pref("general.useragent.updates.enabled", false);
|
user_pref("general.useragent.updates.enabled", false);
|
||||||
user_pref("browser.webapps.checkForUpdates", 0);
|
user_pref("browser.webapps.checkForUpdates", 0);
|
||||||
user_pref("javascript.options.weakrefs", true);
|
|
||||||
user_pref("javascript.options.experimental.weakrefs.expose_cleanupSome", true);
|
user_pref("javascript.options.experimental.weakrefs.expose_cleanupSome", true);
|
||||||
user_pref("javascript.options.experimental.iterator_helpers", true);
|
user_pref("javascript.options.experimental.iterator_helpers", true);
|
||||||
user_pref("javascript.options.experimental.import_attributes", true);
|
user_pref("javascript.options.experimental.import_attributes", true);
|
||||||
|
|||||||
@@ -169,6 +169,8 @@ bool GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key) {
|
|||||||
case JSProto_AsyncFunction:
|
case JSProto_AsyncFunction:
|
||||||
case JSProto_GeneratorFunction:
|
case JSProto_GeneratorFunction:
|
||||||
case JSProto_AsyncGeneratorFunction:
|
case JSProto_AsyncGeneratorFunction:
|
||||||
|
case JSProto_WeakRef:
|
||||||
|
case JSProto_FinalizationRegistry:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case JSProto_WebAssembly:
|
case JSProto_WebAssembly:
|
||||||
@@ -230,10 +232,6 @@ bool GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key) {
|
|||||||
case JSProto_SharedArrayBuffer:
|
case JSProto_SharedArrayBuffer:
|
||||||
return !cx->realm()->creationOptions().getSharedMemoryAndAtomicsEnabled();
|
return !cx->realm()->creationOptions().getSharedMemoryAndAtomicsEnabled();
|
||||||
|
|
||||||
case JSProto_WeakRef:
|
|
||||||
case JSProto_FinalizationRegistry:
|
|
||||||
return JS::GetWeakRefsEnabled() == JS::WeakRefSpecifier::Disabled;
|
|
||||||
|
|
||||||
case JSProto_AsyncIterator:
|
case JSProto_AsyncIterator:
|
||||||
return !IsAsyncIteratorHelpersEnabled();
|
return !IsAsyncIteratorHelpersEnabled();
|
||||||
|
|
||||||
|
|||||||
@@ -2221,8 +2221,7 @@ JS_PUBLIC_API bool js::ShouldIgnorePropertyDefinition(JSContext* cx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (key == JSProto_FinalizationRegistry &&
|
if (key == JSProto_FinalizationRegistry &&
|
||||||
JS::GetWeakRefsEnabled() ==
|
!JS::Prefs::experimental_weakrefs_expose_cleanupSome() &&
|
||||||
JS::WeakRefSpecifier::EnabledWithoutCleanupSome &&
|
|
||||||
id == NameToId(cx->names().cleanupSome)) {
|
id == NameToId(cx->names().cleanupSome)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ support-files = [
|
|||||||
"shadow_realm_module.js",
|
"shadow_realm_module.js",
|
||||||
]
|
]
|
||||||
prefs = [
|
prefs = [
|
||||||
"javascript.options.weakrefs=true",
|
|
||||||
"javascript.options.spectre.disable_for_isolated_content=true",
|
"javascript.options.spectre.disable_for_isolated_content=true",
|
||||||
"javascript.options.experimental.json_parse_with_source=true",
|
"javascript.options.experimental.json_parse_with_source=true",
|
||||||
"javascript.options.experimental.shadow_realms=true",
|
"javascript.options.experimental.shadow_realms=true",
|
||||||
|
|||||||
@@ -8334,13 +8334,6 @@
|
|||||||
mirror: always
|
mirror: always
|
||||||
set_spidermonkey_pref: startup
|
set_spidermonkey_pref: startup
|
||||||
|
|
||||||
# Support for weak references in JavaScript (WeakRef and FinalizationRegistry).
|
|
||||||
- name: javascript.options.weakrefs
|
|
||||||
type: bool
|
|
||||||
value: true
|
|
||||||
mirror: always
|
|
||||||
set_spidermonkey_pref: startup
|
|
||||||
|
|
||||||
# Whether to expose the FinalizationRegistry.prototype.cleanupSome method.
|
# Whether to expose the FinalizationRegistry.prototype.cleanupSome method.
|
||||||
- name: javascript.options.experimental.weakrefs.expose_cleanupSome
|
- name: javascript.options.experimental.weakrefs.expose_cleanupSome
|
||||||
type: bool
|
type: bool
|
||||||
|
|||||||
Reference in New Issue
Block a user