mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:37:35 +00:00
LibWeb: Port Intrinsics from DeprecatedString
This commit is contained in:
parent
9cd36839d2
commit
96af80acd1
279 changed files with 305 additions and 304 deletions
|
@ -24,7 +24,7 @@ void AudioConstructor::initialize(JS::Realm& realm)
|
|||
auto& vm = this->vm();
|
||||
Base::initialize(realm);
|
||||
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLAudioElementPrototype>(realm, "HTMLAudioElement"), 0);
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLAudioElementPrototype>(realm, "HTMLAudioElement"_fly_string), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void ImageConstructor::initialize(JS::Realm& realm)
|
|||
auto& vm = this->vm();
|
||||
Base::initialize(realm);
|
||||
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLImageElementPrototype>(realm, "HTMLImageElement"), 0);
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLImageElementPrototype>(realm, "HTMLImageElement"_fly_string), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ void OptionConstructor::initialize(JS::Realm& realm)
|
|||
auto& vm = this->vm();
|
||||
Base::initialize(realm);
|
||||
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLOptionElementPrototype>(realm, "HTMLOptionElement"), 0);
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<Bindings::HTMLOptionElementPrototype>(realm, "HTMLOptionElement"_fly_string), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue