Skip to content

Commit

Permalink
LibWeb: Push the realm execution context before linking modules
Browse files Browse the repository at this point in the history
This patch adds a non standard step pushing the realm execution context
of fetching client's settings object onto the execution context stack
before linking a module script. Without the realm execution context
there is no current settings object, leading to a crash in
HostResolveImportedModule.
  • Loading branch information
networkException committed Oct 4, 2022
1 parent 4c11f70 commit 74240ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ void fetch_inline_module_script_graph(String const& filename, String const& sour
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-the-descendants-of-and-link-a-module-script
void fetch_descendants_of_and_link_a_module_script(JavaScriptModuleScript const& module_script, EnvironmentSettingsObject& fetch_client_settings_object, StringView destination, HashTable<ModuleLocationTuple> const& visited_set, ModuleCallback on_complete)
{
fetch_client_settings_object.realm().vm().push_execution_context(fetch_client_settings_object.realm_execution_context());

// 1. Fetch the descendants of module script, given fetch client settings object, destination, visited set, and with the following steps given result:
fetch_descendants_of_a_module_script(module_script, fetch_client_settings_object, destination, visited_set, [on_complete = move(on_complete)](JavaScriptModuleScript const* result) {
// 1. If result is null, then run onComplete given result, and return.
Expand Down

0 comments on commit 74240ab

Please sign in to comment.