Repository navigation
Conversation
|
EWS run on previous version of this PR (hash 98b9c44) Details |
|
Known limitation: concurrent imports of a module share its per-entry load promise, and each import settles on whichever rejects first — that shared promise or its own graph load. If a dependency fails and a second import attaches to the parent's still-pending load promise, that import can reject with the earlier failure even when its own LoadRequestedModules refetches the dependency successfully. The next import recovers normally, and the window is a few microtasks, so I left it out of this patch. A full fix would stop settling dynamic imports from the shared load promise and rely only on each import's own graph load. Happy to do that as a follow-up if you'd prefer. |
|
🤖 written by Claude 🤖 @kmiller68 @yoavweiss this is a follow-up to #69559 (319474@main), which stopped caching failed module fetches for the module that failed. Modules that statically import a failed dependency still cached the failure and never refetched it, so the whole importing chain stayed broken until reload. This makes it retry. Details are in the commit message and https://bugs.webkit.org/show_bug.cgi?id=327747. Testing
EWS Known limitation |
https://bugs.webkit.org/show_bug.cgi?id=327747 Reviewed by NOBODY (OOPS!). 319474@main stopped caching failed module fetches, but only for the module that failed. A module that statically imports it recorded the dependency's fetch error as its own evaluation error, and hostLoadImportedModule kept returning the dependency's cached fetch error, so the parent stayed errored for the life of the page. Per https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script step 13.1, a failed fetch removes the module map entry and nothing else; the parent's module script stays in the map, so the next load fetches the dependency again. Tag fetch failures with a new ModuleFailure::Kind::Fetch, don't record them on any entry other than the one that failed, clear the parent's rejected load promise so the next load reruns LoadRequestedModules, and remove a failed entry in hostLoadImportedModule the way loadModule already does. Concurrent imports of a module share its load promise, and with the failed entry no longer returned synchronously, that shared rejection can now settle an import before its own graph load does. Duplicate fetch errors where each import consumes the load promise so every import still rejects with its own error object (dynamic-imports-fetch-error.sub.html). The loadedModules fast path in hostLoadImportedModule also falls through when the load promise was cleared, so the graph is loaded again. * JSTests/modules/dependency-fetch-failure-retry.js: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/shared-dependency-repeated-import.https-expected.txt: Progression. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/module/shared-dependency-repeated-import.https-expected.txt: Progression. * Source/JavaScriptCore/runtime/JSMicrotask.cpp: (JSC::moduleRegistryFetchSettled): (JSC::isModuleFetchFailure): (JSC::moduleLoadStep): (JSC::moduleLoadTopRejected): (JSC::moduleLoadCombinedLoadSettled): (JSC::moduleLoadStoreError): * Source/JavaScriptCore/runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::hostLoadImportedModule): * Source/JavaScriptCore/runtime/JSModuleLoader.h: * Source/JavaScriptCore/runtime/ModuleRegistryEntry.cpp: (JSC::ModuleRegistryEntry::clearLoadPromise): * Source/JavaScriptCore/runtime/ModuleRegistryEntry.h: Co-Authored-By: Claude Opus 5.5 <[email protected]>
98b9c44 to
957e30d
Compare
|
EWS run on current version of this PR (hash 957e30d) Details |
957e30d
957e30d
🛠 playstation