mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
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.
This commit is contained in:
parent
643e2dec2c
commit
bf43b0f884
1 changed files with 5 additions and 1 deletions
|
@ -2442,7 +2442,11 @@ void generate_constructor_implementation(IDL::Interface const& interface)
|
||||||
#include <LibWeb/Bindings/@constructor_class@.h>
|
#include <LibWeb/Bindings/@constructor_class@.h>
|
||||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||||
#include <LibWeb/Bindings/@wrapper_class@.h>
|
#include <LibWeb/Bindings/@wrapper_class@.h>
|
||||||
|
#include <LibWeb/Bindings/CSSRuleWrapperFactory.h>
|
||||||
|
#include <LibWeb/Bindings/EventTargetWrapperFactory.h>
|
||||||
|
#include <LibWeb/Bindings/EventWrapperFactory.h>
|
||||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||||
|
#include <LibWeb/Bindings/NodeWrapperFactory.h>
|
||||||
#include <LibWeb/Bindings/WindowObject.h>
|
#include <LibWeb/Bindings/WindowObject.h>
|
||||||
#if __has_include(<LibWeb/Crypto/@name@.h>)
|
#if __has_include(<LibWeb/Crypto/@name@.h>)
|
||||||
# include <LibWeb/Crypto/@name@.h>
|
# include <LibWeb/Crypto/@name@.h>
|
||||||
|
@ -2538,7 +2542,7 @@ JS::Value @constructor_class@::construct(FunctionObject&)
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
if (should_return_empty(impl))
|
if (should_return_empty(impl))
|
||||||
return JS::Value();
|
return JS::Value();
|
||||||
return @wrapper_class@::create(global_object, impl.release_value());
|
return wrap(global_object, *impl.release_value());
|
||||||
)~~~");
|
)~~~");
|
||||||
} else {
|
} else {
|
||||||
// Multiple constructor overloads - can't do that yet.
|
// Multiple constructor overloads - can't do that yet.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue