LibWeb: Rename Bindings::HostDefined to Bindings::PrincipalHostDefined

With the introduction of shadow realms, there will be two different
possible host defined objects. For clarity, rename the existing host
defined object to PrincipalHostDefined.
This commit is contained in:
Shannon Booth 2024-10-26 21:02:28 +13:00 committed by Andrew Kaster
commit 5154df020b
Notes: github-actions[bot] 2024-11-05 18:00:05 +00:00
25 changed files with 81 additions and 89 deletions

View file

@ -140,7 +140,7 @@ JS::ExecutionContext const& execution_context_of_realm(JS::Realm const& realm)
// FIXME: 1. If realm is a principal realm, then return the realm execution context of the environment settings object of realm.
// FIXME: 2. Assert: realm is a synthetic realm.
// FIXME: 3. Return the execution context of the synthetic realm settings object of realm.
return Bindings::host_defined_environment_settings_object(realm).realm_execution_context();
return Bindings::principal_host_defined_environment_settings_object(realm).realm_execution_context();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#clean-up-after-running-script
@ -327,7 +327,7 @@ JS::Realm& incumbent_realm()
EnvironmentSettingsObject& incumbent_settings_object()
{
// FIXME: Then, the incumbent settings object is the incumbent realm's principal realm settings object.
return Bindings::host_defined_environment_settings_object(incumbent_realm());
return Bindings::principal_host_defined_environment_settings_object(incumbent_realm());
}
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-incumbent-global
@ -362,7 +362,7 @@ JS::Realm& principal_realm(JS::Realm& realm)
EnvironmentSettingsObject& principal_realm_settings_object(JS::Realm& realm)
{
// A principal realm has a [[HostDefined]] field, which contains the principal realm's settings object.
return Bindings::host_defined_environment_settings_object(realm);
return Bindings::principal_host_defined_environment_settings_object(realm);
}
// https://html.spec.whatwg.org/multipage/webappapis.html#current-settings-object
@ -392,7 +392,7 @@ JS::Realm& relevant_realm(JS::Object const& object)
EnvironmentSettingsObject& relevant_settings_object(JS::Object const& object)
{
// Then, the relevant settings object for a platform object o is the environment settings object of the relevant Realm for o.
return Bindings::host_defined_environment_settings_object(relevant_realm(object));
return Bindings::principal_host_defined_environment_settings_object(relevant_realm(object));
}
EnvironmentSettingsObject& relevant_settings_object(DOM::Node const& node)
@ -424,7 +424,7 @@ JS::Realm& entry_realm()
EnvironmentSettingsObject& entry_settings_object()
{
// Then, the entry settings object is the environment settings object of the entry realm.
return Bindings::host_defined_environment_settings_object(entry_realm());
return Bindings::principal_host_defined_environment_settings_object(entry_realm());
}
// https://html.spec.whatwg.org/multipage/webappapis.html#entry-global-object

View file

@ -6,7 +6,6 @@
#include <LibJS/Console.h>
#include <LibJS/Runtime/ConsoleObject.h>
#include <LibWeb/Bindings/HostDefined.h>
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/HTML/Scripting/Fetching.h>
#include <LibWeb/HTML/Scripting/ImportMap.h>

View file

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/HostDefined.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/PrincipalHostDefined.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
#include <LibWeb/HTML/Window.h>
@ -74,7 +74,7 @@ void WindowEnvironmentSettingsObject::setup(Page& page, URL::URL const& creation
// 7. Set realm's [[HostDefined]] field to settings object.
// Non-Standard: We store the ESO next to the web intrinsics in a custom HostDefined object
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics, page);
auto host_defined = make<Bindings::PrincipalHostDefined>(settings_object, intrinsics, page);
realm->set_host_defined(move(host_defined));
// Non-Standard: We cannot fully initialize window object until *after* the we set up

View file

@ -44,7 +44,7 @@ JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObjec
// 8. Set realm's [[HostDefined]] field to settings object.
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm);
auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics, page);
auto host_defined = make<Bindings::PrincipalHostDefined>(settings_object, intrinsics, page);
realm->set_host_defined(move(host_defined));
// Non-Standard: We cannot fully initialize worker object until *after* the we set up