|
1 | | -// Copyright (C) 2025 Igalia. All rights reserved. |
| 1 | +// Copyright (C) 2025 Igalia, S.L. All rights reserved. |
2 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
3 | 3 |
|
4 | 4 | /*--- |
@@ -35,35 +35,35 @@ info: | |
35 | 35 |
|
36 | 36 | flags: [async] |
37 | 37 | features: [dynamic-import] |
| 38 | +includes: [asyncHelpers.js] |
38 | 39 | ---*/ |
39 | 40 |
|
40 | 41 | let continueExecution; |
41 | | -globalThis.promise = new Promise(res => continueExecution = res); |
| 42 | +globalThis.promise = new Promise((resolve) => continueExecution = resolve); |
42 | 43 |
|
43 | | -const executionStartPromise = new Promise(res => globalThis.executionStarted = res); |
| 44 | +const executionStartPromise = new Promise((resolve) => globalThis.executionStarted = resolve); |
44 | 45 |
|
45 | | -const promiseForNamespace = import("./dynamic-import-of-waiting-module_FIXTURE.js"); |
| 46 | +asyncTest(async function () { |
| 47 | + const promiseForNamespace = import("./dynamic-import-of-waiting-module_FIXTURE.js"); |
| 48 | + |
| 49 | + await executionStartPromise; |
46 | 50 |
|
47 | | -executionStartPromise.then(() => { |
48 | 51 | const promiseForNamespace2 = import("./dynamic-import-of-waiting-module_FIXTURE.js"); |
49 | 52 |
|
50 | | - // We only continuye execution of the first fixture file after importing a second, |
| 53 | + // We only continue execution of the first fixture file after importing a second, |
51 | 54 | // empty, fixture file. This is so that if the implementation uses a separate |
52 | 55 | // queue to resolve dynamic import promises, if dynamic-import-of-waiting-module_FIXTURE |
53 | 56 | // wasn't waiting on top-level await its top-level promise would already be resolved. |
54 | | - import("./dynamic-import-of-waiting-module-2_FIXTURE.js").then(() => { |
55 | | - continueExecution(); |
56 | | - }, $DONE); |
| 57 | + await import("./dynamic-import-of-waiting-module-2_FIXTURE.js"); |
| 58 | + continueExecution(); |
57 | 59 |
|
58 | 60 | let secondPromiseResolved = false; |
59 | | - return Promise.all([ |
| 61 | + await Promise.all([ |
60 | 62 | promiseForNamespace.then(() => { |
61 | | - console.log("Resolving first..."); |
62 | 63 | assert(!secondPromiseResolved, "The second import should not resolve before the first one"); |
63 | 64 | }), |
64 | 65 | promiseForNamespace2.then(() => { |
65 | | - console.log("Resolving second..."); |
66 | 66 | secondPromiseResolved = true; |
67 | 67 | }) |
68 | 68 | ]); |
69 | | -}).then($DONE, $DONE); |
| 69 | +}); |
0 commit comments