mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
Issue #6294 describes an edge case where the browser crash if the same module is loaded three times in a document, but all attempts fail. Failure scenario: 1. Module load 1 set the state to "Fetching" 2. Module load 2 registers a callback to `on_complete` since the current state is "Fetching" 3. Module load 1 finish with a failure, invoking the callback for load number 2 4. Module load 3 cause a crash. The state is neither "Fetching" or "ModuleScript", so we'll reset the state to "Fetching". This invokes the callback for module load 2 again, now with an unexpected state which will cause an assert violation. Proposed fix is to remove the condition that invokes `on_complete` immediately for successfully loaded modules only, the callback should be invoked regardless of whether the fetch succeeded or failed. This reveals a separate bug in HTMLScriptElement, where `mark_as_ready()` can be invoked before `m_steps_to_run_when_the_result_is_ready` is assigned. This appears to be a spec bug, reported as https://github.com/whatwg/html/issues/12073 and addressed by delaying the callback by a task, similar to the issue was resolved for inline scripts. |
||
|---|---|---|
| .. | ||
| Agent.cpp | ||
| Agent.h | ||
| ClassicScript.cpp | ||
| ClassicScript.h | ||
| Environments.cpp | ||
| Environments.h | ||
| EnvironmentSettingsSnapshot.cpp | ||
| EnvironmentSettingsSnapshot.h | ||
| ExceptionReporter.cpp | ||
| ExceptionReporter.h | ||
| Fetching.cpp | ||
| Fetching.h | ||
| Fetching.idl | ||
| ImportMap.cpp | ||
| ImportMap.h | ||
| ImportMapParseResult.cpp | ||
| ImportMapParseResult.h | ||
| ModuleMap.cpp | ||
| ModuleMap.h | ||
| ModuleScript.cpp | ||
| ModuleScript.h | ||
| Script.cpp | ||
| Script.h | ||
| SerializedEnvironmentSettingsObject.cpp | ||
| SerializedEnvironmentSettingsObject.h | ||
| SimilarOriginWindowAgent.cpp | ||
| SimilarOriginWindowAgent.h | ||
| SyntheticRealmSettings.cpp | ||
| SyntheticRealmSettings.h | ||
| TemporaryExecutionContext.cpp | ||
| TemporaryExecutionContext.h | ||
| WindowEnvironmentSettingsObject.cpp | ||
| WindowEnvironmentSettingsObject.h | ||
| WorkerAgent.cpp | ||
| WorkerAgent.h | ||
| WorkerEnvironmentSettingsObject.cpp | ||
| WorkerEnvironmentSettingsObject.h | ||