1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:17:35 +00:00

LibWeb: Port Intrinsics from DeprecatedString

This commit is contained in:
Shannon Booth 2023-11-22 12:55:21 +13:00 committed by Tim Flynn
parent 9cd36839d2
commit 96af80acd1
279 changed files with 305 additions and 304 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/Forward.h>
#include <AK/HashMap.h>
#include <LibJS/Forward.h>
@ -27,7 +28,7 @@ public:
}
template<typename NamespaceType>
JS::Object& ensure_web_namespace(DeprecatedString const& namespace_name)
JS::Object& ensure_web_namespace(FlyString const& namespace_name)
{
if (auto it = m_namespaces.find(namespace_name); it != m_namespaces.end())
return *it->value;
@ -37,7 +38,7 @@ public:
}
template<typename PrototypeType>
JS::Object& ensure_web_prototype(DeprecatedString const& class_name)
JS::Object& ensure_web_prototype(FlyString const& class_name)
{
if (auto it = m_prototypes.find(class_name); it != m_prototypes.end())
return *it->value;
@ -47,7 +48,7 @@ public:
}
template<typename PrototypeType>
JS::NativeFunction& ensure_web_constructor(DeprecatedString const& class_name)
JS::NativeFunction& ensure_web_constructor(FlyString const& class_name)
{
if (auto it = m_constructors.find(class_name); it != m_constructors.end())
return *it->value;
@ -65,9 +66,9 @@ private:
template<typename PrototypeType>
void create_web_prototype_and_constructor(JS::Realm& realm);
HashMap<DeprecatedString, JS::NonnullGCPtr<JS::Object>> m_namespaces;
HashMap<DeprecatedString, JS::NonnullGCPtr<JS::Object>> m_prototypes;
HashMap<DeprecatedString, JS::GCPtr<JS::NativeFunction>> m_constructors;
HashMap<FlyString, JS::NonnullGCPtr<JS::Object>> m_namespaces;
HashMap<FlyString, JS::NonnullGCPtr<JS::Object>> m_prototypes;
HashMap<FlyString, JS::GCPtr<JS::NativeFunction>> m_constructors;
JS::NonnullGCPtr<JS::Realm> m_realm;
};
@ -77,19 +78,19 @@ private:
}
template<typename T>
[[nodiscard]] JS::Object& ensure_web_namespace(JS::Realm& realm, DeprecatedString const& namespace_name)
[[nodiscard]] JS::Object& ensure_web_namespace(JS::Realm& realm, FlyString const& namespace_name)
{
return host_defined_intrinsics(realm).ensure_web_namespace<T>(namespace_name);
}
template<typename T>
[[nodiscard]] JS::Object& ensure_web_prototype(JS::Realm& realm, DeprecatedString const& class_name)
[[nodiscard]] JS::Object& ensure_web_prototype(JS::Realm& realm, FlyString const& class_name)
{
return host_defined_intrinsics(realm).ensure_web_prototype<T>(class_name);
}
template<typename T>
[[nodiscard]] JS::NativeFunction& ensure_web_constructor(JS::Realm& realm, DeprecatedString const& class_name)
[[nodiscard]] JS::NativeFunction& ensure_web_constructor(JS::Realm& realm, FlyString const& class_name)
{
return host_defined_intrinsics(realm).ensure_web_constructor<T>(class_name);
}