mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
53
Libraries/LibWeb/Fetch/Body.h
Normal file
53
Libraries/LibWeb/Fetch/Body.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::Fetch {
|
||||
|
||||
enum class PackageDataType {
|
||||
ArrayBuffer,
|
||||
Blob,
|
||||
Uint8Array,
|
||||
FormData,
|
||||
JSON,
|
||||
Text,
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#body-mixin
|
||||
class BodyMixin {
|
||||
public:
|
||||
virtual ~BodyMixin();
|
||||
|
||||
virtual Optional<MimeSniff::MimeType> mime_type_impl() const = 0;
|
||||
virtual JS::GCPtr<Infrastructure::Body> body_impl() = 0;
|
||||
virtual JS::GCPtr<Infrastructure::Body const> body_impl() const = 0;
|
||||
virtual Bindings::PlatformObject& as_platform_object() = 0;
|
||||
virtual Bindings::PlatformObject const& as_platform_object() const = 0;
|
||||
|
||||
[[nodiscard]] bool is_unusable() const;
|
||||
[[nodiscard]] JS::GCPtr<Streams::ReadableStream> body() const;
|
||||
[[nodiscard]] bool body_used() const;
|
||||
|
||||
// JS API functions
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> array_buffer() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> blob() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> bytes() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> form_data() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> json() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> text() const;
|
||||
};
|
||||
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::Value> package_data(JS::Realm&, ByteBuffer, PackageDataType, Optional<MimeSniff::MimeType> const&);
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> consume_body(JS::Realm&, BodyMixin const&, PackageDataType);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue