WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 242740
301711
Top-level await is broken
https://bugs.webkit.org/show_bug.cgi?id=301711
Summary
Top-level await is broken
Nico Hörter
Reported
2025-10-30 13:14:14 PDT
Created
attachment 477239
[details]
index.html, script.js and x.js files, showing the problem When a module with top-level await is imported in multiple script tags, the second import freezes indefinitely and never completes execution. Test Case: The issue can be reproduced with the following minimal test case: index.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="module" src="x.js"></script><!-- the x import here causes a freeze in script.js --> <script type="module" src="script.js"></script> <title>Document</title> </head> <body> <h1>The next line should display a number after 1 sec.:</h1> </body> </html> script.js: import { x } from './x.js'; const span = document.createElement('span'); console.log('this will be displayed'); span.textContent = x.toString(); // freeze at this line, because of x import console.log('this will never be displayed'); document.body.appendChild(span); // span will never be displayed x.js: await new Promise(resolve => { setTimeout(() => { resolve(undefined); }, 1000); }); // export after top level await export const x = 10; Expected Behavior: After approximately 1 second, the console should display both log messages ("this will be displayed" and "this will never be displayed"), and the number "10" should appear on the page. The module x.js should only execute its top-level await once, and all imports should receive the resolved module. Actual Behavior: 1. Only "this will be displayed" appears in the console 2. The execution in script.js freezes at the line span.textContent = x.toString() 3. The second console.log never executes 4. The span is never appended to the document 5. No error is thrown
Attachments
index.html, script.js and x.js files, showing the problem
(1.06 KB, application/x-zip-compressed)
2025-10-30 13:14 PDT
,
Nico Hörter
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Shu-yu Guo
Comment 1
2025-10-30 15:15:00 PDT
Thank you for the report, this is another manifestation of the known TLA issue. *** This bug has been marked as a duplicate of
bug 242740
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug