This commit adds support for using the standard library implementation
of <stacktrace> if libbacktrace is not found. This can also be
explicitly enabled through ENABLE_STD_STACKTRACE for platforms that have
libbacktrace available.
Co-Authored-By: Andrew Kaster <andrew@ladybird.org>
There were a couple of issues here. First, the IterableContainerOf
concept was testing if dereferencing an iterator of ContainerType<T>
returns a value of type T. However, it should return a T&.
Second, the constructor was trying to move values out of a constant
reference to the container. We now accept both lvalue and rvalue
containers.
Before, adding an overflow'n `Checked<T>` to another `Checked<T>` would
cause a verification faliure when instead it should propogate m_overflow
and allow the user to handle the overflow.
This is intended to be used by the <input> element 'week' type state
and convert that to milliseconds from the Unix epoch (ignoring leap
seconds).
I am certain there is a much better way of writing this that does
not need a loop, but I am less convinced about writing that without
running into some edge case I didn't consider.
This removes the use of StringBuilder::OutputType (which was ByteString,
and only used by the JSON classes). And it removes the StringBuilder
template parameter from the serialization methods; this was only ever
used with StringBuilder, so a template is pretty overkill here.
To aid with debugging web page issues in Ladybird without needing to
implement a fully fledged inspector, we can implement the Firefox
DevTools protocol and use their DevTools. The protocol is described
here:
https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html
This commit contains just enough to connect to Ladybird from a DevTools
client.
We have mutable accessors on the JsonValue class already. This will be
needed for interaction with Firefox's DevTools, where we will want to
mutate the serialized DOM tree we receive from WebContent.
These are copied and modified from ByteString, with the addition of a
Case parameter so that we can construct them in lowercase instead of
having to them make a copy.
Useful when you need to check for more than one code point, some of
which are multiple bytes. (In which case StringView::contains() will
return wrong results.)
We currently have a fair amount of code of the form:
if (is<Child>(parent)) {
auto& child = static_cast<Child&>(parent);
if (child.foo()) {
}
}
This new cast allows us to instead write code of the form:
if (auto* child = as_if<Child>(parent); child && child->foo()) {
}
N.B. The name "as_if" was chosen because we are considering renaming
verify_cast to "as".
Co-authored-by: Tim Ledbetter <tim.ledbetter@ladybird.org>
This separates the StringBuilder constructor into 2 constructors. This
essentially allows forming code of the following pattern:
StringBuilder foo() { return {}; }
Otherwise, we would get the following compiler error:
chosen constructor is explicit in copy-initialization
Due to the explicitness of the StringBuilder constructor.
This is required for an upcoming update to ICU 76, where we use our
StringBuilder in templated ICU code.
Functions in AK/GenericShorthands used pass-by-value which results in
copying values when calling those functions. This could be expensive
for complex types. To optimize performance, we switch the functions to
use forwarding references.
if (size <= 1)
return;
This means that size is at the very minimum 2,
and pivot_point at the very minimum equals 1 as size / 2;
The condition if (pivot_point) can never be false.
Done by forward declaring the required functions and defining the needed
constants. The defines shouldn't collide as they are from memoryapi.h.
This is done to avoid including windows.h.
Previously, it ignored 'start', sorting from the array's
beginning. This caused unintended changes and slower
performance. Fix ensures sorting stays within 'start'
and 'end' indices only.