mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-03 14:50:18 +00:00
LibWeb/Bindings: Define constructor properties in the correct order
This commit is contained in:
parent
3261f873c5
commit
627b7dd936
Notes:
github-actions[bot]
2025-01-11 01:44:32 +00:00
Author: https://github.com/shannonbooth
Commit: 627b7dd936
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3222
Reviewed-by: https://github.com/tcl3 ✅
8 changed files with 56 additions and 9 deletions
|
@ -4,7 +4,7 @@
|
|||
* Copyright (c) 2021-2023, Luke Wilde <lukew@serenityos.org>
|
||||
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
* Copyright (c) 2023-2024, Kenneth Myhra <kennethmyhra@serenityos.org>
|
||||
* Copyright (c) 2023-2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2023-2025, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2023-2024, Matthew Olsson <mattco@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -4753,8 +4753,9 @@ void @constructor_class@::initialize(JS::Realm& realm)
|
|||
}
|
||||
|
||||
generator.append(R"~~~(
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<@prototype_class@>(realm, "@namespaced_name@"_fly_string), 0);
|
||||
define_direct_property(vm.names.length, JS::Value(@constructor.length@), JS::Attribute::Configurable);
|
||||
define_direct_property(vm.names.name, JS::PrimitiveString::create(vm, "@namespaced_name@"_string), JS::Attribute::Configurable);
|
||||
define_direct_property(vm.names.prototype, &ensure_web_prototype<@prototype_class@>(realm, "@namespaced_name@"_fly_string), 0);
|
||||
|
||||
)~~~");
|
||||
|
||||
|
|
|
@ -152,7 +152,6 @@ void Intrinsics::create_web_prototype_and_constructor<@prototype_class@>(JS::Rea
|
|||
m_constructors.set("@interface_name@"_fly_string, constructor);
|
||||
|
||||
prototype->define_direct_property(vm.names.constructor, constructor.ptr(), JS::Attribute::Writable | JS::Attribute::Configurable);
|
||||
constructor->define_direct_property(vm.names.name, JS::PrimitiveString::create(vm, "@interface_name@"_string), JS::Attribute::Configurable);
|
||||
)~~~");
|
||||
|
||||
if (legacy_constructor.has_value()) {
|
||||
|
@ -160,9 +159,7 @@ void Intrinsics::create_web_prototype_and_constructor<@prototype_class@>(JS::Rea
|
|||
gen.set("legacy_constructor_class", legacy_constructor->constructor_class);
|
||||
gen.append(R"~~~(
|
||||
auto legacy_constructor = realm.create<@legacy_constructor_class@>(realm);
|
||||
m_constructors.set("@legacy_interface_name@"_fly_string, legacy_constructor);
|
||||
|
||||
legacy_constructor->define_direct_property(vm.names.name, JS::PrimitiveString::create(vm, "@legacy_interface_name@"_string), JS::Attribute::Configurable);)~~~");
|
||||
m_constructors.set("@legacy_interface_name@"_fly_string, legacy_constructor);)~~~");
|
||||
}
|
||||
|
||||
gen.append(R"~~~(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue