mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +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:
parent
78d6de2ec1
commit
afc055c088
19 changed files with 271 additions and 333 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
*
|
||||
|
@ -2380,7 +2380,6 @@ void generate_prototype_implementation(IDL::Interface const& interface, StringBu
|
|||
#include <LibJS/Runtime/Value.h>
|
||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
#include <LibWeb/Bindings/LocationObject.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
|
|
|
@ -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"~~~(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue