1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 02:28:12 +00:00

LibWeb: Add disallow further import maps steps to ESO

This commit is contained in:
networkException 2022-10-23 04:06:19 +02:00 committed by Linus Groh
parent 794dc2e16b
commit 9afea1248f
2 changed files with 16 additions and 0 deletions

View file

@ -293,6 +293,20 @@ bool EnvironmentSettingsObject::module_type_allowed(AK::String const& module_typ
return true;
}
// https://html.spec.whatwg.org/multipage/webappapis.html#disallow-further-import-maps
void EnvironmentSettingsObject::disallow_further_import_maps()
{
// 1. Let global be settingsObject's global object.
auto& global = global_object();
// 2. If global does not implement Window, then return.
if (!is<Window>(global))
return;
// 3. Set global's import maps allowed to false.
verify_cast<Window>(global).set_import_maps_allowed(false);
}
// https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object
EnvironmentSettingsObject& incumbent_settings_object()
{

View file

@ -113,6 +113,8 @@ struct EnvironmentSettingsObject
bool module_type_allowed(String const& module_type) const;
void disallow_further_import_maps();
protected:
explicit EnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext>);