This allows Actions that change based on some state to update their
associated buttons' text and tooltips to match their new text. The
play/pause button in SoundPlayer (and VideoPlayer if it's merged)
will now change tooltips when the playback changes state, rather than
always displaying "Play (Space)".
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 implements the following operations from section 4 of the Fetch
spec (https://fetch.spec.whatwg.org/#fetching):
- Fetch
- Main fetch
- Fetch response handover
- Scheme fetch
- HTTP fetch
- HTTP-redirect fetch
- HTTP-network-or-cache fetch (without caching)
It does *not* implement:
- HTTP-network fetch
- CORS-preflight fetch
Instead, we let ResourceLoader handle the actual networking for now,
which isn't ideal, but certainly enough to get enough functionality up
and running for most websites to not complain.
There will be a lot of different cases where we'll return an error
response, and having a customized Promise rejection message seems quite
useful.
Note that this has to be distinct from the existing 'status message',
which is required to be empty in those cases.
The header-specific ABNF rules are completely ignored for now, but we
can at least extract a single header value, which at least works for
simple cases like `Location`-based redirects.
This is the way.
On a more serious note, there's no reason to keep adding ref-counted
classes to LibWeb now that the majority of classes is GC'd - it only
adds the risk of discovering some cycle down the line, and forces us to
use handles as we can't visit().
The combination of template + auto&& parameter + constexpr if statements
allowed one caller to pass in a GlobalObject, without the compiler
complaining.
For whatever reason, web pages sometimes add and/or remove a completely
empty style sheet. When this happens, we don't need to invalidate the
document's style, since the outcome will be the same as before.
HTML template elements don't affect rendering, so invalidating the
entire document's layout after poking into a <template> was a huge waste
of work on template-heavy pages.
There's no need to force a synchronous relayout after the viewport has
been resized. By making it lazy, we might be able to coalesce it with
other layout work.
Like for attribute changes, we now only invalidate the insertion parent
and all of its descendants. Again, this is very aggressive, but also
way less than doing the entire document.
Once we implement the CSS :has() selector, we'll need to become more
sophisticated about invalidation.