Skip to content

Remove async attribute from module script tag#5870

Merged
canova merged 1 commit intofirefox-devtools:mainfrom
mstange:defer-main-bundle
Mar 2, 2026
Merged

Remove async attribute from module script tag#5870
canova merged 1 commit intofirefox-devtools:mainfrom
mstange:defer-main-bundle

Conversation

@mstange
Copy link
Contributor

@mstange mstange commented Feb 28, 2026

Fixes #5869.

Module scripts are deferred by default per HTML spec section 4.12.1 (prepare a script element): parser-inserted type=module scripts without async go into the "list of scripts that will execute when the document has finished parsing" (executed in section 13.2.7 "The end").

Adding async makes the script execute as soon as it downloads, which can happen before DOM parsing completes, breaking document.getElementById and similar DOM access in the main bundle.

@mstange mstange requested a review from canova February 28, 2026 19:27
Fixes firefox-devtools#5869.

Module scripts are deferred by default per HTML spec section 4.12.1
(prepare a script algorithm): parser-inserted type=module scripts
without async go into the "list of scripts that will execute when the
document has finished parsing" (executed in section 13.2.7 "The end").

Adding async makes the script execute as soon as it downloads, which
can happen before DOM parsing completes, breaking document.getElementById
and similar DOM access in the main bundle.
@codecov
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.56%. Comparing base (806adbc) to head (5a9acf5).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5870   +/-   ##
=======================================
  Coverage   85.56%   85.56%           
=======================================
  Files         319      319           
  Lines       31499    31499           
  Branches     8705     8705           
=======================================
  Hits        26953    26953           
  Misses       4115     4115           
  Partials      431      431           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@canova canova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I've seen this while looking into some deploy previews too. But wasn't sure if it was an issue in the deploy preview or more generic. But this makes sense. Thanks for the fix!

@canova canova merged commit 50773c7 into firefox-devtools:main Mar 2, 2026
21 checks passed
tenderlove added a commit to tenderlove/profiler that referenced this pull request Mar 2, 2026
* main: (289 commits)
  Escape CSS URLs that are coming from profiles (firefox-devtools#5874)
  Memoize the computation of search filtering across threads.
  Memoize the computation of the implementation-filtered thread across threads.
  Memoize the computation of the call node table across threads.
  Reserve functions for collapsed resources globally.
  Correctly adjust transforms when merging profiles.
  Use Int32Array and oldXToNewXPlusOne convention in merge-compare.ts.
  Make profile compacting apply to the newly-shared tables.
  Update snapshots.
  Share the stackTable, frameTable, funcTable, resourceTable and nativeSymbols across threads.
  Update docsify to v4.13.1 with a PR manually patched
  Remove unused ga docsify plugin
  Remove async attribute from module script tag. (firefox-devtools#5870)
  Bump rollup from 2.79.2 to 2.80.0
  Remove unused defaultCategory parameter.
  Implement the "collapse resource" transform with the help of the "collapse direct recursion" transform.
  Persist selected marker in URL and show sticky tooltip on load (firefox-devtools#5847)
  Fix unhandled promise rejection in setupInitialUrlState (firefox-devtools#5864)
  Force canvas redraw when system theme changes (firefox-devtools#5861)
  Fix the color of dark mode back arrow svg (firefox-devtools#5863)
  ...
@canova canova mentioned this pull request Mar 3, 2026
canova added a commit that referenced this pull request Mar 3, 2026
Changes:

[fatadel] Fix crash when nativeSymbol index is out of bounds in assembly
view (#5850)
[depfu[bot]] Update all Yarn dependencies (2026-02-25) (#5859)
[Nazım Can Altınova] Fix the color of dark mode back arrow svg (#5863)
[fatadel] Force canvas redraw when system theme changes (#5861)
[Nazım Can Altınova] Fix unhandled promise rejection in
setupInitialUrlState (#5864)
[fatadel] Persist selected marker in URL and show sticky tooltip on load
(#5847)
[Markus Stange] Implement the "collapse resource" transform with the
help of the "collapse direct recursion" transform. (#5824)
[Markus Stange] Bump rollup from 2.79.2 to 2.80.0 (#5868)
[Markus Stange] Remove async attribute from module script tag. (#5870)
[Nazım Can Altınova] Update the docsify package that's used in the user
documentation (#5872)
[Markus Stange] Share stackTable, frameTable, funcTable, resourceTable
and nativeSymbols between threads (#5482)
[Nazım Can Altınova] Escape CSS URLs that are coming from profiles
(#5874)
[fatadel] Update home page message for the other browser case (#5866)
[fatadel] Add support for ternaries in marker labels (#5857)
[Markus Stange] Reduce allocations for getStackLineInfo +
getStackAddressInfo (#5761)

And special thanks to our localizers:

de: Ger
fy-NL: Fjoerfoks
it: Francesco Lodolo [:flod]
nl: Fjoerfoks
ru: berry
ru: Valery Ledovskoy
zh-TW: Pin-guang Chen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants