зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1259822 - Part 1: Add pref to enable fix for accessing property of null or undefined. r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D58103 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9aff8c3b36
Коммит
66979085f1
|
@ -191,6 +191,14 @@ class JS_PUBLIC_API RealmCreationOptions {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool getPropertyErrorMessageFixEnabled() const {
|
||||
return propertyErrorMessageFix_;
|
||||
}
|
||||
RealmCreationOptions& setPropertyErrorMessageFixEnabled(bool flag) {
|
||||
propertyErrorMessageFix_ = flag;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// This flag doesn't affect JS engine behavior. It is used by Gecko to
|
||||
// mark whether content windows and workers are "Secure Context"s. See
|
||||
// https://w3c.github.io/webappsec-secure-contexts/
|
||||
|
@ -230,6 +238,7 @@ class JS_PUBLIC_API RealmCreationOptions {
|
|||
bool awaitFix_ = false;
|
||||
bool weakRefs_ = false;
|
||||
bool toSource_ = false;
|
||||
bool propertyErrorMessageFix_ = false;
|
||||
bool secureContext_ = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -500,6 +500,7 @@ bool shell::enableFields = false;
|
|||
bool shell::enableAwaitFix = false;
|
||||
bool shell::enableWeakRefs = false;
|
||||
bool shell::enableToSource = false;
|
||||
bool shell::enablePropertyErrorMessageFix = false;
|
||||
#ifdef JS_GC_ZEAL
|
||||
uint32_t shell::gZealBits = 0;
|
||||
uint32_t shell::gZealFrequency = 0;
|
||||
|
@ -3715,7 +3716,8 @@ static void SetStandardRealmOptions(JS::RealmOptions& options) {
|
|||
.setFieldsEnabled(enableFields)
|
||||
.setAwaitFixEnabled(enableAwaitFix)
|
||||
.setWeakRefsEnabled(enableWeakRefs)
|
||||
.setToSourceEnabled(enableToSource);
|
||||
.setToSourceEnabled(enableToSource)
|
||||
.setPropertyErrorMessageFixEnabled(enablePropertyErrorMessageFix);
|
||||
options.behaviors().setDeferredParserAlloc(enableDeferredMode);
|
||||
}
|
||||
|
||||
|
@ -10388,6 +10390,8 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
|
|||
enableAwaitFix = op.getBoolOption("enable-experimental-await-fix");
|
||||
enableWeakRefs = op.getBoolOption("enable-weak-refs");
|
||||
enableToSource = !op.getBoolOption("disable-tosource");
|
||||
enablePropertyErrorMessageFix =
|
||||
!op.getBoolOption("disable-property-error-message-fix");
|
||||
|
||||
JS::ContextOptionsRef(cx)
|
||||
.setAsmJS(enableAsmJS)
|
||||
|
@ -11187,6 +11191,9 @@ int main(int argc, char** argv, char** envp) {
|
|||
"Enable new, faster await semantics") ||
|
||||
!op.addBoolOption('\0', "enable-weak-refs", "Enable weak references") ||
|
||||
!op.addBoolOption('\0', "disable-tosource", "Disable toSource/uneval") ||
|
||||
!op.addBoolOption('\0', "disable-property-error-message-fix",
|
||||
"Disable fix for the error message when accessing "
|
||||
"property of null or undefined") ||
|
||||
!op.addStringOption('\0', "shared-memory", "on/off",
|
||||
"SharedArrayBuffer and Atomics "
|
||||
#if SHARED_MEMORY_DEFAULT
|
||||
|
|
|
@ -125,6 +125,7 @@ extern bool enableFields;
|
|||
extern bool enableAwaitFix;
|
||||
extern bool enableWeakRefs;
|
||||
extern bool enableToSource;
|
||||
extern bool enablePropertyErrorMessageFix;
|
||||
#ifdef JS_GC_ZEAL
|
||||
extern uint32_t gZealBits;
|
||||
extern uint32_t gZealFrequency;
|
||||
|
|
|
@ -760,6 +760,7 @@ static mozilla::Atomic<bool> sStreamsEnabled(false);
|
|||
static mozilla::Atomic<bool> sFieldsEnabled(false);
|
||||
static mozilla::Atomic<bool> sParserDeferAllocationEnabled(false);
|
||||
static mozilla::Atomic<bool> sAwaitFixEnabled(false);
|
||||
static mozilla::Atomic<bool> sPropertyErrorMessageFixEnabled(false);
|
||||
|
||||
void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) {
|
||||
options.creationOptions()
|
||||
|
@ -771,7 +772,8 @@ void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) {
|
|||
.setWritableStreamsEnabled(
|
||||
StaticPrefs::javascript_options_writable_streams())
|
||||
.setFieldsEnabled(sFieldsEnabled)
|
||||
.setAwaitFixEnabled(sAwaitFixEnabled);
|
||||
.setAwaitFixEnabled(sAwaitFixEnabled)
|
||||
.setPropertyErrorMessageFixEnabled(sPropertyErrorMessageFixEnabled);
|
||||
options.behaviors().setDeferredParserAlloc(sParserDeferAllocationEnabled);
|
||||
}
|
||||
|
||||
|
@ -939,6 +941,8 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
|
|||
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.fields");
|
||||
sAwaitFixEnabled =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.await_fix");
|
||||
sPropertyErrorMessageFixEnabled =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "property_error_message_fix");
|
||||
|
||||
#ifdef DEBUG
|
||||
sExtraWarningsForSystemJS =
|
||||
|
|
|
@ -4183,6 +4183,12 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
# Use better error message when accessing property of null or undefined.
|
||||
- name: javascript.options.property_error_message_fix
|
||||
type: RelaxedAtomicBool
|
||||
value: @IS_NOT_RELEASE_OR_BETA@
|
||||
mirror: always
|
||||
|
||||
# The amount of time we wait between a request to GC (due to leaving a page) and doing the actual GC, in ms.
|
||||
- name: javascript.options.gc_delay
|
||||
type: uint32_t
|
||||
|
|
Загрузка…
Ссылка в новой задаче