Linus Groh
1c12f5c31d
LibWeb: Make Fetch::Infrastructure::{Request,Response} ref-counted
...
With the addition of the 'fetch params' struct, the single ownership
model we had so far falls apart completely.
Additionally, this works nicely for FilteredResponse's internal response
instead of risking a dangling reference.
Replacing the public constructor with a create() function also found a
few instances of a Request being stack-allocated!
2022-10-05 09:14:49 +01:00
Linus Groh
886ca9c7b6
LibWeb: Add missing Request::policy_container() getter and setter
2022-10-05 09:14:49 +01:00
Linus Groh
16d6c62193
LibWeb: Make Fetch::Infrastructure::Request::set_client() take a pointer
2022-10-05 09:14:49 +01:00
Linus Groh
72a752685f
LibWeb: Add missing link to Fetch::Infrastructure::Response member
2022-10-05 09:14:49 +01:00
Linus Groh
7b50e96434
LibWeb: Add missing links to Fetch::Infrastructure::Request members
2022-10-05 09:14:49 +01:00
Linus Groh
fc9d587e39
LibJS: Make PromiseCapability GC-allocated
...
A struct with three raw pointers to other GC'd types is a pretty big
liability, let's just turn this into a Cell itself.
This comes with the additional benefit of being able to capture it in
a lambda effortlessly, without having to create handles for individual
members.
2022-10-02 23:02:27 +01:00
Linus Groh
c2326ec95a
LibJS: Move PromiseCapability into its own cpp/h file
...
This is not strictly connected to PromiseReaction in any way.
Preparation before doing some actual work on it :^)
2022-10-02 23:02:27 +01:00
Andrew Kaster
4bb6345b2f
LibWeb: Remove unecessary dependence on Window from assorted classes
...
These classes only needed Window to get at its realm. Pass a realm
directly to construct Crypto, Encoding, HRT, IntersectionObserver,
NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL,
and XML classes.
2022-10-01 21:05:32 +01:00
Linus Groh
9fb672e981
LibWeb: Implement '5.4. Request class' from the Fetch API :^)
2022-09-27 14:56:17 +01:00
Linus Groh
afe2563e2b
LibWeb: Make HeaderList ref-counted
...
This is needed to eventually share a header list between a Request or
Response object's internal infra request/response and the object's
exposed Header object.
2022-09-27 14:56:17 +01:00
Linus Groh
2d57d47132
LibWeb: Make Fetch::Infrastructure::Request::m_method default to "GET"
...
ByteBuffer has an inline capacity of 32 bytes, so this isn't fallible
and can be done inline.
2022-09-27 14:56:17 +01:00
Linus Groh
924d7721f0
LibWeb: Stub out Fetch::Infrastructure::Body::fully_read_as_promise()
2022-09-27 14:56:17 +01:00
Linus Groh
a7164f2674
LibWeb: Stub out Fetch::Infrastructure::Body::clone()
2022-09-27 14:56:17 +01:00
Linus Groh
ef5e2eb794
LibWeb: Implement Fetch::Infrastructure::Response::clone()
2022-09-27 14:56:17 +01:00
Linus Groh
dc6fb43d26
LibWeb: Add referrer policy to Fetch::Infrastructure::Request
...
The enum is in its own directory and namespace as there's a standalone
spec for it, that will later also house AOs.
- https://w3c.github.io/webappsec-referrer-policy/
- https://www.w3.org/TR/referrer-policy/
2022-09-27 14:56:17 +01:00
Linus Groh
a602a4c780
LibWeb: Heap-allocate returned Fetch::Infrastructure::{Request,Response}
...
A Request/Response instance should always be heap-allocated and have
clear ownership, so let's also wrap it in a NonnullOwnPtr instead of
putting them on the stack.
2022-09-27 14:56:17 +01:00
Linus Groh
88ee15a497
LibWeb: Mark two Fetch::Infrastructure::Request getters as const
2022-09-27 14:56:17 +01:00
Linus Groh
76ace3629a
LibWeb: Make Fetch::Infrastructure::Body::stream() const
2022-09-22 21:01:13 +01:00
Linus Groh
f98ce156c4
LibWeb: Remove ReadableStreamDummy in favor of ReadableStream
2022-09-22 21:01:13 +01:00
Andreas Kling
010be491a9
LibWeb: Fix e-mail address mishap
2022-09-21 18:42:09 +02:00
Andreas Kling
66f4e2b3b0
LibWeb: Add two more scheme helpers to the Fetch infrastructure
2022-09-21 11:51:18 +02:00
Andreas Kling
9683da4470
LibWeb: Add referrer accessors to Fetch Request
2022-09-20 14:48:07 +02:00
Andreas Kling
497ead37bc
LibWeb: Make DOMException GC-allocated
2022-09-06 00:27:09 +02:00
Andreas Kling
647ac1bdba
LibWeb: Make Blob and File GC-allocated
2022-09-06 00:27:09 +02:00
Linus Groh
042dfc7284
LibWeb: Move extract_mime_type() from XMLHttpRequest to HeaderList
...
Except some minor tweaks, this is a direct copy of Luke's initial
implementation in XMLHttpRequest, now replacing the former.
2022-07-20 18:03:21 +01:00
Linus Groh
b5ab1f6b4a
LibWeb: Implement HeaderList::sort_and_combine()
2022-07-19 00:27:35 +01:00
Linus Groh
bad6ad8861
LibWeb: Implement CaseInsensitiveBytesTraits::equals()
...
Turns out HashTable::contains() doesn't solely use hash() for equality
checks, so the lack of a proper equals() implementation broke the check
in convert_header_names_to_a_sorted_lowercase_set() and caused duplicate
entries in header_names_set.
2022-07-19 00:27:35 +01:00
Linus Groh
2726fc9c73
LibWeb: Move Fetch infra into the Web::Fetch::Infrastructure namespace
...
The Fetch spec unfortunately will cause a name clash between the Request
concept and the Request JS object - both cannot live in the Web::Fetch
namespace, and WrapperGenerator generally assumes `Web::<Name>` for
things living in the `<Name>/` subdirectory, so let's instead move infra
code into its own namespace - it already sits in a (sub-)subdirectory
anyway.
2022-07-19 00:27:35 +01:00
Linus Groh
58fda93ea2
LibWeb: Add Blob to Fetch's Body::SourceType variant
2022-07-18 08:11:25 +01:00
Linus Groh
8da3914bdc
LibWeb: Add definitions from '2.2.6. Responses' in the Fetch spec
2022-07-16 21:05:00 +01:00
Linus Groh
7116a7d2bf
LibWeb: Add definitions from '2.2.5 Requests' in the Fetch spec
2022-07-15 14:15:30 +02:00
Linus Groh
4f02bac39c
LibWeb: Add a couple of missing includes to Fetch's Headers.h
2022-07-15 14:15:30 +02:00
Linus Groh
f507f68d4a
LibWeb: Add definitions from '2.2.4. Bodies' in the Fetch spec
...
...at least the ones that don't require an implementation of the Streams
spec :^)
2022-07-14 00:42:26 +01:00
Linus Groh
1694279dd8
LibWeb: Add definitions from '2.2.3. Statuses' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
dd9bf10151
LibWeb: Add definitions from '2.2.2. Headers' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
9244f1697d
LibWeb: Add definitions from '2.2.1. Methods' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
9d60010b44
LibWeb: Mark Fetch::collect_an_http_quoted_string() [[nodiscard]]
2022-07-14 00:42:26 +01:00
Linus Groh
f42f0cceaa
LibWeb: Make Fetch::collect_an_http_quoted_string()'s 2nd param optional
2022-07-14 00:42:26 +01:00
Linus Groh
fad69fcacd
LibWeb: Move Fetch::collect_an_http_quoted_string() into HTTP.{cpp,h}
...
The Fetch spec is too big to have a generic AbstractOperations.{cpp,h}
file, so let's keep AOs in their section-specific files.
2022-07-14 00:42:26 +01:00
Linus Groh
e3798886ed
LibWeb: Add & use 'HTTP whitespace' from '2.2. HTTP' in the Fetch spec
...
We had two independent definitions of this already, both referring to
the Fetch spec.
2022-07-14 00:42:26 +01:00
Linus Groh
df3e25f1bb
LibWeb: Add & use 'HTTP tab or space' from '2.2. HTTP' in the Fetch spec
2022-07-14 00:42:26 +01:00
Linus Groh
7c2c9b6859
LibWeb: Add definitions from '2.1. URL' in the Fetch spec
2022-07-14 00:42:26 +01:00