diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp index b3e127b21b2..046be503ffc 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.cpp @@ -286,6 +286,15 @@ void EnvironmentSettingsObject::disallow_further_import_maps() verify_cast(global).set_import_maps_allowed(false); } +// https://whatpr.org/html/9893/webappapis.html#concept-realm-module-map +ModuleMap& module_map_of_realm(JS::Realm& realm) +{ + // FIXME: 1. If realm is a principal realm, then return the module map of the environment settings object of realm. + // FIXME: 2. Assert: realm is a synthetic realm. + // FIXME: 3. Return the module map of the synthetic realm settings object of realm. + return principal_realm_settings_object(realm).module_map(); +} + // https://html.spec.whatwg.org/multipage/webappapis.html#concept-incumbent-realm // https://whatpr.org/html/9893/b8ea975...df5706b/webappapis.html#concept-incumbent-realm JS::Realm& incumbent_realm() diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h index 2a0ad875451..f42614f6164 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h @@ -141,6 +141,7 @@ void prepare_to_run_script(JS::Realm&); void clean_up_after_running_script(JS::Realm const&); void prepare_to_run_callback(JS::Realm&); void clean_up_after_running_callback(JS::Realm const&); +ModuleMap& module_map_of_realm(JS::Realm&); EnvironmentSettingsObject& incumbent_settings_object(); JS::Realm& incumbent_realm();