diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index a47a20d178..4be37611e7 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -3186,7 +3186,21 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@) } )~~~"); } else if (attribute.extended_attributes.contains("Replaceable"sv)) { - attribute_generator.append(R"~~~( + if (interface.name.is_one_of("Window")) { + attribute_generator.append(R"~~~( +JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@) +{ + auto this_value = vm.this_value(); + if (!this_value.is_object() || !is(this_value.as_object())) + return vm.throw_completion(JS::ErrorType::NotAnObjectOfType, "@namespaced_name@"); + auto& window_proxy = static_cast(this_value.as_object()); + TRY(window_proxy.window()->internal_define_own_property("@attribute.name@", JS::PropertyDescriptor { .value = vm.argument(0), .writable = true })); + return JS::js_undefined(); +} +)~~~"); + } else { + + attribute_generator.append(R"~~~( JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@) { auto this_value = vm.this_value(); @@ -3196,6 +3210,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@) return JS::js_undefined(); } )~~~"); + } } else if (auto put_forwards_identifier = attribute.extended_attributes.get("PutForwards"sv); put_forwards_identifier.has_value()) { attribute_generator.set("put_forwards_identifier"sv, *put_forwards_identifier); diff --git a/Tests/LibWeb/Text/expected/window-event-property-setter.txt b/Tests/LibWeb/Text/expected/window-event-property-setter.txt new file mode 100644 index 0000000000..ce01362503 --- /dev/null +++ b/Tests/LibWeb/Text/expected/window-event-property-setter.txt @@ -0,0 +1 @@ +hello diff --git a/Tests/LibWeb/Text/input/window-event-property-setter.html b/Tests/LibWeb/Text/input/window-event-property-setter.html new file mode 100644 index 0000000000..eafca73ccc --- /dev/null +++ b/Tests/LibWeb/Text/input/window-event-property-setter.html @@ -0,0 +1,7 @@ + +