1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

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.
This commit is contained in:
Luke Wilde 2021-09-12 14:59:49 +01:00 committed by Andreas Kling
parent ee5bac0891
commit 678dd2d180
6 changed files with 34 additions and 1 deletions

View file

@ -842,6 +842,11 @@ static void generate_return_statement(SourceGenerator& generator, IDL::Type cons
return JS::js_null();
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"~~~(
@ -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>