1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibWeb: Convert the Location object to IDL

This includes:

- Moving it from Bindings/ to HTML/
- Renaming it from LocationObject to Location
- Removing the manual definitions of the constructor and prototype
- Removing special handling of the Location interface from the bindings
  generator
- Converting the JS_DEFINE_NATIVE_FUNCTIONs to regular functions
  returning DeprecatedString instead of PrimitiveString
- Adding missing (no-op) setters for the various attributes, which are
  expected to exist by the bindings generator
This commit is contained in:
Linus Groh 2023-01-18 17:41:12 +00:00 committed by Tim Flynn
parent 78d6de2ec1
commit afc055c088
19 changed files with 271 additions and 333 deletions

View file

@ -89,11 +89,10 @@ class @legacy_constructor_class@;)~~~");
add_interface(gen, interface.prototype_class, interface.constructor_class, lookup_legacy_constructor(interface));
}
// FIXME: Special case window. We should convert Window and Location to use IDL.
// FIXME: Special case window. We should convert Window to use IDL.
{
auto gen = generator.fork();
add_interface(gen, "WindowPrototype"sv, "WindowConstructor"sv, {});
add_interface(gen, "LocationPrototype"sv, "LocationConstructor"sv, {});
}
// FIXME: Special case WebAssembly. We should convert WASM to use IDL.
@ -143,12 +142,10 @@ static ErrorOr<void> generate_intrinsic_definitions(StringView output_path, Vect
}
}
// FIXME: Special case window. We should convert Window and Location to use IDL.
// FIXME: Special case window. We should convert Window to use IDL.
generator.append(R"~~~(
#include <LibWeb/Bindings/WindowConstructor.h>
#include <LibWeb/Bindings/WindowPrototype.h>
#include <LibWeb/Bindings/LocationConstructor.h>
#include <LibWeb/Bindings/LocationPrototype.h>)~~~");
#include <LibWeb/Bindings/WindowPrototype.h>)~~~");
// FIXME: Special case WebAssembly. We should convert WASM to use IDL.
generator.append(R"~~~(
@ -207,11 +204,10 @@ void Intrinsics::create_web_prototype_and_constructor<@prototype_class@>(JS::Rea
add_interface(gen, interface.name, interface.prototype_class, interface.constructor_class, lookup_legacy_constructor(interface));
}
// FIXME: Special case window. We should convert Window and Location to use IDL
// FIXME: Special case window. We should convert Window to use IDL
{
auto gen = generator.fork();
add_interface(gen, "Window"sv, "WindowPrototype"sv, "WindowConstructor"sv, {});
add_interface(gen, "Location"sv, "LocationPrototype"sv, "LocationConstructor"sv, {});
}
// FIXME: Special case WebAssembly. We should convert WASM to use IDL.
@ -289,12 +285,10 @@ static ErrorOr<void> generate_exposed_interface_implementation(StringView class_
}
}
// FIXME: Special case window. We should convert Window and Location to use IDL
// FIXME: Special case window. We should convert Window to use IDL
if (class_name == "Window"sv) {
generator.append(R"~~~(#include <LibWeb/Bindings/WindowConstructor.h>
#include <LibWeb/Bindings/WindowPrototype.h>
#include <LibWeb/Bindings/LocationConstructor.h>
#include <LibWeb/Bindings/LocationPrototype.h>
)~~~");
}
@ -325,11 +319,10 @@ void add_@global_object_snake_name@_exposed_interfaces(JS::Object& global)
add_interface(gen, interface.name, interface.prototype_class, lookup_legacy_constructor(interface));
}
// FIXME: Special case window. We should convert Window and Location to use IDL
// FIXME: Special case window. We should convert Window to use IDL
if (class_name == "Window"sv) {
auto gen = generator.fork();
add_interface(gen, "Window"sv, "WindowPrototype"sv, {});
add_interface(gen, "Location"sv, "LocationPrototype"sv, {});
}
generator.append(R"~~~(