summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2021-09-12 14:59:49 +0100
committerAndreas Kling <kling@serenityos.org>2021-09-12 16:07:24 +0200
commit678dd2d18031e8fabf91281af6e0776b269305d0 (patch)
tree68e0c2c52de04105b199bfd6823d5e8c97d14e85 /Meta
parentee5bac08912dc4cbe565bd31636aa8b962b9f727 (diff)
downloadserenity-678dd2d18031e8fabf91281af6e0776b269305d0.zip
LibWeb: Expose the location object via Document.location
Both Window.location and Document.location use the same instance of the Location object. Some sites use it via Window, some via Document.
Diffstat (limited to 'Meta')
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
index 85617c54b3..478a560d55 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
@@ -843,6 +843,11 @@ static void generate_return_statement(SourceGenerator& generator, IDL::Type cons
return retval.callback.cell();
)~~~");
+ } else if (return_type.name == "Location") {
+ // Location is special cased as it is already a JS::Object.
+ scoped_generator.append(R"~~~(
+ return JS::Value(retval);
+)~~~");
} else {
scoped_generator.append(R"~~~(
return wrap(global_object, const_cast<@return_type@&>(*retval));
@@ -1440,6 +1445,7 @@ void generate_prototype_implementation(IDL::Interface const& interface)
#include <LibWeb/Bindings/HTMLTableCaptionElementWrapper.h>
#include <LibWeb/Bindings/HTMLTableSectionElementWrapper.h>
#include <LibWeb/Bindings/ImageDataWrapper.h>
+#include <LibWeb/Bindings/LocationObject.h>
#include <LibWeb/Bindings/NodeWrapperFactory.h>
#include <LibWeb/Bindings/PerformanceTimingWrapper.h>
#include <LibWeb/Bindings/RangeWrapper.h>