summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidot <david.tuin@gmail.com>2021-07-26 00:44:04 +0200
committerLinus Groh <mail@linusgroh.de>2021-07-26 15:56:15 +0100
commitc5c32ad2747ada20dd45c84d5322d43dfa71cfdd (patch)
treebaa7f56972ee55cabb2cff25496d0dca642db984
parent7a56ca12509fe54faa2295eead995fc2bcb02e7a (diff)
downloadserenity-c5c32ad2747ada20dd45c84d5322d43dfa71cfdd.zip
LibWeb: Make functions and attributes in bindings writable
This allows overwriting of for example EventTarget.prototype.addEventListener as css3test does.
-rw-r--r--Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
index f5067909b7..436bf956be 100644
--- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
+++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
@@ -1307,6 +1307,8 @@ namespace Web::Bindings {
)~~~");
}
+ // FIXME: Currently almost everything gets default_attributes but it should be configurable per attribute.
+ // See the spec links for details
generator.append(R"~~~(
}
@@ -1317,10 +1319,11 @@ namespace Web::Bindings {
void @prototype_class@::initialize(JS::GlobalObject& global_object)
{
[[maybe_unused]] auto& vm = this->vm();
- [[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable | JS::Attribute::Configurable;
+ [[maybe_unused]] u8 default_attributes = JS::Attribute::Enumerable | JS::Attribute::Configurable | JS::Attribute::Writable;
)~~~");
+ // https://heycam.github.io/webidl/#es-attributes
for (auto& attribute : interface.attributes) {
auto attribute_generator = generator.fork();
attribute_generator.set("attribute.name", attribute.name);
@@ -1336,6 +1339,7 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
)~~~");
}
+ // https://heycam.github.io/webidl/#es-constants
for (auto& constant : interface.constants) {
auto constant_generator = generator.fork();
constant_generator.set("constant.name", constant.name);
@@ -1346,6 +1350,7 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
)~~~");
}
+ // https://heycam.github.io/webidl/#es-operations
for (auto& function : interface.functions) {
auto function_generator = generator.fork();
function_generator.set("function.name", function.name);