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

LibWeb: Implement the fetch() method :^)

With so much infrastructure implemented, we can finally add the last
piece of this puzzle - the fetch() method itself!

This contains a few hundred lines of generated code as handling the
RequestInfo and RequestInfo parameter types manually is not feasible,
but we can't use the IDL definition as the Window object is handwritten
code at the moment.
It's neatly tucked away in Bindings/ and will be removed eventually.
This commit is contained in:
Linus Groh 2022-10-23 22:20:25 +01:00
parent c8d121fa32
commit 1de1d6423b
6 changed files with 591 additions and 0 deletions

View file

@ -17,6 +17,7 @@
#include <LibTextCodec/Decoder.h>
#include <LibWeb/Bindings/CSSNamespace.h>
#include <LibWeb/Bindings/ExceptionOrUtils.h>
#include <LibWeb/Bindings/FetchMethod.h>
#include <LibWeb/Bindings/LocationObject.h>
#include <LibWeb/Bindings/Replaceable.h>
#include <LibWeb/Bindings/WindowExposedInterfaces.h>
@ -764,6 +765,8 @@ void Window::initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>)
define_native_function(realm, "postMessage", post_message, 1, attr);
define_native_function(realm, "fetch", Bindings::fetch, 1, attr);
// FIXME: These properties should be [Replaceable] according to the spec, but [Writable+Configurable] is the closest we have.
define_native_accessor(realm, "scrollX", scroll_x_getter, {}, attr);
define_native_accessor(realm, "pageXOffset", scroll_x_getter, {}, attr);