Age | Commit message (Collapse) | Author |
|
|
|
Again, the const-ness only really involves Heap-internal metadata, so
the callers shouldn't care about mutations here.
|
|
The majority of error strings are StringView literals, and it seems
silly to require heap-allocating strings for these.
This idea is stolen from a recent change in fd1fbad :^)
|
|
|
|
|
|
This matches the spec's "parse a MIME type".
|
|
|
|
Since BodyInit and Headers are tightly coupled to both Request and
Response, I chose to do all of them at once instead of introducing a
bunch of temporary conversion glue code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This includes an Error::create overload to create an Error from a UTF-8
StringView. If creating a String from that view fails, the factory will
return an OOM InternalError instead. VM::throw_completion can also make
use of this overload via its perfect forwarding.
|
|
This patch adds the WebIDL::Promise type explicitly defined in the
WebIDL spec to be a PromiseCapability Record from ecma262.
|
|
This is a normative change in the Fetch spec.
See: https://github.com/whatwg/fetch/commit/e4d3480
This also implements the changes to the 'sort and combine' algorithm,
which now treats "set-cookie" headers differently, and is exposed to JS
via the Headers' iterator.
Passes all 21 WPT tests :^)
http://wpt.live/fetch/api/headers/header-setcookie.any.html
|
|
We can't keep a span (ReadonlyBytes) to a move()'d ByteBuffer
in the header_names_seen HashTable - copy the original name span instead
which works the same thanks to CaseInsensitiveBytesTraits.
This would sporadically fail the contains() check due to garbage data,
later leading to a VERIFY() crash in the OrderedHashTable append loop.
|
|
The main things missing is the CORS preflight cache and making
extract_header_list_values properly parse, validate and return split
values for the Access-Control headers.
|
|
Previously, parsing failures and the header not existing made
extract_header_list_values return an empty Optional, making it
impossible to differentiate between the two.
Required for implementing CORS-preflight, where parsing failures for
the headers makes it fail, but not having them doesn't make it fail in
all cases.
|
|
Using LoadRequest::create_for_url_on_page will unconditionally add
cookies as long as there's a page available. However, it is up to
http_network_or_cache_fetch to determine if cookies should be added to
the request.
This was noticed when implementing CORS-preflight requests, where we
sent cookies in OPTIONS requests.
|
|
These are missing in most Fetch headers, and clangd is (rightfully) very
loud about it on a few of these.
|
|
For example, consider cases where we want to propagate errors only in
specific instances:
auto result = read_data(); // something like ErrorOr<ByteBuffer>
if (result.is_error() && result.error().code() != EINTR)
continue;
auto bytes = TRY(result);
The TRY invocation will currently copy the byte buffer when the
expression (in this case, just a local variable) is stored into
_temporary_result.
This patch binds the expression to a reference to prevent such copies.
In less trival invocations (such as TRY(some_function()), this will
incur only temporary lifetime extensions, i.e. no functional change.
|
|
First, this adds an overload of PrimitiveString::create for StringView.
This overload will throw an OOM completion if creating a String fails.
This is not only a bit more convenient, but it also ensures at compile
time that all PrimitiveString::create(string_view) invocations will be
handled as String and OOM-aware.
Next, this wraps all invocations to PrimitiveString::create(string_view)
with MUST_OR_THROW_OOM.
A small PrimitiveString::create(DeprecatedFlyString) overload also had
to be added to disambiguate between the StringView and DeprecatedString
overloads.
|
|
Callers that are already in a fallible context will now TRY to allocate
cells. Callers in infallible contexts get a FIXME.
|
|
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
|
|
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
|
|
|
|
We have to provide the Web::Page* in order for cookies to get saved.
|
|
If USING_AK_GLOBALLY is not defined, the name IsLvalueReference might
not be available in the global namespace. Follow the pattern established
in LibTest to fully qualify AK types in macros to avoid this problem.
|
|
This will silently make a copy. Rather than masking this behavior, let's
explicitly disallow it.
|
|
This needs to happen before prototype/constructor intitialization can be
made lazy. Otherwise, GC could run during the C++ constructor and try to
collect the object currently being created.
|
|
Currently, for each exposed interface, we generate one massive function
to create every Web constructor and prototype. In an effort to lazily
create these instead, this first step is to extract the creation of each
of these into its own method.
First, this generates a forwarding header for all IDL types. This is to
allow callers to remain unchanged without forcing them to include the
(very heavy) generated IDL headers. This header is included by LibWeb's
forwarding header.
Next, this defines a base template method on Web::Bindings::Intrinsics
to create a prototype/constructor pair. Specializations of this template
are now generated in a new .cpp file, IntrinsicDefinitions.cpp. The base
Intrinsics class is updated to use this new method, and will continue to
cache the result.
Last, some WebAssembly classes are updated to use this new mechanism.
They were using some ad hoc cache keys that are now in line with the
generated specializations.
That one massive function is still used to invoke these specializations,
so they are not lazy as of this commit.
|
|
This makes construction of Utf16String fallible in OOM conditions. The
immediate impact is that PrimitiveString must then be fallible as well,
as it may either transcode UTF-8 to UTF-16, or create a UTF-16 string
from ropes.
There are a couple of places where it is very non-trivial to propagate
the error further. A FIXME has been added to those locations.
|
|
Move the macro to LibJS and change it to return a throw completion
instead of a WebIDL exception. This will let us use this macro within
LibJS to handle OOM conditions.
|
|
|
|
|
|
|
|
|
|
This is an editorial change in the Fetch spec.
See: https://github.com/whatwg/fetch/commit/e8b67b0
|
|
This is an editorial change in the Fetch spec.
See: https://github.com/whatwg/fetch/commit/f435978
|
|
This is a change in the Fetch spec.
See: https://github.com/whatwg/fetch/commit/9004f4e
|
|
This is a change in the Fetch spec.
See: https://github.com/whatwg/fetch/commit/223ca89
|
|
This is a change in the Fetch spec.
See: https://github.com/whatwg/fetch/commit/a04d096
|
|
This is a change in the Fetch spec.
See:
- https://github.com/whatwg/fetch/commit/92e6c91
- https://github.com/whatwg/xhr/commit/494431a
|
|
This is an editorial change in the Fetch spec.
See: https://github.com/whatwg/fetch/commit/b482186
|
|
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
|
|
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.
One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
|
|
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
|