Commit graph

61 commits

Author SHA1 Message Date
Andreas Kling
cc4b3cbacc Meta: Update my e-mail address everywhere
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-10-04 13:19:50 +02:00
Timothy Flynn
ec36d7122f LibIDL: Depend on LibCoreMinimal instead of LibCore
When any LibCore file (or any of its dependents) changes, we have to
regenerate all IDL bindings. By depending on LibCoreMinimal, the number
of impacting files greatly reduces.

As an example, changing a .cpp file in LibUnicode would previously cause
about 1800 ninja targets to rebuild. This is now reduced to about 200.
2024-06-23 19:52:45 +02:00
Tim Ledbetter
2f5cf8ac20 LibIDL+LibWeb: Mark [FIXME] interfaces as [[Unimplemented]]
Methods and attributes marked with [FIXME] are now implemented as
direct properties with the value `undefined` and are marked with the
[[Unimplemented]] attribute. This allows accesses to these properties
to be reported, while having no other side-effects.

This fixes an issue where [FIXME] methods broke feature detection on
some sites.
2024-06-11 16:33:30 +02:00
Matthew Olsson
3e221fbb2d IDLGenerators: Handle restricted/unrestricted floating point types 2024-05-29 08:18:24 +02:00
Andrew Kaster
7077e4d002 LibIDL+LibWeb: Add support for WebIDL setlike declarations on interfaces 2024-05-23 10:57:34 +02:00
Tim Ledbetter
4d9b6645d7 LibIDL: Remove unused required_imported_paths field from Interface 2024-04-26 08:00:32 -04:00
Luke Wilde
316814988f LibIDL+LibWeb: Add support for static readonly attributes
Support for settable attributes is a FIXME.
2024-04-03 07:55:51 +02:00
Kenneth Myhra
900a889eb1 LibWeb+LibIDL: Add support for overloading constructors 2024-03-30 19:29:14 +01:00
Tim Ledbetter
9eaae99da7 LibIDL: Ignore leading underscores in IDL identifier names
According to the WebIDL specification, any leading underscores in
identifier names are ignored. A leading underscore is used when an
identifier would otherwise be a reserved word.
2024-03-12 09:31:41 +01:00
Shannon Booth
1b6346ee1c LibWeb: Add support for implementing an IDL class with a different name
Add support for the extended attribute "ImplementedAs" for IDL
interfaces too. This allows a class which implements an IDL interface to
have a different class name than the interface itself.
2024-02-25 08:54:31 +01:00
Ali Mohammad Pur
971e466521 LibIDL: Emit an error when two decls of the same function are present
Duplicates can show up when copy-pasting IDL snippets into existing IDL
files, and the resulting error is extremely useless and misleading.
This commit makes it so the parser catches these cases, and emits a more
helpful error like "Overload set 'instantiate' contains multiple
identical declarations".
2024-02-16 15:26:43 +01:00
Sam Atkins
56c5ffe398 LibFileSystem+Userland: Return ByteString from real_path() 2024-01-16 08:42:34 +00:00
kleines Filmröllchen
eada4f2ee8 AK: Remove ByteString from GenericLexer
A bunch of users used consume_specific with a constant ByteString
literal, which can be replaced by an allocation-free StringView literal.

The generic consume_while overload gains a requires clause so that
consume_specific("abc") causes a more understandable and actionable
error.
2024-01-12 17:03:53 -07:00
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Timothy Flynn
2c1bbf5a99 AK+LibIDL: Put IDL dbgln statement behind a debug flag
This is a bit spammy now that we are performing some overload resolution
at build time. The fallback to an interface has generally worked fine on
the types it warns about (BufferSource, Module, etc.) so let's not warn
about it for every build.
2023-11-15 23:42:53 +01:00
Matthew Olsson
6761791c9a LibIDL: Require the 'attribute' keyword when parsing attributes 2023-11-11 08:52:50 +01:00
Matthew Olsson
b081cf077e LibIDL: Verify inner type of nullable type is valid 2023-11-11 08:52:50 +01:00
Idan Horowitz
f2410071cd LibIDL: Support dictionary types when distinguishing argument indices 2023-11-11 08:48:25 +01:00
Idan Horowitz
f837f02eea LibIDL+LibWeb: Resolve distinguishing argument index at build time
Aside from the obvious performance benefits, this will allow us to
properly handle dictionary types. (whose dictionary-ness is only known
at build-time)

Much of the rest of the overload resolution algorithm steps can (and
should) be evaluated at build-time as well, but this is a good first
step.
2023-11-11 08:48:25 +01:00
stelar7
19bf42a7e6 LibIDL: Attach extended attributes on enums 2023-11-07 11:34:21 +01:00
Bastiaan van der Plaat
2e1d6f624d LibIDL: Fix bug where Type::is_json doesn't look at parent interface 2023-08-23 12:11:21 +01:00
Ben Wiederhake
72756f09f4 LibIDL: Avoid unnecessary copies of imported paths 2023-06-15 08:09:16 +02:00
Ben Wiederhake
688d8febe4 LibIDL: Avoid unnecessary HashMap copy 2023-05-19 22:33:57 +02:00
Cameron Youell
c048cf2004 Libraries: Convert DeprecatedFile usages to LibFileSystem 2023-03-24 10:58:43 +00:00
Luke Wilde
3f7fdfa807 LibIDL: Add Type::is_json which says if the type is convertible to JSON 2023-03-23 21:00:43 +00:00
Srikavin Ramkumar
6bc6ea8e97 LibIDL: Parse extended attributes for constructors 2023-03-23 13:37:40 +01:00
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Timothy Flynn
08fabf7acb LibIDL: Partially implement distinguishing between interface-like types
This is needed for WebAssembly, where we need to distinguish between a
BufferSource and a WebAssembly.Module.
2023-03-16 19:39:17 +00:00
Timothy Flynn
af119d92cb LibIDL+LibWeb: Begin supporting the LegacyNamespace extended attribute
This is used by WebAssembly IDL files. For now, we mostly use this for
error messages and cache keys (to ensure compatibility with existing
code as WebAssembly is ported to IDL).
2023-03-16 13:54:16 +01:00
Timothy Flynn
1ff75618c0 LibIDL: Allow extended attributes on non-required IDL dictionary members
For example, WebAssembly.Memory will have:

    [EnforceRange] unsigned long maximum;
2023-03-16 13:54:16 +01:00
Timothy Flynn
61ecdbca54 LibIDL: Begin parsing IDL namespaces
For example, the CSS namespace is defined via IDL, but we currently have
a manual implementation.
2023-03-15 12:48:25 -04:00
Andreas Kling
a504ac3e2a Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
Linus Groh
3316d247bf LibWeb: Support interfaces with the [Global] extended attribute
These are treated differently as the interface members are placed on the
object itself, not its prototype.
As the object itself still needs to be hand-written code, and we can no
longer fully hide the gnarly generated code in the prototype object,
these now generate a 'mixin' class that is added to the actual object
through inheritance.

https://webidl.spec.whatwg.org/#Global
2023-03-07 23:33:34 +00:00
Andreas Kling
689ca370d4 Everywhere: Remove NonnullRefPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Linus Groh
725a758c66 LibIDL: Also parse extended attributes after 'optional'
From the WebIDL grammar:
(https://webidl.spec.whatwg.org/#prod-Argument)

Argument ::
    ExtendedAttributeList ArgumentRest
ArgumentRest ::
    optional TypeWithExtendedAttributes ArgumentName Default
TypeWithExtendedAttributes ::
    ExtendedAttributeList Type

One IDL file has been updated to match the spec literally, as it can now
be parsed properly.
2023-03-05 21:59:16 +00:00
Linus Groh
d68623698c LibIDL: Use OrderedHash{Table,Map} to store Enumeration values
Seems nice to keep these in the same order as the input and have
deterministic codegen of interfaces in LibWeb (for the purpose of
diffing two build revisions, for example).
2023-03-03 09:25:34 +00: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
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
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
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
Tim Schumacher
558fab2703 LibIDL: Use Core::Stream to read imports 2022-12-14 15:19:35 +00:00
Daniel Bertalan
24d2c90a28 BindingsGenerator+CMake: Keep track of IDL dependencies
This commit teaches BindingsGenerator to generate depfiles, which can be
used by CMake to ensure that bindings are properly regenerated when
imported IDL files change.

Two new options, `--depfile` and `--depfile-target` are added.
- `--depfile` sets the path for the dependency file.
- `--depfile-target` lets us set a target name different than the output
  file in the depfile. This option is needed because generated files are
  first written to a temporary file, but depfiles have to refer to the
  final location.
These are analogous to GCC's `-MF` and `-MT` options respectively. The
depfile's syntax matches the ones generated by GCC.

Note: This changes the minimal required CMake version to 3.20 if the
Make generator is used, and to 3.21 for the Xcode generator. Ninja is
not affected.
2022-12-13 11:31:24 +01:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
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.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
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 :^)
2022-12-06 08:54:33 +01:00
Andreas Kling
b1f8c5879f LibIDL: Fix bug where entire EffectiveOverloadSet was erased
There was a funny bug here: by storing the "last matched item" as a
pointer, and then using Vector::remove_all_matching() to remove all
items that didn't have that exact address, we would end up removing
everything unless the last item matched was the very first item.

(This happened because every time an item was removed from the vector,
the remaining contents shift one step towards the start of the vector,
affecting item addresses.)

This patch fixes the issue by storing the last match as an index.
2022-11-30 14:43:22 +01:00
MacDue
8a5d2be617 Everywhere: Remove unnecessary mutable attributes from lambdas
These lambdas were marked mutable as they captured a Ptr wrapper
class by value, which then only returned const-qualified references
to the value they point from the previous const pointer operators.

Nothing is actually mutating in the lambdas state here, and now
that the Ptr operators don't add extra const qualifiers these
can be removed.
2022-11-19 14:37:31 +00:00
Linus Groh
1dc05fcc12 LibIDL: Also handle anonymous union types in resolve_typedef()
Even if the type doesn't have a name and won't yield a result when
looking for it in interface.typedefs, we still need to look at each of
the union's members and resolve those as well, in a similar fashion to
how we already recursively resolve the replaced type.

This is commonly used in function parameters, for example send() from
the XMLHttpRequest interface:
send(optional (Document or XMLHttpRequestBodyInit)? body = null)
2022-11-10 21:23:00 +00:00
Linus Groh
d9cb7b6dc7 LibIDL: Fix accidental early return in resolve_typedef()
This made sense before we had the next step to resolve union types, but
now we only need to skip transferring the extended attributes, without
returning just yet.
2022-11-10 21:23:00 +00:00