Commit graph

51910 commits

Author SHA1 Message Date
Timothy Flynn
7e0083fb65 LibJS: Rename ErrorType::IntlNumberIsNaN to ErrorType::NumberIsNaN
It will be used outside of the Intl namespace, so give it a less overly
specific name.
2023-06-26 10:39:07 +02:00
Timothy Flynn
deeee65e37 LibJS: Implement Iterator.prototype.filter 2023-06-26 10:39:07 +02:00
Timothy Flynn
3eb2e4e08a LibJS: Implement Iterator.prototype.map
This uses a new Iterator type called IteratorHelper. This does not
implement IteratorHelper.prototype.return as that relies on generator
objects (i.e. the internal slots of JS::GeneratorObject), which are not
hooked up here.
2023-06-26 10:39:07 +02:00
Timothy Flynn
7ff6b472c0 LibJS: Implement Iterator.prototype [ @@toStringTag ] 2023-06-26 10:39:07 +02:00
Timothy Flynn
d9d245faa7 LibJS: Implement Iterator.from and the WrapForValidIteratorPrototype
Iterator.from creates an Iterator from either an existing iterator or
an iterator-like object. In the latter case, it sets the prototype of
the returned iterator to WrapForValidIteratorPrototype to wrap around
the iterator-like object's iteration methods.
2023-06-26 10:39:07 +02:00
Timothy Flynn
5736b53013 LibJS: Add an Iterator constructor and object
The Iterator object cannot be constructed directly but can be subclassed
or created with `Iterator.from` (not implemented here).
2023-06-26 10:39:07 +02:00
Timothy Flynn
428109e709 LibJS: Forward declare IteratorRecord and remove inclusion from VM.h
This drastically reduces the amount of compilation required when
Iterator.h is changed.
2023-06-26 10:39:07 +02:00
Timothy Flynn
4977000fa0 LibJS: Rename JS::Iterator to JS::IteratorRecord
This is in preparation for an upcoming implementation of the Iterator
Helpers proposal. That proposal will require a JS::Object type named
"Iterator", so this rename is to avoid conflicts.
2023-06-26 10:39:07 +02:00
Andrew Kaster
cd2a6767bc AK: Never use assert() when targeting Windows platforms
The Windows CRT definition of assert() is not noreturn, and causes
compile errors when using it as the backing for VERIFY() in debug
configurations of applications like the Jakt compiler.
2023-06-26 05:09:00 +02:00
Luke Wilde
c5f3b3ae02 LibJS/Bytecode: Return the proper result for iteration statements 2023-06-26 04:58:27 +02:00
Luke Wilde
b162c9117e LibJS/Bytecode: Set accumulator to undefined at start of catch blocks
Otherwise we leak the error value through to the result.
2023-06-26 04:58:27 +02:00
Zaggy1024
1789905d4a LibVideo/PlaybackManager: Don't crash when demuxer seek throws an error
`seek_demuxer_to_most_recent_keyframe()` wasn't correctly returning in
cases where an error was thrown by the demuxer. To avoid this, the
function now returns the error, and the playback state handler must act
on it instead, allowing it to exit the seeking state early.
2023-06-25 20:35:37 -04:00
Zaggy1024
b94c132dd1 Tests/LibVideo: Add a test for Matroska files containing CRC32 elements 2023-06-25 20:27:02 -04:00
Zaggy1024
cf1cb04af0 LibVideo/Matroska: Don't choke on files containing CRC32 elements
The EBML specification allows for CRC32 elements to be placed as the
first child element of a master element. However, our parsing of master
elements didn't take that into account, so an error would be thrown.

Instead of erroring out, the `parse_master_element()` function will now
skip CRC32 elements that are found as the first child of a master
element. If it is found after the first child, that will be considered
an error.

Void elements will also be skipped by `parse_master_element()`.

Since the `parse_cluster()` function has to seek the stream back to the
cluster's first child in order to allow cues' positions to be used
correctly, `parse_master_element()` had to be changed to return the
first element position, since the callback is not invoked for CRC32
elements. This means that the parameter used to communicate the element
position to the child element parsing function is unused, so that is
removed.
2023-06-25 20:27:02 -04:00
Andreas Kling
a4a1d1b84a LibJS/Bytecode: Transfer object expression property names to functions
2 new passes on test262. :^)
2023-06-25 20:39:29 +02:00
Andreas Kling
ad15a1e3e2 LibJS/Bytecode: Don't assert on eval() without arguments
3 new passes on test262. :^)
2023-06-25 19:41:53 +02:00
Andreas Kling
ceb5199225 LibJS/Bytecode: Don't clobber accumulator in Put/Delete instructions
The fact that side effects clobbers the accumulator isn't just annoying
inside the instruction handler, but also really counter-intuitive in
the bytecode program itself.

17 new passes on test262. :^)
2023-06-25 19:14:30 +02:00
Andreas Kling
8450948458 LibJS: Make class definition evaluation work in bytecode mode
Instead of assuming that there's an active AST interpreter, this code
now takes VM& everywhere and invokes the appropriate interpreter.

92 new passes on test262. :^)
2023-06-25 18:28:44 +02:00
Andreas Kling
66936a0d61 LibJS/Bytecode: Fix non-string keys not being excluded in rest object
By converting the excluded names to PropertyKey before filtering, we
ensure that non-string keys get excluded as needed.

14 new passes on test262. :^)
2023-06-25 18:02:37 +02:00
Andreas Kling
6f0952c358 LibJS/Bytecode: Handle object destructuring to member expression
19 new passes on test262. :^)
2023-06-25 17:00:29 +02:00
Hendiadyoin1
7005a91a1e LibJS: Replace invalid escapes in TemplateLiterals with undefined in BC
Also adds a big FIXME, to outline what is still wrong
2023-06-25 16:41:50 +02:00
Andi Gallo
3a0f7e8eb8 LibWeb: Adjust specified table height
Subtract borders and padding from specified height before comparing to
the used content height.
2023-06-25 15:08:42 +02:00
Andreas Kling
77f1e91e9d LibJS: Make $262.evalScript() work in bytecode mode
29 new passes on test262. :^)
2023-06-25 13:13:19 +02:00
Andreas Kling
1932f7e6b6 LibJS/Bytecode: Transfer binding pattern aliases to function names
60 new passes on test262. :^)
2023-06-25 11:59:51 +02:00
Shannon Booth
55d59636ef LibWeb: Implement Web::URL::url_encode closer to spec 2023-06-25 11:28:32 +02:00
Shannon Booth
799c79cc5a LibWeb: Simplify logic in Web::URL::URLSearchParams::sort 2023-06-25 11:28:32 +02:00
Shannon Booth
e99c0ddb0e LibWeb: Add spec link for Web::URL::url_decode 2023-06-25 11:28:32 +02:00
Shannon Booth
be9fcaf92d AK: Expose URLParser::percent_encode_after_encoding
This function is useful in places outside of the URLParser in LibWeb.
2023-06-25 11:28:32 +02:00
Kenneth Myhra
c445bd3a0c LibWeb: Move WebSocket constructor steps closer to spec 2023-06-25 11:28:18 +02:00
FalseHonesty
110eeb8591 LibWeb: Support calc(...) in box-shadow's values of type Length
The CSS box-shadow property takes 2-4 properties that are `<length>`s,
those being:
  - offset-x
  - offset-y
  - blur-radius
  - spread-radius

Previously these were resolved directly to concrete Lengths at parse
time, but now they will be parsed as LengthStyleValues and/or
CalculatedStyleValues and be stored that way until styles are later
resolved.
2023-06-25 10:27:08 +01:00
Andreas Kling
8873bf5016 LibJS/Bytecode: Use ToString instead of generic add() in ConcatString
This avoids invoking valueOf() on the values, which is observable.

48 new passes on test262. :^)
2023-06-25 11:20:05 +02:00
Liav A
99cc33bce9 Ports: Mark cbonsai package.sh as executable
This should fix a recent CI lint problem.
2023-06-25 09:40:00 +02:00
Andreas Kling
8021048bc9 LibJS/Bytecode: Throw on destructuring object assignment to nullish LHS
24 new passes on test262. :^)
2023-06-25 09:19:53 +02:00
Beckett Normington
4032bfc2fc Ports: Add cbonsai port
This commit modifies the port list and adds the package.sh script
for `cbonsai`.
2023-06-25 08:04:23 +01:00
Andi Gallo
8b34af816e LibWeb: Report border box width for tables in a block
For the containing block, table borders are opaque and have to be
accounted when computing the table width since they use available space.
2023-06-25 08:13:04 +02:00
Andi Gallo
2c4908094c LibWeb: Don't subtract border from used table width
The used width is already a content width, which doesn't include
borders. Border widths should be subtracted from the specified width
instead, since that initially specifies the total width including
borders, for consistent comparison. Also handle table box padding as an
additional fix.
2023-06-25 08:13:04 +02:00
Andreas Kling
1f95a40780 LibJS/Bytecode: Actually exit switch statement's lexical scope
95 new passes on test262. :^)
2023-06-25 08:09:39 +02:00
Lucas CHOLLET
cc1bd2d2d9 LibGfx/JPEG: Use a look-up table for cosine values
This solution is a middle ground between re-computing `cos` every time
and a much more mathematically complicated approach (as we have in the
decoder).

While still being far from optimal it already gives us a 10x
improvement, not that bad :^)

Co-authored-by: Tim Flynn <trflynn89@pm.me>
2023-06-25 00:22:21 +02:00
Sam Atkins
5056668ab2 Meta: Add lint check that ports have an executable package.sh 2023-06-25 00:18:52 +02:00
kleines Filmröllchen
e0dce41ddf AudioServer: Add a hack to make audio "just work" on HDA for now
This should be fixed properly, but we have decided that a quick hack is
fine so that audio "just works" for most people.
2023-06-25 00:16:44 +02:00
kleines Filmröllchen
03fac609ee AudioServer+Userland: Separate audio IPC into normal client and manager
This is a sensible separation of concerns that mirrors the WindowServer
IPC split. On the one hand, there is the "normal" audio interface, used
for clients that play audio, which is the primary service of
AudioServer. On the other hand, there is the management interface,
which, like the WindowManager endpoint, provides higher-level control
over clients and the server itself.

The reasoning for this split are manifold, as mentioned we are mirroring
the WindowServer split. Another indication to the sensibility of the
split is that no single audio client used the APIs of both interfaces.
Also, useless audio queues are no longer created for managing clients
(since those don't even exist, just like there's no window backing
bitmap for window managing clients), eliminating any bugs that may occur
there as they have in the past.

Implementation-wise, we just move all the APIs and implementations from
the old AudioServer into the AudioManagerServer (and respective clients,
of course). There is one point of duplication, namely the hardware
sample rate. This will be fixed in combination with per-client sample
rate, eliminating client-side resampling and the related update bugs.
For now, we keep one legacy API to simplify the transition.

The new AudioManagerServer also gains a hardware sample rate change
callback to have exact symmetry on the main server parameters (getter,
setter, and callback).
2023-06-25 00:16:44 +02:00
Valtteri Koskivuori
c3f5b514c8 WindowServer: Yank out window frame opacity
This facility was added in 15a1d9a, but isn't being used for anything.
It wasn't even hooked up to LibGUI for applications to use.
Relevant use-cases, such as the most prominent one in `AnalogClock`, use
`GUI::Window::set_frameless()` instead.
2023-06-24 23:45:27 +02:00
Valtteri Koskivuori
6931a5a0a8 WindowServer+LibGUI: Yank out window-global opacity
From what I can tell, this facility was added to WSWindow/GWindow in
2019 in 9b71307. I only found a single place in the codebase still using
this facility: `WindowServer::Menu::start_activation_animation()`. A
subtle fade-out animation that happens when a menu item is selected, and
the menu disappears.
I think our compositing facilities have improved enough to make this
facility redundant. The remaining use mentioned above was ported to just
directly blit the fade-out animation instead of requesting it from
WindowServer.
2023-06-24 23:45:27 +02:00
Andreas Kling
4fd71e3c3a LibJS/Bytecode: Support destructuring in try..catch
112 new passes in test262.
2023-06-24 21:10:07 +02:00
MacDue
3d755a57b6 LibGfx: Ensure last subpath is closed by Path::close_all_subpaths() 2023-06-24 19:31:30 +02:00
MacDue
6b40271b95 LibWeb: Close all subpaths when filling SVG paths 2023-06-24 19:31:30 +02:00
Shannon Booth
f2881f4662 headless-browser: Use Diff::write_normal to output hunks
Saving a bunch of code :^)

The "Hunk:" text is preserved as there is no real need for the browser
test harness to be producing valid patch files.
2023-06-24 18:34:08 +02:00
Shannon Booth
2b56aefaed diff: Use Diff::write_normal to output hunks
Saving a bunch of code :^)
2023-06-24 18:34:08 +02:00
Shannon Booth
7afff80e71 LibDiff: Add Diff::write_normal for outputting normal hunks
In order to extract duplicated code between browser and the diff
utility.
2023-06-24 18:34:08 +02:00
Shannon Booth
312de21498 diff: Remove "Hunk:" text from output
While this is a useful piece of information it means that diff is
producing hunks that are not of a valid normal diff format. This breaks
the ability to redirect the output of diff to a file to generate a
patch.
2023-06-24 18:34:08 +02:00