From bf43b0f884969f2ef0a40d3489ef22589f98b497 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 4 Oct 2021 12:10:04 +0200 Subject: [PATCH] LibWeb: Make IDL-constructed objects aware of their JS wrapper Having IDL constructors call FooWrapper::create(impl) directly was creating a wrapper directly without telling the impl object about the wrapper. This meant that we had wrapped C++ objects with a null wrapper() pointer. --- Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp index 9436cd6119..4f9fb2615b 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp @@ -2442,7 +2442,11 @@ void generate_constructor_implementation(IDL::Interface const& interface) #include #include #include +#include +#include +#include #include +#include #include #if __has_include() # include @@ -2538,7 +2542,7 @@ JS::Value @constructor_class@::construct(FunctionObject&) generator.append(R"~~~( if (should_return_empty(impl)) return JS::Value(); - return @wrapper_class@::create(global_object, impl.release_value()); + return wrap(global_object, *impl.release_value()); )~~~"); } else { // Multiple constructor overloads - can't do that yet.