mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Add a 'FIXME' extended attribute for stubbed IDL attrs and fn's
This allows readonly attributes and functions to have a 'FIXME' extended attribute added to the IDL definition to stub out the function. This makes debugging web compatibility issues on live sites much easier as a FIXME message is logged whenever one of these functions or attributes are called. Support still needs to be extended to non-readonly attributes (and some other special cases), but this should allow us to set a big percentage of the commented out attributes/functions in IDL files to instead use this extended attribute.
This commit is contained in:
parent
a8e3400a2a
commit
7c69b4737b
Notes:
sideshowbarker
2024-07-17 00:53:02 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/7c69b4737b Pull-request: https://github.com/SerenityOS/serenity/pull/24377 Reviewed-by: https://github.com/tcl3
1 changed files with 19 additions and 2 deletions
|
@ -1903,6 +1903,7 @@ static void generate_function(SourceGenerator& generator, IDL::Function const& f
|
|||
auto function_generator = generator.fork();
|
||||
function_generator.set("class_name", class_name);
|
||||
function_generator.set("interface_fully_qualified_name", interface_fully_qualified_name);
|
||||
function_generator.set("function.name", function.name);
|
||||
function_generator.set("function.name:snakecase", make_input_acceptable_cpp(function.name.to_snakecase()));
|
||||
function_generator.set("overload_suffix", function.is_overloaded ? ByteString::number(function.overload_index) : ByteString::empty());
|
||||
|
||||
|
@ -1920,6 +1921,15 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@@overload_suffi
|
|||
[[maybe_unused]] auto& realm = *vm.current_realm();
|
||||
)~~~");
|
||||
|
||||
if (function.extended_attributes.contains("FIXME")) {
|
||||
function_generator.append(R"~~~(
|
||||
dbgln("FIXME: Unimplemented IDL interface '@namespaced_name@.@function.name@'");
|
||||
return JS::js_undefined();
|
||||
}
|
||||
)~~~");
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_static_function == StaticFunction::No) {
|
||||
function_generator.append(R"~~~(
|
||||
auto* impl = TRY(impl_from(vm));
|
||||
|
@ -3244,8 +3254,16 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.getter_callback@)
|
|||
{
|
||||
WebIDL::log_trace(vm, "@class_name@::@attribute.getter_callback@");
|
||||
[[maybe_unused]] auto& realm = *vm.current_realm();
|
||||
auto* impl = TRY(impl_from(vm));
|
||||
[[maybe_unused]] auto* impl = TRY(impl_from(vm));
|
||||
)~~~");
|
||||
if (attribute.extended_attributes.contains("FIXME")) {
|
||||
attribute_generator.append(R"~~~(
|
||||
dbgln("FIXME: Unimplemented IDL interface '@namespaced_name@.@attribute.name@'");
|
||||
return JS::js_undefined();
|
||||
}
|
||||
)~~~");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (attribute.extended_attributes.contains("CEReactions")) {
|
||||
// 1. Push a new element queue onto this object's relevant agent's custom element reactions stack.
|
||||
|
@ -4557,5 +4575,4 @@ namespace Web::Bindings {
|
|||
} // namespace Web::Bindings
|
||||
)~~~");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue