1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

LibWeb: Implement ModuleMap and expose it on EnvironmentSettingsObject

This patch adds the ModuleMap class used to keep track of the type and
url of a module as well as the fetching state associated. Each
environment settings object now also has a module map.
This commit is contained in:
networkException 2022-10-03 20:58:36 +02:00 committed by Andreas Kling
parent 83554526f0
commit 992311c0ee
5 changed files with 143 additions and 1 deletions

View file

@ -14,6 +14,7 @@
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/Origin.h>
#include <LibWeb/HTML/Scripting/ModuleMap.h>
namespace Web::HTML {
@ -61,7 +62,8 @@ struct EnvironmentSettingsObject
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-target-browsing-context
JS::ExecutionContext& realm_execution_context();
// FIXME: A module map https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-module-map
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-module-map
ModuleMap& module_map();
// https://html.spec.whatwg.org/multipage/webappapis.html#responsible-document
virtual JS::GCPtr<DOM::Document> responsible_document() = 0;
@ -113,6 +115,8 @@ protected:
private:
NonnullOwnPtr<JS::ExecutionContext> m_realm_execution_context;
ModuleMap m_module_map;
EventLoop* m_responsible_event_loop { nullptr };
// https://html.spec.whatwg.org/multipage/webappapis.html#outstanding-rejected-promises-weak-set