Bug 1640188 - Add pref and flag to enable Iterator Helpers in nightly, off by default. r=jorendorff

Differential Revision: https://phabricator.services.mozilla.com/D76542
This commit is contained in:
Adam Vandolder 2020-05-26 14:31:48 +00:00
Родитель 9a64982c05
Коммит a7c1394496
5 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -228,6 +228,12 @@ class JS_PUBLIC_API RealmCreationOptions {
return *this; return *this;
} }
bool getIteratorHelpersEnabled() const { return iteratorHelpers_; }
RealmCreationOptions& setIteratorHelpersEnabled(bool flag) {
iteratorHelpers_ = flag;
return *this;
}
// This flag doesn't affect JS engine behavior. It is used by Gecko to // 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 // mark whether content windows and workers are "Secure Context"s. See
// https://w3c.github.io/webappsec-secure-contexts/ // https://w3c.github.io/webappsec-secure-contexts/
@ -267,6 +273,7 @@ class JS_PUBLIC_API RealmCreationOptions {
bool weakRefs_ = false; bool weakRefs_ = false;
bool toSource_ = false; bool toSource_ = false;
bool propertyErrorMessageFix_ = false; bool propertyErrorMessageFix_ = false;
bool iteratorHelpers_ = false;
bool secureContext_ = false; bool secureContext_ = false;
}; };

Просмотреть файл

@ -512,6 +512,7 @@ bool shell::enableReadableStreamPipeTo = false;
bool shell::enableWeakRefs = false; bool shell::enableWeakRefs = false;
bool shell::enableToSource = false; bool shell::enableToSource = false;
bool shell::enablePropertyErrorMessageFix = false; bool shell::enablePropertyErrorMessageFix = false;
bool shell::enableIteratorHelpers = false;
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL
uint32_t shell::gZealBits = 0; uint32_t shell::gZealBits = 0;
uint32_t shell::gZealFrequency = 0; uint32_t shell::gZealFrequency = 0;
@ -3891,7 +3892,8 @@ static void SetStandardRealmOptions(JS::RealmOptions& options) {
.setReadableStreamPipeToEnabled(enableReadableStreamPipeTo) .setReadableStreamPipeToEnabled(enableReadableStreamPipeTo)
.setWeakRefsEnabled(enableWeakRefs) .setWeakRefsEnabled(enableWeakRefs)
.setToSourceEnabled(enableToSource) .setToSourceEnabled(enableToSource)
.setPropertyErrorMessageFixEnabled(enablePropertyErrorMessageFix); .setPropertyErrorMessageFixEnabled(enablePropertyErrorMessageFix)
.setIteratorHelpersEnabled(enableIteratorHelpers);
} }
static MOZ_MUST_USE bool CheckRealmOptions(JSContext* cx, static MOZ_MUST_USE bool CheckRealmOptions(JSContext* cx,
@ -10258,6 +10260,7 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
enableToSource = !op.getBoolOption("disable-tosource"); enableToSource = !op.getBoolOption("disable-tosource");
enablePropertyErrorMessageFix = enablePropertyErrorMessageFix =
!op.getBoolOption("disable-property-error-message-fix"); !op.getBoolOption("disable-property-error-message-fix");
enableIteratorHelpers = op.getBoolOption("enable-iterator-helpers");
JS::ContextOptionsRef(cx) JS::ContextOptionsRef(cx)
.setAsmJS(enableAsmJS) .setAsmJS(enableAsmJS)
@ -11129,6 +11132,8 @@ int main(int argc, char** argv, char** envp) {
!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 "
"property of null or undefined") || "property of null or undefined") ||
!op.addBoolOption('\0', "enable-iterator-helpers",
"Enable iterator helpers") ||
!op.addStringOption('\0', "shared-memory", "on/off", !op.addStringOption('\0', "shared-memory", "on/off",
"SharedArrayBuffer and Atomics " "SharedArrayBuffer and Atomics "
#if SHARED_MEMORY_DEFAULT #if SHARED_MEMORY_DEFAULT

Просмотреть файл

@ -138,6 +138,7 @@ extern bool enableReadableStreamPipeTo;
extern bool enableWeakRefs; extern bool enableWeakRefs;
extern bool enableToSource; extern bool enableToSource;
extern bool enablePropertyErrorMessageFix; extern bool enablePropertyErrorMessageFix;
extern bool enableIteratorHelpers;
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL
extern uint32_t gZealBits; extern uint32_t gZealBits;
extern uint32_t gZealFrequency; extern uint32_t gZealFrequency;

Просмотреть файл

@ -758,6 +758,7 @@ static mozilla::Atomic<bool> sStreamsEnabled(false);
static mozilla::Atomic<bool> sPropertyErrorMessageFixEnabled(false); static mozilla::Atomic<bool> sPropertyErrorMessageFixEnabled(false);
static mozilla::Atomic<bool> sWeakRefsEnabled(false); static mozilla::Atomic<bool> sWeakRefsEnabled(false);
static mozilla::Atomic<bool> sIteratorHelpersEnabled(false);
void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) { void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) {
options.creationOptions() options.creationOptions()
@ -769,7 +770,8 @@ void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) {
.setWritableStreamsEnabled( .setWritableStreamsEnabled(
StaticPrefs::javascript_options_writable_streams()) StaticPrefs::javascript_options_writable_streams())
.setPropertyErrorMessageFixEnabled(sPropertyErrorMessageFixEnabled) .setPropertyErrorMessageFixEnabled(sPropertyErrorMessageFixEnabled)
.setWeakRefsEnabled(sWeakRefsEnabled); .setWeakRefsEnabled(sWeakRefsEnabled)
.setIteratorHelpersEnabled(sIteratorHelpersEnabled);
} }
static void LoadStartupJSPrefs(XPCJSContext* xpccx) { static void LoadStartupJSPrefs(XPCJSContext* xpccx) {
@ -947,6 +949,8 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
#ifdef NIGHTLY_BUILD #ifdef NIGHTLY_BUILD
sWeakRefsEnabled = sWeakRefsEnabled =
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.weakrefs"); Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.weakrefs");
sIteratorHelpersEnabled =
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.iterator_helpers");
#endif #endif
#ifdef JS_GC_ZEAL #ifdef JS_GC_ZEAL

Просмотреть файл

@ -4715,6 +4715,12 @@
type: RelaxedAtomicBool type: RelaxedAtomicBool
value: false value: false
mirror: always mirror: always
# Experimental support for Iterator Helpers in JavaScript.
- name: javascript.options.experimental.iterator_helpers
type: RelaxedAtomicBool
value: false
mirror: always
#endif #endif
# The amount of time we wait between a request to GC (due to leaving a page) and doing the actual GC, in ms. # The amount of time we wait between a request to GC (due to leaving a page) and doing the actual GC, in ms.