From c0e8eef81b31d6dfda5ac679a13d10c409999b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 21 Feb 2024 14:53:10 +0100 Subject: [PATCH] Add test for async module not blocking sync siblings (#3955) --- ...sync-module-does-not-block-sibling-modules.js | 16 ++++++++++++++++ .../top-level-await/async-module-sync_FIXTURE.js | 4 ++++ .../top-level-await/async-module-tla_FIXTURE.js | 6 ++++++ 3 files changed, 26 insertions(+) create mode 100644 test/language/module-code/top-level-await/async-module-does-not-block-sibling-modules.js create mode 100644 test/language/module-code/top-level-await/async-module-sync_FIXTURE.js create mode 100644 test/language/module-code/top-level-await/async-module-tla_FIXTURE.js diff --git a/test/language/module-code/top-level-await/async-module-does-not-block-sibling-modules.js b/test/language/module-code/top-level-await/async-module-does-not-block-sibling-modules.js new file mode 100644 index 0000000000..709dc6fd54 --- /dev/null +++ b/test/language/module-code/top-level-await/async-module-does-not-block-sibling-modules.js @@ -0,0 +1,16 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-innermoduleevaluation +description: > + While an asynchronous module is waiting for a promise resolution, + sibling modules in the modules graph must be evaluated. +flags: [module, async] +features: [top-level-await] +---*/ + +import "./async-module-tla_FIXTURE.js"; +import { check } from "./async-module-sync_FIXTURE.js"; +assert.sameValue(check, false); +$DONE(); diff --git a/test/language/module-code/top-level-await/async-module-sync_FIXTURE.js b/test/language/module-code/top-level-await/async-module-sync_FIXTURE.js new file mode 100644 index 0000000000..67f815b3da --- /dev/null +++ b/test/language/module-code/top-level-await/async-module-sync_FIXTURE.js @@ -0,0 +1,4 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export const { check } = globalThis; diff --git a/test/language/module-code/top-level-await/async-module-tla_FIXTURE.js b/test/language/module-code/top-level-await/async-module-tla_FIXTURE.js new file mode 100644 index 0000000000..309281782b --- /dev/null +++ b/test/language/module-code/top-level-await/async-module-tla_FIXTURE.js @@ -0,0 +1,6 @@ +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +globalThis.check = false; +await 0; +globalThis.check = true;