зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1495072 - Part 2: Add pref for the await fix. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D24255 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
90f9bb269f
Коммит
1c204efb75
|
@ -146,6 +146,12 @@ class JS_PUBLIC_API RealmCreationOptions {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool getAwaitFixEnabled() const { return awaitFix_; }
|
||||
RealmCreationOptions& setAwaitFixEnabled(bool flag) {
|
||||
awaitFix_ = 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/
|
||||
|
@ -177,6 +183,7 @@ class JS_PUBLIC_API RealmCreationOptions {
|
|||
bool streams_ = false;
|
||||
bool bigint_ = false;
|
||||
bool fields_ = false;
|
||||
bool awaitFix_ = false;
|
||||
bool secureContext_ = false;
|
||||
bool clampAndJitterTime_ = true;
|
||||
};
|
||||
|
|
|
@ -45,7 +45,8 @@ static JSObject* jsfuzz_createGlobal(JSContext* cx, JSPrincipals* principals) {
|
|||
options.creationOptions()
|
||||
.setStreamsEnabled(true)
|
||||
.setBigIntEnabled(true)
|
||||
.setFieldsEnabled(false);
|
||||
.setFieldsEnabled(false)
|
||||
.setAwaitFixEnabled(true);
|
||||
newGlobal = JS_NewGlobalObject(cx, getGlobalClass(), principals,
|
||||
JS::FireOnNewGlobalHook, options);
|
||||
if (!newGlobal) {
|
||||
|
|
|
@ -82,7 +82,8 @@ JSObject* JSAPITest::createGlobal(JSPrincipals* principals) {
|
|||
options.creationOptions()
|
||||
.setStreamsEnabled(true)
|
||||
.setBigIntEnabled(true)
|
||||
.setFieldsEnabled(true);
|
||||
.setFieldsEnabled(true)
|
||||
.setAwaitFixEnabled(true);
|
||||
newGlobal = JS_NewGlobalObject(cx, getGlobalClass(), principals,
|
||||
JS::FireOnNewGlobalHook, options);
|
||||
if (!newGlobal) {
|
||||
|
|
|
@ -505,6 +505,7 @@ static bool enableAsyncStacks = false;
|
|||
static bool enableStreams = false;
|
||||
static bool enableBigInt = false;
|
||||
static bool enableFields = false;
|
||||
static bool enableAwaitFix = false;
|
||||
#ifdef JS_GC_ZEAL
|
||||
static uint32_t gZealBits = 0;
|
||||
static uint32_t gZealFrequency = 0;
|
||||
|
@ -3766,7 +3767,8 @@ static void SetStandardRealmOptions(JS::RealmOptions& options) {
|
|||
.setSharedMemoryAndAtomicsEnabled(enableSharedMemory)
|
||||
.setBigIntEnabled(enableBigInt)
|
||||
.setStreamsEnabled(enableStreams)
|
||||
.setFieldsEnabled(enableFields);
|
||||
.setFieldsEnabled(enableFields)
|
||||
.setAwaitFixEnabled(enableAwaitFix);
|
||||
}
|
||||
|
||||
static MOZ_MUST_USE bool CheckRealmOptions(JSContext* cx,
|
||||
|
@ -10163,6 +10165,7 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
|
|||
enableStreams = !op.getBoolOption("no-streams");
|
||||
enableBigInt = !op.getBoolOption("no-bigint");
|
||||
enableFields = op.getBoolOption("enable-experimental-fields");
|
||||
enableAwaitFix = op.getBoolOption("enable-experimental-await-fix");
|
||||
|
||||
JS::ContextOptionsRef(cx)
|
||||
.setBaseline(enableBaseline)
|
||||
|
@ -10876,6 +10879,8 @@ int main(int argc, char** argv, char** envp) {
|
|||
!op.addBoolOption('\0', "no-bigint", "Disable BigInt support") ||
|
||||
!op.addBoolOption('\0', "enable-experimental-fields",
|
||||
"Enable fields in classes") ||
|
||||
!op.addBoolOption('\0', "enable-experimental-await-fix",
|
||||
"Enable new, faster await semantics") ||
|
||||
!op.addStringOption('\0', "shared-memory", "on/off",
|
||||
"SharedArrayBuffer and Atomics "
|
||||
#if SHARED_MEMORY_DEFAULT
|
||||
|
|
|
@ -761,13 +761,15 @@ static mozilla::Atomic<bool> sSharedMemoryEnabled(false);
|
|||
static mozilla::Atomic<bool> sStreamsEnabled(false);
|
||||
static mozilla::Atomic<bool> sBigIntEnabled(false);
|
||||
static mozilla::Atomic<bool> sFieldsEnabled(false);
|
||||
static mozilla::Atomic<bool> sAwaitFixEnabled(false);
|
||||
|
||||
void xpc::SetPrefableRealmOptions(JS::RealmOptions& options) {
|
||||
options.creationOptions()
|
||||
.setSharedMemoryAndAtomicsEnabled(sSharedMemoryEnabled)
|
||||
.setBigIntEnabled(sBigIntEnabled)
|
||||
.setStreamsEnabled(sStreamsEnabled)
|
||||
.setFieldsEnabled(sFieldsEnabled);
|
||||
.setFieldsEnabled(sFieldsEnabled)
|
||||
.setAwaitFixEnabled(sAwaitFixEnabled);
|
||||
}
|
||||
|
||||
static void ReloadPrefsCallback(const char* pref, XPCJSContext* xpccx) {
|
||||
|
@ -848,6 +850,8 @@ static void ReloadPrefsCallback(const char* pref, XPCJSContext* xpccx) {
|
|||
sStreamsEnabled = Preferences::GetBool(JS_OPTIONS_DOT_STR "streams");
|
||||
sFieldsEnabled =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.fields");
|
||||
sAwaitFixEnabled =
|
||||
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.await_fix");
|
||||
|
||||
#ifdef DEBUG
|
||||
sExtraWarningsForSystemJS =
|
||||
|
|
|
@ -1156,6 +1156,12 @@ VARCACHE_PREF(
|
|||
RelaxedAtomicBool, false
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
"javascript.options.experimental.await_fix",
|
||||
javascript_options_experimental_await_fix,
|
||||
RelaxedAtomicBool, false
|
||||
)
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Media prefs
|
||||
|
|
|
@ -1606,6 +1606,8 @@ pref("javascript.options.bigint", false);
|
|||
|
||||
pref("javascript.options.experimental.fields", false);
|
||||
|
||||
pref("javascript.options.experimental.await_fix", false);
|
||||
|
||||
// Dynamic module import.
|
||||
pref("javascript.options.dynamicImport", true);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче