Commit Graph

1515 Commits

Author SHA1 Message Date
Linus Groh
40a70461a0 LibWeb: Replace GlobalObject with Realm in wrapper functions
Similar to create() in LibJS, wrap() et al. are on a low enough level to
warrant passing a Realm directly instead of relying on the current realm
from the VM, as a wrapper may need to be allocated while no JS is being
executed.
2022-08-23 13:58:30 +01:00
Linus Groh
25849f8a6d LibJS: Replace GlobalObject with VM in common AOs [Part 18/19] 2022-08-23 13:58:30 +01:00
Linus Groh
ccdfa2320c LibJS: Replace GlobalObject with VM in Iterator AOs [Part 7/19] 2022-08-23 13:58:30 +01:00
Linus Groh
a022e548b8 LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
This is where the fun begins. :^)
2022-08-23 13:58:30 +01:00
Linus Groh
999da617c5 LibJS: Remove GlobalObject from VM::this_value()
This is a continuation of the previous six commits.

The global object is only needed to return it if the execution context
stack is empty, but that doesn't seem like a useful thing to allow in
the first place - if you're not currently executing JS, and the
execution context stack is empty, there is no this value to retrieve.
2022-08-23 13:58:30 +01:00
Linus Groh
f3117d46dc LibJS: Remove GlobalObject from VM::throw_completion()
This is a continuation of the previous five commits.

A first big step into the direction of no longer having to pass a realm
(or currently, a global object) trough layers upon layers of AOs!
Unlike the create() APIs we can safely assume that this is only ever
called when a running execution context and therefore current realm
exists. If not, you can always manually allocate the Error and put it in
a Completion :^)

In the spec, throw exceptions implicitly use the current realm's
intrinsics as well: https://tc39.es/ecma262/#sec-throw-an-exception
2022-08-23 13:58:30 +01:00
Linus Groh
e992a9f469 LibJS+LibWeb: Replace GlobalObject with Realm in Heap::allocate<T>()
This is a continuation of the previous three commits.

Now that create() receives the allocating realm, we can simply forward
that to allocate(), which accounts for the majority of these changes.
Additionally, we can get rid of the realm_from_global_object() in one
place, with one more remaining in VM::throw_completion().
2022-08-23 13:58:30 +01:00
Linus Groh
b99cc7d050 LibJS+LibWeb: Replace GlobalObject with Realm in create() functions
This is a continuation of the previous two commits.

As allocating a JS cell already primarily involves a realm instead of a
global object, and we'll need to pass one to the allocate() function
itself eventually (it's bridged via the global object right now), the
create() functions need to receive a realm as well.
The plan is for this to be the highest-level function that actually
receives a realm and passes it around, AOs on an even higher level will
use the "current realm" concept via VM::current_realm() as that's what
the spec assumes; passing around realms (or global objects, for that
matter) on higher AO levels is pointless and unlike for allocating
individual objects, which may happen outside of regular JS execution, we
don't need control over the specific realm that is being used there.
2022-08-23 13:58:30 +01:00
Linus Groh
5dd5896588 LibJS+LibWeb: Replace GlobalObject with Realm in initialize() functions
This is a continuation of the previous commit.

Calling initialize() is the first thing that's done after allocating a
cell on the JS heap - and in the common case of allocating an object,
that's where properties are assigned and intrinsics occasionally
accessed.
Since those are supposed to live on the realm eventually, this is
another step into that direction.
2022-08-23 13:58:30 +01:00
Linus Groh
ecd163bdf1 LibJS+LibWeb: Replace GlobalObject with Realm in object constructors
No functional changes - we can still very easily get to the global
object via `Realm::global_object()`. This is in preparation of moving
the intrinsics to the realm and no longer having to pass a global
object when allocating any object.
In a few (now, and many more in subsequent commits) places we get a
realm using `GlobalObject::associated_realm()`, this is intended to be
temporary. For example, create() functions will later receive the same
treatment and are passed a realm instead of a global object.
2022-08-23 13:58:30 +01:00
Linus Groh
ae264c9143 CI: Install newer Bash via homebrew on macOS
The recently added generate-emoji-txt.sh script uses a Bash 4
substitution feature, causing CI to fail as macOS ships an ancient Bash
3.x. We'll want to use a more recent version anyway, so let's do that
instead of updading the script to older syntax.
2022-08-23 13:25:39 +01:00
Timothy Flynn
d86b25c460 Meta: Move downloading of emoji-test.txt to unicode_data.cmake
The current emoji_txt.cmake does not handle download errors (which were
a common source of issues in the build problems channel) or Unicode
versioning. These are both handled by unicode_data.cmake. Move the
download to unicode_data.cmake so that we can more easily handle next
month's Unicode 15 release.
2022-08-22 16:00:29 +01:00
Ryan Liptak
221d9089e9 Meta: Generate emoji.txt at build time from Unicode's emoji-test.txt
Instead of manually updating emoji.txt whenever new emoji are added,
we use Unicode's emoji-test.txt to generate emoji.txt on each build,
including only the emojis that Serenity supports at that time.

By using emoji-test.txt, we can also include all forms of each emoji
(fully-qualified, minimally-qualified, and unqualified) which can be
helpful when double-checking how certain forms are handled.
2022-08-22 08:42:54 +01:00
Ryan Liptak
68ff0a7d13 Meta: Add check-emoji script to validate emoji filenames
Verifies that emoji filenames:
- Contain only uppercase letters, numbers, +, and _
- Use _ and a separator between codepoints, not +
- Do not include the U+FE0F emoji presentation specifier
2022-08-20 23:50:41 +01:00
Timon Kruiper
a4dadaeb00 Meta: Disallow running with QEMU >= 7.x on aarch64 build
This is currently broken upstream, and our aarch64 Kernel only runs with
QEMU 6.x.
2022-08-17 15:44:38 +01:00
Timothy Flynn
ca92e37ae0 LibUnicode: Generate code point display names with run-length encoding
Similar to commit becec35, our code point display name data was a large
list of StringViews. RLE can be used here as well to remove about 32 MB
from the initialized data section to the read-only section.

Some of the refactoring to store strings as indices into an RLE array
also lets us clean up some of the code point name generators.
2022-08-17 15:42:12 +01:00
Timothy Flynn
2c2ede8581 LibUnicode: Mark UniqueStringStorage::generate as constant
This is just to allow it to be invoked from callers who hold a constant
UniqueStringStorage instance.
2022-08-17 15:42:12 +01:00
Timothy Flynn
becec3578f LibTimeZone+LibUnicode: Generate string data with run-length encoding
Currently, the unique string lists are stored in the initialized data
sections of their shared libraries. In order to move the data to the
read-only section, generate the strings using RLE arrays.

We generate two arrays: the first is the RLE data itself, the second is
a list of indices into the RLE array for each string. We then generate a
decoding method to convert an RLE string to a StringView.
2022-08-16 16:56:17 +02:00
Tim Schumacher
0598f52fc0 Meta: Remove an outdated MAKE_DIRECTORY call for pnp IDs
We are downloading these directly into the build directory now, and
generating the source code from there, so we no longer need the
manually created directory.

While we are at it, remove two variables that seem to be no longer in
use, and at least one of which is confusing regarding a missing prefix.
2022-08-16 06:07:19 -04:00
Emily Trau
d43640037e Meta: Remove TZDB duplication 2022-08-15 09:57:49 +01:00
Sam Atkins
7b61d16262 LibWeb: Correct variable name in get_shortest_function_length() 2022-08-14 11:30:40 +02:00
Sam Atkins
2ec52bbbd5 LibWeb: Implement Path2D class 2022-08-14 11:30:40 +02:00
Sam Atkins
504d221e4a LibWeb: Allow "unrestricted" floats and doubles in IDL
For now, we don't treat them any differently from regular floats and
doubles.
2022-08-14 11:30:40 +02:00
Liav A
6164729d06 Everywhere: Get rid of the fbdev kernel boot argument remainders 2022-08-14 01:03:23 +01:00
Timothy Flynn
d54e3a1cc0 LibTimeZone: Update to TZDB version 2022b
https://mm.icann.org/pipermail/tz-announce/2022-August/000071.html
2022-08-11 15:13:11 -04:00
Timothy Flynn
407a88ebf6 CI: Enable downloading the Azure remote data cache for Fuzzer builds
This cache was disabled in 3127454 because it wasn't needed and there
was a race between the builders for this cache. Then commit 0c95d99
started fuzzing the generated Unicode / TZDB data. Since then, we've
been pulling this data from the live servers instead of Azure's cache.
2022-08-09 20:06:34 -04:00
Timothy Flynn
5c0f1d5b8a CI: Add a restoration key for Azure's remote data caches
We do a similar trick for the compiler cache. This allows each builder
to separately push their local data cache (if it changed) while pulling
a shared cache, without the race outlined in commit 3127454. This is
needed for a subsequent commit which will enable this cache for Fuzzer
builds.
2022-08-09 20:06:34 -04:00
Liav A
cf33d0b5f7 Kernel/FileSystem: Use a new debug flag for SysFS debug messages 2022-08-08 02:33:25 +00:00
Tom
b4dd477644 LibWeb: Parse rect style value
Add ability to parse a rect when it is used as the value of a style
property.
2022-08-07 22:40:11 +02:00
Andreas Kling
50d951aea2 LibJS: Let Shape store a Realm instead of a GlobalObject
This is a cautious first step towards being able to create JS objects
before a global object has been instantiated.
2022-08-05 12:42:46 +02:00
MacDue
8da0c36212 Meta: Set has_unscopable_member for interfaces include mixins with them 2022-07-30 13:20:47 +02:00
Sam Atkins
abd359a921 LibWeb: Skip whitespace when parsing IDL non-interface entities
This stops the WrapperGenerator freaking out when an IDL file starts
with a comment or whitespace. :^)
2022-07-29 17:15:49 +01:00
Timothy Flynn
ae2acc8cdf LibJS+LibUnicode: Generate a set of default DateTimeFormat patterns
This isn't called out in TR-35, but before ICU even looks at CLDR data,
it adds a hard-coded set of default patterns to each locale's calendar.
It has done this since 2006 when its DateTimeFormat feature was first
created. Several test262 tests depend on this, which under ECMA-402,
falls into "implementation defined" behavior. For compatibility, we
can do the same in LibUnicode.
2022-07-22 23:51:56 +01:00
Kenneth Myhra
114120852d LibWeb/IDL: Handle passing ArrayBuffer to an IDL union type
This fixes a bug where an ArrayBuffer passed to the Blob constructor
would just be stringified to: "[object ArrayBuffer]".
2022-07-22 10:18:53 +01:00
Timothy Flynn
32c07bc6c3 LibUnicode: Generate per-locale data for the "noon" fixed day period
Note that not all locales have this day period.
2022-07-21 20:36:03 +01:00
Timothy Flynn
16b673eaa9 LibUnicode: Check whether a calendar symbol for a locale actually exists
In the generated unique string list, index 0 is the empty string, and is
used to indicate a value doesn't exist in the CLDR. Check for this
before returning an empty calendar symbol.

For example, an upcoming commit will add the fixed day period "noon",
which not all locales support.
2022-07-21 20:36:03 +01:00
Timothy Flynn
0f26ab89ae LibJS+LibUnicode: Handle flexible day periods on both sides of midnight
Commit ec7d535 only partially handled the case of flexible day periods
rolling over midnight, in that it only worked for hours after midnight.
For example, the en locale defines a day period range of [21:00, 06:00).
The previous method of adding 24 hours to the given hour would change
e.g. 23:00 to 47:00, which isn't valid.
2022-07-21 20:36:03 +01:00
Andrew Kaster
2aaaee6744 CI+Lagom: Add Lagom Android CI for arm64-v8a on NDK 24 with API level 30
This will let us validate that we aren't breaking any library compile
steps for arm64.
2022-07-21 16:37:15 +02:00
Timothy Flynn
b2709f161e LibUnicode: Generate per-locale approximately & range separator symbols 2022-07-20 22:30:16 +01:00
Linus Groh
dfd62437c4 LibWeb: Make IDL-generated iterator prototype next() enumerable as well
https://webidl.spec.whatwg.org/#es-iterator-prototype-object

> An iterator prototype object must have a next data property with
> attributes { [[Writable]]: true, [[Enumerable]]: true,
> [[Configurable]]: true } and whose value is a built-in function object
> that behaves as follows:

This makes three more WPT tests pass here, and likely various others:
http://wpt.live/fetch/api/headers/headers-basic.any.html
2022-07-20 18:03:21 +01:00
kleines Filmröllchen
3f59356c79 LibAudio: Rename ConnectionFromClient to ConnectionToServer
The automatic nomenclature change for IPC sockets got this one wrong.
2022-07-19 11:17:45 +01:00
Liav A
0810c1b972 Kernel/Storage: Introduce basic abstraction layer for ATA components
This abstraction layer is mainly for ATA ports (AHCI ports, IDE ports).
The goal is to create a convenient and flexible framework so it's
possible to expand to support other types of controller (e.g. Intel PIIX
and ICH IDE controllers) and to abstract operations that are possible on
each component.

Currently only the ATA IDE code is affected by this, making it much
cleaner and readable - the ATA bus mastering code is moved to the
ATAPort code so more implementations in the near future can take
advantage of such functionality easily.

In addition to that, the hierarchy of the ATA IDE code resembles more of
the SATA AHCI code now, which means the IDEChannel class is solely
responsible for getting interrupts, passing them for further processing
in the ATAPort code to take care of the rest of the handling logic.
2022-07-19 11:07:34 +01:00
Tim Schumacher
28061cf94d Everywhere: Fully remove the separate LibPthread directory 2022-07-19 11:00:35 +01:00
Andrew Kaster
9c2211f246 Meta: Add Android cross-compile support to Lagom
This is a start to properly letting us cross-compile Lagom where both
the Tools and the BUILD_LAGOM=ON build are using Lagom CMakeLists.

The initial cut allows an Android build to succeed, more or less.
But there are issues with namespace clashes when using FetchContent with
this approach.
2022-07-19 10:44:02 +01:00
Linus Groh
f33df0ee05 LibWeb: Split WrapperGenerator namespace check into an Array + contains
Also sort the entries alphabetically while we're here :^)
2022-07-19 00:46:04 +01:00
Linus Groh
6b64ca4bb8 LibWeb: Prepare WrapperGenerator for Fetch bindings 2022-07-19 00:27:35 +01:00
MacDue
d924e9ff60 Meta: Teach GenerateCSSPropertyID about linear-gradients 2022-07-17 20:11:38 +01:00
Kenneth Myhra
df8c49f6bf LibWeb: Introduce Blob 2022-07-17 00:23:19 +01:00
Kenneth Myhra
0153514314 LibWeb/IDL: Add support for generating IDL BufferSource type 2022-07-17 00:23:19 +01:00
Kenneth Myhra
f4cbafe951 LibWeb/IDL: Add support for optional long long 2022-07-17 00:23:19 +01:00