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

LibWeb: Remove unecessary dependence on Window from Fetch, XHR, FileAPI

These classes only needed Window to get at its realm. Pass a realm
directly to construct Fetch, XMLHttpRequest and FileAPI classes.
This commit is contained in:
Andrew Kaster 2022-09-25 18:08:29 -06:00 committed by Linus Groh
parent 6a10352712
commit 4878a18ee7
17 changed files with 144 additions and 169 deletions

View file

@ -33,9 +33,9 @@ class Blob : public Bindings::PlatformObject {
public:
virtual ~Blob() override;
static JS::NonnullGCPtr<Blob> create(HTML::Window&, ByteBuffer, String type);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> create(HTML::Window&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> create_with_global_object(HTML::Window&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
static JS::NonnullGCPtr<Blob> create(JS::Realm&, ByteBuffer, String type);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> create(JS::Realm&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Blob>> construct_impl(JS::Realm&, Optional<Vector<BlobPart>> const& blob_parts = {}, Optional<BlobPropertyBag> const& options = {});
// https://w3c.github.io/FileAPI/#dfn-size
u64 size() const { return m_byte_buffer.size(); }
@ -50,11 +50,11 @@ public:
ReadonlyBytes bytes() const { return m_byte_buffer.bytes(); }
protected:
Blob(HTML::Window&, ByteBuffer, String type);
Blob(HTML::Window&, ByteBuffer);
Blob(JS::Realm&, ByteBuffer, String type);
Blob(JS::Realm&, ByteBuffer);
private:
explicit Blob(HTML::Window&);
explicit Blob(JS::Realm&);
ByteBuffer m_byte_buffer {};
String m_type {};