Commit graph

1046 commits

Author SHA1 Message Date
Kenneth Myhra e776171d8f LibWeb: Allow prototype.{entries keys,value} to propagate errors
This allows the prototype.{entries keys,value} native functions
generated by the BindingsGenerator to propagate errors if needed.
2023-02-22 09:55:33 +01:00
Kenneth Myhra 3689d58c64 LibWeb: Allow EventListener/NodeFilter path to propagate errors
This allows the EventListener/NodeFilter path of the BindingsGenerator
to propagate errors if needed.
2023-02-22 09:55:33 +01:00
Andreas Kling f11899f885 LibWeb+LibIDL: Fix (or paper over) various const-correctness issues
There's definitely stuff to iterate on here, but this takes care of
making the libraries compile with stricter RP and NNRP.
2023-02-21 00:54:04 +01:00
nipos f700d553ab LibCore: Add support for NetBSD in anon_create 2023-02-20 18:46:51 +01:00
Sam Atkins 2db168acc1 LibTextCodec+Everywhere: Port Decoders to new Strings 2023-02-19 17:15:47 +01:00
Sam Atkins f2a9426885 LibTextCodec+Everywhere: Return Optional<Decoder&> from decoder_for() 2023-02-19 17:15:47 +01:00
Sam Atkins f0b72b819e LibWeb: Make property/media-feature name matching ASCII case-insensitive
https://www.w3.org/TR/css-conditional-3/#dom-css-supports specifically
asks for this when calling `CSS::property_id_from_string()`, but in
general, CSS property and media-feature names can only contain ASCII.
2023-02-19 00:46:47 +01:00
Lucas CHOLLET 856d0202f2 LibGfx: Rename JPGLoader to JPEGLoader
The patch also contains modifications on several classes, functions or
files that are related to the `JPGLoader`.

Renaming include:
 - JPGLoader{.h, .cpp}
 - JPGImageDecoderPlugin
 - JPGLoadingContext
 - JPG_DEBUG
 - decode_jpg
 - FuzzJPGLoader.cpp
 - Few string literals or texts
2023-02-18 23:56:24 +01:00
Luke Wilde 3275d659bf LibWeb: Convert FormData to String and Vector storage
This makes use of the new [UseNewAKString] extended attribute. Using
Vector storage will make it easier to make this interface into an IDL
iterable. It seems the reason it didn't use Vector originally was due
to awkward DeprecatedString -> String conversions.
2023-02-18 01:23:36 +01:00
Luke Wilde c0f22065ab LibWeb: Add an extended attribute that makes interfaces use AK::String
Adding the [UseNewAKString] extended attribute to an interface will
cause all IDL string types to use String instead of DeprecatedString.
This is done on an per interface level instead of per type/parameter
because:

- It's much simpler to implement, as the generators can already access
  the interface's extended attributes. Doing it per type/parameter
  would mean parsing and piping extended attributes for each type that
  doesn't already take extended attributes, such as unions.

- Allows more incremental adoption of AK::String. For example, adding
  [UseNewAKString] to BodyInit would require refactoring Request,
  Response and XMLHttpRequest to AK::String in one swoop. Doing it on
  the interface allows you to convert just XHR and its dependencies at
  once, for example.

- Simple string return types (i.e. not parameterised or not in a union)
  already accept any of the string types JS::PrimitiveString::create
  accepts. For example, you can add [UseNewAKString] to DOMStringMap to
  convert Element attributes to AK::String and still return AK::String
  from get_attribute, without adding [UseNewAKString] to Element.

- Adding [UseNewAKString] to one function typically means adding it to
  a bunch of other functions, if not the rest of them. For example,
  adding [UseNewAKString] to the parameters FormData.append would
  either mean converting AK::String to AK::DeprecatedString or storing
  the AK::String as-is, making the other functions of FormData have to
  convert back from AK::String or also support AK::String.
2023-02-18 01:23:36 +01:00
Timothy Flynn 88814acbd3 LibJS+Everywhere: Convert JS::Error to String
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.
2023-02-17 09:14:23 -05:00
Timothy Flynn 527edb55ad LibWeb: Convert usages of Value::TDSWOSE to Value::TSWOSE 2023-02-16 14:32:22 +01:00
Timothy Flynn b245300ba1 LibJS+Everywhere: Deprecate Value::to_string_without_side_effects 2023-02-16 14:32:22 +01:00
Sam Atkins d6075ef5b5 LibTextCodec+Everywhere: Make TextCodec::decoder_for() take a StringView
We don't need a full String/DeprecatedString inside this function, so we
might as well not force users to create one.
2023-02-15 12:48:26 -05:00
Ali Mohammad Pur 617d112780 Meta: Add a Shell --posix parser fuzzer 2023-02-13 23:00:15 +03:30
Tim Schumacher 43f98ac6e1 Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
Tim Schumacher 874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher 606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Kenneth Myhra d5b5b94a35 LibWeb: Introduce the FormData interface from the XHR specification 2023-02-12 00:18:09 +00:00
Timothy Flynn 604d5f5bca AK+Everywhere: Do not implicitly copy variables in TRY macros
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.
2023-02-10 09:08:52 +00:00
Timothy Flynn c3abb1396c LibJS+LibWeb: Convert string view PrimitiveString instances to String
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.
2023-02-09 17:13:33 +00:00
MacDue 63b11030f0 Everywhere: Use ReadonlySpan<T> instead of Span<T const> 2023-02-08 19:15:45 +00:00
Timothy Flynn 8670526f2a LibJS+LibLocale: Propagate OOM from CLDR RelativeTime Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn 340434ce09 LibLocale: Propagate OOM from CLDR DateTime Vector and String operations 2023-02-08 18:32:37 +00:00
Timothy Flynn 89da8de4ca LibJS+LibLocale: Propagate OOM from CLDR NumberFormat Vector operations 2023-02-08 18:32:37 +00:00
Tim Schumacher 220fbcaa7e AK: Remove the fallible constructor from FixedMemoryStream 2023-02-08 17:44:32 +00:00
Karol Kosek 22a99e39d8 Lagom/ConfigureComponents: Run cmake command last
Previously the tool was removing the Root directory after configuring
cmake which was breaking the build, as some cmake rules put some
necessary files there.

Moving the cmake command to be the last one makes it regenerate those
files automatically. :^)
2023-02-04 15:53:07 -07:00
MacDue 0c313c586b Meta: Register CanvasPattern as a platform object 2023-02-03 20:36:21 +01:00
Andrew Kaster 8f70e365f0 Meta+CI: Disable Ladybird for fuzzer, compiler explorer and Android
And move it after the declaration of headless-browser, since WebDriver
depends on headless-browser.
2023-02-02 05:35:44 -07:00
Timothy Flynn 38b0b32bb4 Meta: Set LD_LIBRARY_PATH to Build/lagom for Lagom test targets
Some tests, such as those under LibGL, try to load shared libraries at
runtime which are stored in Build/lagom. Because all tests' working
directory is that of their CMakeLists.txt file, they fail to find those
shared libraries at runtime.

Set LD_LIBRARY_PATH to Build/lagom so the tests may find the shared
libraries. This fixes, for example, both of these commands:

    ./Meta/serenity.sh test lagom TestAPI
    ./Meta/serenity.sh run lagom TestAPI
2023-02-01 12:28:02 -05:00
Timothy Flynn 1bbd889f67 Meta: Set the Lagom test working directory for run-lagom-target
When we call add_test() from each test's CMakeLists.txt, we specify the
working directory to be that of the CMakeList.txt file itself. Create a
property to store that directory and reference it when run-lagom-target
is invoked by serenity.sh.

Note that for non-test Lagom targets which do not set this property, the
working directory will be Build/lagom (because the property will be the
empty string, which CMake resolves relative to the current build path).
2023-02-01 12:28:02 -05:00
Nico Weber 0a97206a25 Meta: Derust fuzzer build docs
The document wasn't updated in 9c2211f246.
2023-02-01 14:44:58 +00:00
Nico Weber 9bb469f324 Meta: Build and run Tests/LibGfx in lagom builds
They can be run using

    Meta/serenity.sh test lagom TestFontHandling

which will build _all_ test binaries and then run TestFontHandling.

There's also

    Meta/serenity.sh run lagom TestFontHandling

which will build just TestFontHandling and run it, but currently
in a way that it doesn't pass.

Finally, manually doing

    Meta/serenity.sh build lagom TestFontHandling

followed by

    (cd Tests/LibGfx; ../../Build/lagom/Tests/LibGfx/TestFontHandling)

will build and then run just that one test in a way that makes the test
pass.
2023-02-01 08:56:56 -05:00
Tim Schumacher 093cf428a3 AK: Move memory streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher 8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Timothy Flynn b75b7f0c0d LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate
Callers that are already in a fallible context will now TRY to allocate
cells. Callers in infallible contexts get a FIXME.
2023-01-29 00:02:45 +00:00
Timothy Flynn 2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
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.
2023-01-29 00:02:45 +00:00
Linus Groh ee0297d9ec LibAudio: Remove try_ prefix from fallible LoaderPlugin methods 2023-01-28 22:41:36 +01:00
Nico Weber 721b280849 LibGfx: Move ICCProfile.{h,cpp} to ICC/Profile.{h,cpp} 2023-01-28 00:27:07 +00:00
Linus Groh 6e7459322d AK: Remove StringBuilder::build() in favor of to_deprecated_string()
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.
2023-01-27 20:38:49 +00:00
Timothy Flynn 5e29e04122 LibJS+LibLocale: Propagate errors from find_regional_values_for_locale
This had quite the footprint.
2023-01-27 18:00:17 +00:00
Timothy Flynn b2097f4059 LibJS+LibLocale: Port Intl.DateTimeFormat to String 2023-01-27 18:00:17 +00:00
Timothy Flynn 9743445e44 Meta: Allow running Lagom tests with "serenity.sh run lagom <target>"
After 5ac57f9, we could no longer run "serenity.sh run lagom TestString"
because the TestString binary now lives in a subdirectory under
Build/lagom. Thus the existing method of running "$BUILD_DIR/TestString"
could not work.

This adds a "run-lagom-target" custom target to Lagom, to run a command
and pass arguments to that invocation. It turns out there really isn't a
"pretty" way of doing this with CMake or Ninja. But we can pass these as
environment variables for CMake to interpret. We just must be careful to
massage arguments into a CMake list.
2023-01-27 08:14:24 -05:00
Sam Atkins ad9b2043dd CodeGenerators: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-26 09:57:14 -05:00
Tim Schumacher 982ebbc304 LibWasm: Port the parser to Core::Stream 2023-01-25 17:10:05 +03:30
MacDue 2be4142138 Meta: Register CanvasGradient as a platform object 2023-01-22 18:15:52 +01:00
Timothy Flynn 20536897e4 LibJS+LibLocale: Port remaining locale APIs to String 2023-01-22 01:03:13 +00:00
Timothy Flynn f1de4f8872 Everywhere: Convert known short-strings to the infallible String factory
For now, this is limited to strings that are 3 bytes or less. We can use
7 bytes on 64-bit platforms, but we do not yet assume 64-bit for Lagom
hosts (e.g. wasm).
2023-01-20 14:24:12 -05:00