Commit Graph

1073 Commits

Author SHA1 Message Date
nipos
d6fd97e8fb Meta: Link to libnsl and libsocket on Solaris in Lagom CMakeLists 2023-03-04 21:34:54 -07:00
Timothy Flynn
03f32bdf86 LibUnicode: Validate that all emoji images in /res/emoji actually exist
This will raise a compile error if an emoji image was neglected to be
added to e.g. emoji-serenity.txt, or if the code points are not correct.
2023-03-03 17:09:58 +00:00
Linus Groh
f561940e54 LibWeb: Fix duplicate enum-to-string conversion in generated code
This regressed in e3a9ed0.
2023-03-03 09:25:34 +00:00
Kenneth Myhra
c0559e8a10 LibWeb: Handle optional return values for getters returning new String 2023-03-01 22:44:20 +00:00
Kenneth Myhra
98705ecf71 LibWeb: Add new String support for parameters with empty string defaults
This adds new string support for parameters with an optional default
value of empty string ("").
2023-03-01 22:44:20 +00:00
Timothy Flynn
fd1fbad1d2 LibGfx+LibUnicode: Support specifying the path to search for emoji
Similar to the FontDatabase, this will be needed for Ladybird to find
emoji images. We now generate just the file name of emoji image in
LibUnicode, and look for that file in the specified path (defaulting to
/res/emoji) at runtime.
2023-03-01 14:54:16 +00:00
Linus Groh
51c3967516 Everywhere: Use '_{short_,}string' literals more
This mostly updates code what was written before but merged after these
were added.
2023-02-28 15:15:36 +00:00
Sam Atkins
c06f4ac6f5 AK+Everywhere: Make GenericLexer::ignore_until() stop before the value
`consume_until(foo)` stops before foo, and so does
`ignore_until(Predicate)`, so let's make the other `ignore_until()`
overloads consistent with that so they're less confusing.
2023-02-28 12:55:10 +00:00
Ali Mohammad Pur
db886fe18b Userland+AK: Stop using getopt() for ArgsParser
This commit moves the implementation of getopt into AK, and converts its
API to understand and use StringView instead of char*.
Everything else is caught in the crossfire of making
Option::accept_value() take a StringView instead of a char const*.

With this, we must now pass a Span<StringView> to ArgsParser::parse(),
applications using LibMain are unaffected, but anything not using that
or taking its own argc/argv has to construct a Vector<StringView> for
this method.
2023-02-28 15:52:24 +03:30
Luke Wilde
e3a9ed0c26 LibWeb: Make [UseNewAKString] work for enums and stringifiers 2023-02-27 20:55:09 +01:00
Andrew Kaster
ce500ed170 Lagom: Look for clang the same way serenity.sh does in BuildFuzzers.sh
Also note that Xcode does not ship libfuzzer and is not usable for
a fuzzer build.
2023-02-26 08:11:08 +00:00
Ali Mohammad Pur
6b50f23242 LibWasm+LibWeb: Sneak a JS::Completion into Wasm::Result
Imported functions in Wasm may throw JS exceptions, and we need to
preserve these exceptions so we can pass them to the calling JS code.

This also adds a `assert_wasm_result()` API to Result for cases where
only Wasm traps or values are expected (e.g. internal uses) to avoid
making LibWasm (pointlessly) handle JS exceptions that will never show
up in reality.
2023-02-26 10:54:23 +03:30
Kenneth Myhra
2facb0e8ed BindingsGenerator: Use JS::Value::to_string() when new String
Make sure to use JS::Value::to_string() when the IDL interface is marked
with the extended attribute UseNewAKString.
2023-02-26 00:27:22 +01:00
Kenneth Myhra
99f094905e BindingsGenerator: Conditionally check dictionary member is string
This adds the condition member.type->is_string() to the if statement, so
that we now conditionally check the dictionary member is a new string
and associated with an optional constructor parameter.
2023-02-26 00:27:22 +01:00
Linus Groh
09d40bfbb2 Everywhere: Use _{short_,}string to create Strings from literals 2023-02-25 20:51:49 +01:00
kleines Filmröllchen
956450df00 Meta: Document how to manipulate CMake caches for the fuzzing build 2023-02-25 19:39:04 +01:00
kleines Filmröllchen
5ec5c68ed4 Meta: Allow disabling LibWeb fuzzers
The LibWeb fuzzer build is really slow, so for local builds it is useful
to disable it when you're not interested in running that fuzzer.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2023-02-25 19:39:04 +01:00
Nico Weber
41980675f2 Lagom: Build file in lagom builds 2023-02-25 15:00:23 +01:00
Nico Weber
b07e9d4c8a Lagom: Build LibELF on arm64
This seems to build fine now on Arm Macs.
2023-02-25 15:00:23 +01:00
MacDue
727218ff4a LibTimeZone: Propagate try_append() errors while building timezone data 2023-02-24 22:18:25 +01:00
MacDue
01fa3bb788 LibUnicode: Propagate try_append() errors when building emoji data 2023-02-24 22:18:25 +01:00
Timothy Flynn
8c38d46c1a LibUnicode: Generate the path to emoji images alongside emoji data
This will provide for quicker emoji lookups, rather than having to
discover and allocate these paths at runtime before we find out if they
even exist.
2023-02-24 19:48:47 +01:00
Andrew Kaster
1b24fa5829 CI+Lagom: Use the same options for running test-wasm in ctest and CI
Make sure that we set SERENITY_SOURCE_DIR in ctest, and make sure to
pass the test root to the CI job.

More overhaul of test-js 'test root' finding is needed however.
2023-02-24 00:02:25 -07:00
Kenneth Myhra
836cb73d29 BindingsGenerator: Release value setting members of dictionary
When a constructor has an optional dictionary as argument, and those
members are of type new string, make sure that we release_value()
setting the dictionary members.
2023-02-23 15:48:38 +00:00
Kenneth Myhra
98ef76b144 BindingsGenerator: Pass optional values as 'sv' to String::from_utf8()
Pass optional values as StringView to String::from_utf8(), otherwise
this would not compile.
2023-02-23 15:48:38 +00:00
Kenneth Myhra
511ce240f2 BindingsGenerator: Allow stringifier to return DOMException if needed 2023-02-23 15:48:38 +00:00
MacDue
56d8e36698 Lagom: Include AccessibilityTreeModel in LibWebView
This will be needed for the accessibility inspector in Ladybird.
2023-02-22 22:00:40 +00:00
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