Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1681046) for causing wpt failures in bar…
Browse files Browse the repository at this point in the history
…e-specifiers.sub.html. CLOSED TREE

Backed out changeset a26ecd8063ea (bug 1681046)
Backed out changeset e161663a5a7c (bug 1681046)
  • Loading branch information
cristianbrindusan committed Apr 6, 2021
1 parent 972d862 commit 08e2af1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 26 deletions.
16 changes: 2 additions & 14 deletions dom/worklet/Worklet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,20 +406,8 @@ void ExecutionRunnable::RunOnWorkletThread() {
// https://html.spec.whatwg.org/multipage/webappapis.html#run-a-module-script
// without /rethrow errors/ and so unhandled exceptions do not cause the
// promise to be rejected.
JS::Rooted<JS::Value> rval(cx);
JS::ModuleEvaluate(cx, module, &rval);
// With top-level await, we need to unwrap the module promise, or we end up
// with less helpfull error messages. A modules return value can either be a
// promise or undefined. If the value is defined, we have an async module and
// can unwrap it.
if (!rval.isUndefined() && rval.isObject()) {
JS::Rooted<JSObject*> aEvaluationPromise(cx);
aEvaluationPromise.set(&rval.toObject());
if (!JS::ThrowOnModuleEvaluationFailure(cx, aEvaluationPromise)) {
mResult = NS_ERROR_DOM_ABORT_ERR;
return;
}
}
JS::Rooted<JS::Value> ignored(cx);
JS::ModuleEvaluate(cx, module, &ignored);

// All done.
mResult = NS_OK;
Expand Down
2 changes: 1 addition & 1 deletion js/public/CompileOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class JS_PUBLIC_API TransitiveCompileOptions {
bool nonSyntacticScope = false;
bool privateClassFields = false;
bool privateClassMethods = false;
bool topLevelAwait = true;
bool topLevelAwait = false;

// True if transcoding to XDR should use Stencil instead of JSScripts.
bool useStencilXDR = false;
Expand Down
2 changes: 1 addition & 1 deletion js/public/ContextOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class JS_PUBLIC_API ContextOptions {
fuzzing_(false),
privateClassFields_(false),
privateClassMethods_(false),
topLevelAwait_(true) {
topLevelAwait_(false) {
}

bool asmJS() const { return asmJS_; }
Expand Down
6 changes: 2 additions & 4 deletions js/src/jsapi-tests/testStencil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ bool basic_test(const CharT* chars) {
JS::RootedValue rval(cx);
CHECK(JS::ModuleInstantiate(cx, moduleObject));
CHECK(JS::ModuleEvaluate(cx, moduleObject, &rval));
CHECK(!rval.isUndefined());
CHECK(rval.isUndefined());

js::RunJobs(cx);
CHECK(JS_GetProperty(cx, global, "x", &rval));
CHECK(rval.isNumber() && rval.toNumber() == 42);

Expand Down Expand Up @@ -328,9 +327,8 @@ BEGIN_TEST(testStencil_OffThreadModule) {
JS::RootedValue rval(cx);
CHECK(JS::ModuleInstantiate(cx, moduleObject));
CHECK(JS::ModuleEvaluate(cx, moduleObject, &rval));
CHECK(!rval.isUndefined());
CHECK(rval.isUndefined());

js::RunJobs(cx);
CHECK(JS_GetProperty(cx, global, "x", &rval));
CHECK(rval.isNumber() && rval.toNumber() == 42);

Expand Down
2 changes: 1 addition & 1 deletion js/src/shell/js.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ bool shell::enablePropertyErrorMessageFix = false;
bool shell::enableIteratorHelpers = false;
bool shell::enablePrivateClassFields = false;
bool shell::enablePrivateClassMethods = false;
bool shell::enableTopLevelAwait = true;
bool shell::enableTopLevelAwait = false;
bool shell::useOffThreadParseGlobal = true;
#ifdef JS_GC_ZEAL
uint32_t shell::gZealBits = 0;
Expand Down
10 changes: 7 additions & 3 deletions js/xpconnect/src/XPCJSContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,6 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
sWeakRefsExposeCleanupSome = Preferences::GetBool(
JS_OPTIONS_DOT_STR "experimental.weakrefs.expose_cleanupSome");

bool topLevelAwaitEnabled =
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.top_level_await");

// Require private fields disabled outside of nightly.
bool privateFieldsEnabled = false;
bool privateMethodsEnabled = false;
Expand All @@ -990,6 +987,13 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.private_methods");
#endif

// Require top level await disabled outside of nightly.
bool topLevelAwaitEnabled = false;
#ifdef NIGHTLY_BUILD
topLevelAwaitEnabled =
Preferences::GetBool(JS_OPTIONS_DOT_STR "experimental.top_level_await");
#endif

#ifdef JS_GC_ZEAL
int32_t zeal = Preferences::GetInt(JS_OPTIONS_DOT_STR "gczeal", -1);
int32_t zeal_frequency = Preferences::GetInt(
Expand Down
4 changes: 2 additions & 2 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5567,13 +5567,13 @@
type: bool
value: false
mirror: always
#endif // NIGHTLY_BUILD

# Experimental support for Top-level Await in JavaScript.
- name: javascript.options.experimental.top_level_await
type: bool
value: true
value: false
mirror: always
#endif // NIGHTLY_BUILD

# 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
Expand Down

0 comments on commit 08e2af1

Please sign in to comment.