mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-18 00:02:01 +00:00
LibWeb: Change HTML::Script to hold a realm instead of settings object
This is part of a refactor needed for introduction of the shadow realm proposal in the web platform.
This commit is contained in:
parent
0382933a0a
commit
da18551f10
Notes:
github-actions[bot]
2024-11-02 00:56:21 +00:00
Author: https://github.com/shannonbooth
Commit: da18551f10
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1955
Reviewed-by: https://github.com/ADKaster ✅
17 changed files with 164 additions and 155 deletions
|
@ -11,15 +11,22 @@ namespace Web::HTML {
|
|||
|
||||
JS_DEFINE_ALLOCATOR(Script);
|
||||
|
||||
Script::Script(URL::URL base_url, ByteString filename, EnvironmentSettingsObject& environment_settings_object)
|
||||
Script::Script(URL::URL base_url, ByteString filename, JS::Realm& realm)
|
||||
: m_base_url(move(base_url))
|
||||
, m_filename(move(filename))
|
||||
, m_settings_object(environment_settings_object)
|
||||
, m_realm(realm)
|
||||
{
|
||||
}
|
||||
|
||||
Script::~Script() = default;
|
||||
|
||||
// https://whatpr.org/html/9893/webappapis.html#settings-object
|
||||
EnvironmentSettingsObject& Script::settings_object()
|
||||
{
|
||||
// The settings object of a script is the settings object of the principal realm of the script's realm.
|
||||
return principal_realm_settings_object(principal_realm(realm()));
|
||||
}
|
||||
|
||||
void Script::visit_host_defined_self(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(*this);
|
||||
|
@ -28,7 +35,7 @@ void Script::visit_host_defined_self(JS::Cell::Visitor& visitor)
|
|||
void Script::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_settings_object);
|
||||
visitor.visit(m_realm);
|
||||
visitor.visit(m_parse_error);
|
||||
visitor.visit(m_error_to_rethrow);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue