Skip to content
Web & searchmedium signalverifiedsupport checked September 3, 2026

Safari 27 fixes top-level await, after WebKit rewrote the module loader in C++

WebKit published the fix on September 2, 2026. Dynamic imports of a module that uses top-level await could complete out of order in Safari, and an importer that ran early hit an error about accessing a value before initialization. The cause was a module loader built on the abandoned WHATWG Loader proposal rather than on the algorithms in the ECMAScript standard. WebKit rewrote the loader from self-hosted JavaScript into native C++, and the result ships in Safari 27 and in Safari Technology Preview 251.

By Redakcija WebAiRadarPublished 2 min readwritten by a model
Image: WebKit

Source

Fixing Top-Level Await in Safari

WebKit Blog · Original published September 2, 2026

If a module of yours worked in Chrome and Firefox and failed in Safari with an error about accessing a value before initialization, WebKit has now named the cause and removed it. Kai Tamkun wrote on September 2, 2026 that WebKit for Safari 27 adds full spec compliance for top-level await. The fix can be tested in the Safari 27 beta and in Safari Technology Preview 251.

What went wrong

Top-level await lets a module pause its own evaluation until an asynchronous job finishes, and every module that imports it has to wait. Safari's loader did not wait. It treated the import as settled before evaluation of the awaited module had finished, so an importer could start running while the exports it needed were still uninitialized.

The post works through three sequential dynamic imports of the same module. They should finish in the order they were requested, first, second, third. In Safari they finished second, third, first, and the second and third could not read the exports at all; they ended with an error about accessing a value before initialization.

Why a rewrite rather than another patch

The loader had been written against the WHATWG Loader proposal, which was later abandoned, instead of against the ECMAScript standard's own algorithms for asynchronous module execution. That mismatch is why the bugs kept returning: each patch removed a symptom of a structure that did not match the specification it was meant to implement.

In January 2026 the team started over. The loader moved from self-hosted JavaScript to native C++, with the specification's pseudocode translated directly into code, and a draft pull request followed a few weeks later. No new feature rides along with a change like this, and the work ran from January 2026 to the Safari 27 beta announced on September 2, 2026.

How they checked it

Two checks support the claim of spec compliance, and both are described in the post.

  • A fuzzer generated module graphs and compared Safari's output byte for byte against the output of other engines.
  • Every module-related test in test262, the official ECMAScript conformance suite, passed before the change was merged.
  • WebKit reports that the rewrite introduced no regressions.
„WebKit for Safari 27 adds full spec compliance for top-level await“
Kai Tamkun, WebKit

Once a week, in your inbox

The whole week's news, gathered into one email. No ads, no passing your address on, one-click unsubscribe.

The address is used only for this roundup. It is not sold and not passed to anyone.

Related

Google's illustration: a search bar reading "Personal Intelligence" with app icons arranged around it, the Drive and Wallet icons large and sharp, the Gmail, Photos, and Calendar icons small and faded.
Web & searchmedium signal

Google's AI Mode can now draw on your Google Wallet spending if you connect it

Google is letting people connect Google Wallet to AI Mode, the conversational side of its search, with Drive and the Gemini app to follow. The connections are off until you turn them on, and Google says AI Mode can only read the accounts. AI Overviews will also start reflecting your recent searches, which you can switch off.

Googleverified