Commit Graph

5899 Commits

Author SHA1 Message Date
davidot
733e8472fa LibJS: Make put_own_property_by_index closer to spec
Most of the code is taken from put_own_property however the attributes
  need to be handled slightly differently it seems
2021-06-22 20:49:28 +01:00
davidot
a770c26d54 LibJS: Use Set/CreateDataPropertyOrThrow in Array.prototype as in spec
Mapping:
  Set -> put (does not throw by default)
  CreateDataPropertyOrThrow -> define_property
2021-06-22 20:49:28 +01:00
davidot
15edad8202 LibJS: Make define_property always throw if specified
Now put uses is_strict_mode to determine define_property should throw
2021-06-22 20:49:28 +01:00
davidot
e10219a293 LibJS: Use the new force_throw_exception in delete_property 2021-06-22 20:49:28 +01:00
davidot
16b87b85e3 LibJS: Add parameter to delete_property since we need DeleteOrThrow 2021-06-22 20:49:28 +01:00
Linus Groh
8a06a93ce2 LibJS: Return non-object argument unaltered from Object.setPrototypeOf()
This was missing step 3 from the spec:

    3. If Type(O) is not Object, return O.

Also use RequireObjectCoercible() for a better error message and make
the rest of the code a bit easier to read and more similar to the spec
text.
2021-06-22 18:59:24 +01:00
Andreas Kling
1f8b6ac3c3 LibJS: Begin implementing GlobalEnvironmentRecord
These represent the outermost scope in the environment record
hierarchy. The spec says they should be a "composite" of two things:

- An ObjectEnvironmentRecord wrapping the global object
- A DeclarativeEnvironmentRecord for other declarations

It's not yet clear to me how this should work, so this patch only
implements the first part, an object record wrapping the global object.
2021-06-22 18:44:53 +02:00
Andreas Kling
1d20380859 LibJS: Split the per-call-frame environment into lexical and variable
To better follow the spec, we need to distinguish between the current
execution context's lexical environment and variable environment.

This patch moves us to having two record pointers, although both of
them point at the same environment records for now.
2021-06-22 18:44:53 +02:00
Andreas Kling
aabd82d508 LibJS: Bring function environment records closer to the spec
This patch adds FunctionEnvironmentRecord as a subclass of the existing
DeclarativeEnvironmentRecord. Things that are specific to function
environment records move into there, simplifying the base.

Most of the abstract operations related to function environment records
are rewritten to match the spec exactly. I also had to implement
GetThisEnvironment() and GetSuperConstructor() to keep tests working
after the changes, so that's nice as well. :^)
2021-06-22 18:44:53 +02:00
Andreas Kling
6ed6434bab LibJS: Remove home object from DeclarativeEnvironmentRecord
According to the spec, [[HomeObject]] is an internal slot on function
objects, and should always be accessed through there.
2021-06-22 18:44:53 +02:00
coderdreams
6bc7f2204e Tests: Run each test in their respective directories
This is so they can find their associated resources and it's
the same behavior as in Lagom.

This also required changing some tests so that they could
write their resources in a writable location.
2021-06-22 18:54:40 +04:30
Linus Groh
714a96619f LibJS: Disallow whitespace or comments between regex literal and flags
If we consumed whitespace and/or comments after a RegexLiteral token,
the following token must not be RegexFlags - no whitespace or comments
are allowed between the closing / and the flag characters.

Fixes #8201.
2021-06-22 14:08:40 +01:00
Gunnar Beutner
f1ac0b6a5a WindowServer: Send events once when global cursor tracking is enabled
Previously we'd send mouse events twice if the target window had
global cursor tracking enabled.
2021-06-22 11:00:44 +02:00
Davipb
20b2c46019 PixelPaint: Allow copying arbitrary selections
This replaces the naive copy algorithm that only supported rectangular
and 100% opaque selections with a more general approach that supports
any shape and alpha value.

Note that we now make a brand new bitmap with a hardcoded format instead
of just cropping the layer's existing bitmap. This is done to ensure
that the final clipboard image will have an alpha channel.
2021-06-22 11:00:00 +02:00
Davipb
e58f78e667 PixelPaint: Add more options to RectangleSelectTool
A "feather" value sets by how much the borders of the selection will be
smoothed, and a "mode" value sets how the newly selected region will
interact with an existing image selection (if any).
2021-06-22 11:00:00 +02:00
Davipb
22585e2845 PixelPaint: Expose more complex selection operations
Now that we use RectMask internally to store the selection, we can
expose more powerful APIs to allow for better control over the image
selection.
2021-06-22 11:00:00 +02:00
Davipb
d922e35579 PixelPaint: Use Mask internally in Selection
While the external API has not changed, this will allow us to have
non-rectangular selections in the future.
2021-06-22 11:00:00 +02:00
Davipb
0828c75e57 PixelPaint: Add a Mask class
The Mask class represents an opacity mask over a rectangular section
of an image, linking every pixel to an alpha value ranging from 0 (not
selected) to 255 (fully selected). "Partially selected" pixels can be
used to simulate anti-aliased curves.

This class will be used as the basis for the new non-rectangular
selection feature.
2021-06-22 11:00:00 +02:00
FalseHonesty
4f0a75224c PDFViewer: Update the page number when scrolling between pages 2021-06-22 06:26:44 +04:30
Andreas Kling
395bee07e0 LibJS: Implement the NewObjectEnvironment() abstract operation 2021-06-22 01:17:15 +02:00
Andreas Kling
d8e9a176cd LibJS: Implement the NewDeclarativeEnvironment() abstract operation 2021-06-22 01:17:15 +02:00
Andreas Kling
c6baeca6d7 LibJS: Add ObjectEnvironmentRecord to Forward.h
And sort the forward declared classes alphabetically, for our friends
who enjoy alphabetically sorted things. :^)
2021-06-22 01:17:15 +02:00
bitwitch
7181943d8d LaunchServer: Fix regression in opening files with TextEditor
My previous PR had a small error in rebasing and removed a line in
open_file_url. This caused opening text files from the terminal to
always open with an empty TextEditor.

This commit fixes that problem!
2021-06-22 00:05:51 +02:00
Andreas Kling
08510a0c80 LibJS: Rename VM::current_scope() => current_environment_record()
And rename some related functions that wrapped this as well.
2021-06-21 23:49:50 +02:00
Andreas Kling
d407f247b7 LibJS: Rename virtuals in EnvironmentRecord
This patch makes the following renames:

- get_from_scope() => get_from_environment_record()
- put_to_scope() => put_into_environment_record()
- delete_from_scope() => delete_from_environment_record()
2021-06-21 23:49:50 +02:00
Andreas Kling
5edd259b0a LibJS: Rename EnvironmentRecord::parent() => outer_environment()
This name matches the spec (corresponds to the [[OuterEnv]] slot.)
2021-06-21 23:49:50 +02:00
Andreas Kling
46f2c23030 LibJS: Convert EnvironmentRecord & friends to east-const style 2021-06-21 23:49:50 +02:00
Andreas Kling
6c6dbcfc36 LibJS: Rename Environment Records so they match the spec :^)
This patch makes the following name changes:

- ScopeObject => EnvironmentRecord
- LexicalEnvironment => DeclarativeEnvironmentRecord
- WithScope => ObjectEnvironmentRecord
2021-06-21 23:49:50 +02:00
Felix Rauch
8d91dbf6c0 PixelPaint: Add loading and saving of color palettes
Color palettes can now be stored in and read from files. The default
palette will be read from `/res/color-palettes/default.palette`
instead of being hard-coded in PaletteWidget.

The file format is one color per line, in any format that can be
understood by `Gfx::Color::from_string`.
2021-06-21 22:32:58 +02:00
bitwitch
5ac9494483 LaunchServer: Make all file handlers configurable including directories
This commit gets rid of hard coded file handlers in Launcher.cpp in
favor of using values in the LaunchServer.ini config file.

The previous commit adds checks for the existence of handler programs
while registering handlers. This commit takes advantage of that and
ensures that LaunchServer will not attempt to open a file with a
nonexistent program and can properly report failure before spawning a
new child process.

Resolves #8120
2021-06-21 22:30:41 +02:00
bitwitch
f29980a15b LaunchServer: Check if handler programs exist when registering them
This adds checks in load_handlers() and load_config() to see if the
programs specified in the config files exist before registering them as
handlers.

Resolves #8121
2021-06-21 22:30:41 +02:00
Ali Mohammad Pur
c4b82ace74 LibWasm: Limit the call stack depth and the number of executed insts
These limits are described in the spec, and we're supposed to stop
execution at some point.
The limits are arbitrarily chosen.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
9971d13844 LibWasm: Trap if a non-Value is used as a Value
Otherwise we'd just crash, which is not a good thing
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
9c5d38b7db Meta+LibWasm: Add support for module linking tests
This commit makes the linking tests in the wasm spec test run.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
5c90c389c3 LibWeb: Implement the WebAssembly Memory object and Memory imports 2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
eb5c92d4e2 LibJS: Don't assert for empty reciever if AllowSideEffects::No is given
This parameter is only used if AllowSideEffects::Yes, so there's no
reason to pass anything to it if that's not used.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
e523e530fc LibWeb: Cache the WebAssembly objects that we hand out to JS
The spec requires this behaviour, and it's generally faster to do this
instead of re-resolving and re-creating the instances anyway.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
a256997064 LibWeb: Use SignedBigInteger::create() to create wasm i64 values
...instead of the terrible from_base10(...to_base10()) hack.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
baa4195daa LibWeb: Avoid resolving the wasm call address type on every invocation
This is a waste of time, and it's not a cheap operation.
2021-06-22 00:26:25 +04:30
Andreas Kling
0d2aba07aa LibJS: Add VM::dump_scope_chain()
This is a handy helper that dumps the current scope chain, starting at
the innermost scope.
2021-06-21 20:58:55 +02:00
Andreas Kling
4c8df58e08 LibJS: Rename Parser::m_parser_state => m_state
Also remove the "m_" prefix from all the public data members.
2021-06-21 20:58:55 +02:00
Andreas Kling
5b16b5d7c1 LibJS: Fix spelling mistake in VariableDeclaration::execute() 2021-06-21 20:58:55 +02:00
Tom
08e2dc22be WindowServer: Fix animated cursor regression 2021-06-21 16:52:29 +02:00
Sam Atkins
e79ef6461a cp: Copy sources into destination if it is already a directory
Previously, copying a file to a directory, like this:
```cp README.md Desktop```
correctly copied it to Desktop/README.md, but would fail if the
source was also a directory, for example:
```cp -R Documents Desktop```
Now, that correctly copies it to Desktop/Documents, as you would
expect. :^)
2021-06-21 16:50:29 +02:00
Max Wipfli
ac9003bb70 WindowServer: Focus windows blocked by a modal window
If a window which has an active modal window is focused, the modal
window starts blinking. In this case, the window (and modal) should
still be focused. For this, the order of the checks in
process_mouse_event_for_window has to be changed.

This fixes #8183.
2021-06-21 16:46:01 +02:00
Daniel Bertalan
e5afe7a8a3 LibC: Add P_tmpdir macro 2021-06-21 12:21:03 +02:00
Nick Miller
9a2c80c791 SoundPlayer: Handle any input file sample rate
This commit addresses two issues:
1. If you play a 96 KHz Wave file, the slider position is incorrect,
   because it is assumed all files are 44.1 KHz.
2. For high-bitrate files, there are audio dropouts due to not
   buffering enough audio data.

Issue 1 is addressed by scaling the number of played samples by the
ratio between the source and destination sample rates.

Issue 2 is addressed by buffering a certain number of milliseconds
worth of audio data (instead of a fixed number of bytes).
This makes the the buffer size independent of the source sample rate.

Some of the code is redesigned to be simpler. The code that did the
book-keeping of which buffers need to be loaded and which have been
already played has been removed. Instead, we enqueue a new buffer based
on a low watermark of samples remaining in the audio server queue.

Other small fixes include:
1. Disable the stop button when playback is finished.
2. Remove hard-coded instances of 44100.
3. Update the GUI every 50 ms (was 100), which improves visualizations.
2021-06-21 03:13:59 +04:30
Nick Miller
34a3d08e65 LibAudio: Sleep less when the audio buffer is full
When using `aplay` to play audio files with a sample rate of 96000,
there were occasional one-second gaps in playback. This is
because the Audio::ClientConnection sleeps for a full second when
the audio buffer is full.

One second is too long to sleep, especially for high-bitrate files.
Changing the sleep to a more reasonable value like 100 ms ensures
we attempt to enqueue again before the audio buffer runs empty.
2021-06-21 03:13:59 +04:30
Nick Miller
dec9ed066d LibAudio: Avoid reading past the end of sample data
Prior code in `WavLoader::get_more_samples()` would attempt to
read the requested number of samples without actually checking
whether that many samples were remaining in the stream.
This was the cause of an audible pop at the end of a track, due
to reading non-audio data that is sometimes at the end of a Wave file.

Now we only attempt to read up to the end of sample data, but no
further.

Also, added comments to clarify the meaning of "sample", and how it
should be independent of the number of channels.
2021-06-21 03:13:59 +04:30
Matthew Olsson
df65ff8a1e LibJS: Add bytecode support for regexp literals 2021-06-21 00:28:07 +02:00
yeeter-the-dog
3ccf4dc7ad
js: Insert newline after each line in REPL mode
This makes ASI work in the REPL.
2021-06-20 21:58:57 +01:00
Marcus Nilsson
54852832b1 LibGUI/TabWidget: Make sure we don't act on two mouseup events
Make sure that even if we get two mouseup events, we do not try to
remove the same widget twice.
2021-06-20 21:48:29 +02:00
Gil Mendes
12f3aa9faa LibWeb: Fix redirects when a response has no data
This makes redirects work when the HTTP server responds with just
headers and no data.
2021-06-20 19:40:46 +01:00
Linus Groh
e9388408db LibJS: Implement support for the [[IsHTMLDDA]] internal slot
Best regards from Annex B and document.all :^)
2021-06-20 17:52:09 +01:00
Marcus Nilsson
f2aa5efbeb PixelPaint: Add basic support for closing tabs
This enables closing of tabs in PixelPaint, for the moment
very basic with no checking if the image is modified or saved.
2021-06-20 15:16:26 +02:00
Marcus Nilsson
32fc8da917 Browser: Enable close button on tabs 2021-06-20 15:16:26 +02:00
Marcus Nilsson
49d40a908c LibGUI/TabWidget: Add close button to tabs
This adds an optional close button to tabs, useful in
for example browser and pixelpaint.
2021-06-20 15:16:26 +02:00
Gunnar Beutner
fbaf763e2a LibJS: Let if yield undefined for branches that don't yield a value
According to 13.6.7 the return value for if expressions should be
undefined when the branch statements don't yield a value.
2021-06-20 15:01:11 +02:00
Tom
75dc94064d WindowServer: Reload icons on scale changes
Since MultiScaleBitmaps only loads icons for the scales in use, we need
to unconditionally reload them so that we pick up the correct bitmaps
for a scale that hasn't been previously used.
2021-06-20 14:57:26 +02:00
Tom
14fe7283e1 WindowServer: Update compositor reference to cursor on reload
When we reload a cursor we should make sure the compositor has a
valid reference to the updated cursor.
2021-06-20 14:57:26 +02:00
Tom
f232cb8efe WindowServer: Enable screen capture to span multiple screens
This enables the shot utility to capture all screens or just one, and
enables the Magnifier application to track the mouse cursor across
multiple screens.
2021-06-20 14:57:26 +02:00
Tom
61af9d882e WindowServer: Load multiple scaled versions of Bitmaps and Cursors
This enables rendering of mixed-scale screen layouts with e.g. high
resolution cursors and window button icons on high-dpi screens while
using lower resolution bitmaps on regular screens.
2021-06-20 14:57:26 +02:00
Tom
aa15bf81e4 WindowServer: Add API to set/get screen layouts
This sets the stage so that DisplaySettings can configure the screen
layout and set various screen resolutions in one go. It also allows
for an easy "atomic" revert of the previous settings.
2021-06-20 14:57:26 +02:00
Tom
34394044b3 WindowServer: Validate that all screens can be reached
If there are any screens that are detached from other screens it would
not be possible to get to them using the mouse pointer. Also make sure
that none of the screens are overlapping.
2021-06-20 14:57:26 +02:00
Tom
0547e0329a WindowServer: Fix artifacts after window resize in some cases
We were calculating the old window rectangle after changing window
states that may affect these calculations, which sometimes resulted
in artifacts left on the screen, particularily when tiling a window
as this now also constrains rendering to one screen.

Instead, just calculate the new rectangle and use the window's
occlusion information to figure out what areas need to be invalidated.
2021-06-20 14:57:26 +02:00
Tom
229b541e5d WindowServer: Constrain rendering windows to one screen in some cases
When a window is maximized or tiled then we want to constrain rendering
that window to the screen it's on. This prevents "bleeding" of the
window frame and shadow onto the adjacent screen(s).
2021-06-20 14:57:26 +02:00
Tom
4392da970a WindowServer: Add initial support for rendering on multiple screens
This allows WindowServer to use multiple framebuffer devices and
compose the desktop with any arbitrary layout. Currently, it is assumed
that it is configured contiguous and non-overlapping, but this should
eventually be enforced.

To make rendering efficient, each window now also tracks on which
screens it needs to be rendered. This way we don't have to iterate all
the windows for each screen but instead use the same rendering loop and
then only render to the screen (or screens) that the window actually
uses.
2021-06-20 14:57:26 +02:00
Tom
499c33ae0c LibGfx: Add a Line class and a Rect<T>::RelativeLocation class
These helpers will be useful in preparation for supporting multiple
displays, e.g. to measure distances to other screens or figure out
where rectangles are located relative to each other.
2021-06-20 14:57:26 +02:00
Ali Mohammad Pur
20c066b8e0 LibCore: Call optional did_construct() method when constucting objects
Some objects need to perform tasks during construction that require
the object to be fully constructed, which can't be done in the
constructor. This allows postponing such tasks into a did_construct
method that will be called right after the object was fully
constructed.
2021-06-20 14:57:26 +02:00
Linus Groh
ade85d980b FlappyBug: Add missing component declaration
The PR for this pre-dates the concept of components, so it was forgotten
to add one.
2021-06-20 11:13:30 +01:00
Linus Groh
8f6ac0db1c LibJS: Use OrdinaryCreateFromConstructor() in a bunch of constructors
Resolves various FIXMEs :^)
2021-06-20 12:12:39 +02:00
Linus Groh
e5753443ae LibJS: Consistently make prototype the last argument in Object ctors
This is so that we can reliably allocate them in a template function,
e.g. in ordinary_create_from_constructor():

    global_object.heap().allocate<T>(
        global_object, forward<Args>(args)..., *prototype);

The majority of objects already take the prototype as the last argument,
so I updated the ones that didn't.
2021-06-20 12:12:39 +02:00
Linus Groh
df095afbcc LibJS: Implement the OrdinaryCreateFromConstructor() abstract operation 2021-06-20 12:12:39 +02:00
Linus Groh
500818e73d LibJS: Implement the GetPrototypeFromConstructor() abstract operation 2021-06-20 12:12:39 +02:00
Linus Groh
6312627218 LibJS: Implement the GetFunctionRealm() abstract operation 2021-06-20 12:12:39 +02:00
Linus Groh
55db9539a5 LibJS: Introduce AbstractOperations.{cpp,h} and move various AOs there
Value.{cpp,h} has become a dumping ground, let's change that.

Things that are directly related to Values (e.g. bitwise/binary ops,
equality related functions) can remain, but everything else that's not a
Value or Object method and globally required (not just a static function
somewhere) is being moved.

Also convert to east-const while we're here.

I haven't touched IteratorOperations.{cpp,h}, it seems fine to still
have those separately.
2021-06-20 12:12:39 +02:00
Adam Hodgen
c03a3dc5b7 LaunchServer: Correctly open file URLs with line numbers
PR #5665 updated TextEditor to open files at a specific line/column
location using the file:line:col argument, rather than the -l flag.

This change updates LaunchServer to use that convention, though note it
does only pass the line number and not a column number, as per all
previous behaviour.
2021-06-20 12:07:55 +02:00
Mim Hufford
ddc855ffcd FlappyBug: Add cloud and sky graphics
We now have a nice sunset sky and some random cloud graphics.
The obstacles will get graphics at some point too :)
2021-06-20 10:54:27 +01:00
Mim Hufford
28e08f08c2 FlappyBug: Add new graphics and tweak colors
This adds some actual graphics to the game, and tweaks the obstacle and
sky colors. Eventually there will be graphics for those elements too.
2021-06-20 10:54:27 +01:00
Mim Hufford
f50003bdd2 FlappyBug: Add an input cooldown after game over
This makes sure the player doesn't accidentally start a new game after
they bump into an obstacle.
2021-06-20 10:54:27 +01:00
Mim Hufford
018344bb07 FlappyBug: Keep track of score and highscore
Better information is now shown to the player. Instructions are shown
when first loading the program, and any available scores are shown on
the game over screen.
2021-06-20 10:54:27 +01:00
Mim Hufford
3f603ab082 FlappyBug: Start obstacles off the screen
Previously obstacles were respawning fully on-screen which caused a
discontinuous look. Now they smoothly move into view from off-screen.
2021-06-20 10:54:27 +01:00
Mim Hufford
444fcfd0d2 FlappyBug: Make the obstacle gap position random
The position of the gap in the obstacle is now randomly generated each
time it spawns. The game is more fun to play now :)
2021-06-20 10:54:27 +01:00
Mim Hufford
811d9722f9 FlappyBug: Introduce a new Flappy Bug game
This introduces a Flappy Bug game. It's pretty simple currently, but is
playable.
2021-06-20 10:54:27 +01:00
Gunnar Beutner
25c73159ce LibCoreDump: Don't subtract one from the first stack frame's EIP
The first stack frame represents the current instruction pointer
rather than the return address so we shouldn't subtract one
from it.

Fixes #8162.
2021-06-20 10:19:02 +01:00
Linus Groh
34b338702a LibWasm: Remove empty AbstractMachine/Interpreter.cpp
This was moved to BytecodeInterpreter.cpp, so this is unused now.
2021-06-20 01:49:56 +01:00
Jan de Visser
87bd69559f LibSQL: Database layer
This patch implements the beginnings of a database API allowing for the
creation of tables, inserting rows in those tables, and retrieving those
rows.
2021-06-19 22:06:45 +02:00
Jan de Visser
267eb3b329 LibSQL: Hash index implementation for the SQL storage layer
This patch implements a basic hash index. It uses the extendible hashing
algorith. Also includes a test file.
2021-06-19 22:06:45 +02:00
Jan de Visser
224804b424 LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer
Unfortunately this patch is quite large.

The main functionality included are a BTree index implementation and
the Heap class which manages persistent storage.

Also included are a Key subclass of the Tuple class, which is a
specialization for index key tuples. This "dragged in" the Meta layer,
which has classes defining SQL objects like tables and indexes.
2021-06-19 22:06:45 +02:00
Jan de Visser
2a46529170 LibSQL: Basic dynamic value classes for SQL Storage layer
This patch adds the basic dynamic value classes used by the SQL Storage
layer. The most elementary class is Value, which holds a typed Value
which can be converted to standard C++ types. A Tuple is a collection
of Values described by a TupleDescriptor, which specifies the names,
types, and ordering of the elements in the Tuple.

Tuples and Values can be serialized and deserialized to and from
ByteBuffers. This is mechanism which is used to save them to disk.

Tuples are used as keys in SQL indexes and rows in SQL tables.

Also included is a test file.
2021-06-19 22:06:45 +02:00
Gunnar Beutner
a6ba05b02b LibSymbolication+Utilities: Show inlined functions for bt 2021-06-19 22:04:19 +02:00
Idan Horowitz
c31392510a LibJS: Add the Number.prototype.toFixed method 2021-06-19 16:13:59 +01:00
Itamar
3a4017b419 LibDebug: Convert LibDebug to east-const style 2021-06-19 14:51:18 +02:00
Itamar
03ef2a479a LibCoreDump: Include source locations of inlined functions in backtrace 2021-06-19 14:51:18 +02:00
Itamar
a45b5ccd96 LibDebug: Add DebugInfo::get_source_position_with_inlines
This function returns the source position of a given address in the
program. If that address exists in an inline chain, then it also returns
the source positions that are in the chain.
2021-06-19 14:51:18 +02:00
Itamar
835efa1b6a LibDebug: Add DwarfInfo::get_cached_die_at_offset
This function returns a DIE object from the cache with the given offset
in the debug_info section.
2021-06-19 14:51:18 +02:00
Itamar
fb31aae20d LibDebug:: Add DwarfInfo::get_die_at_address
This function returns the die object whose address range intersects
with the given address.

This function will also construct the DIE cache, if it hasn't been
constructed yet.
2021-06-19 14:51:18 +02:00
Itamar
92d4962d04 LibDebug: Add caches of DIE objects to DwarfInfo
There is one cache that indexes DIE objects by the start address of
their range, and another cache that indexes by their offset in the
debug_info section.

Both caches are implemented with RedBlackTree, and are optional - they
will only be populated if 'build_cached_dies' is invoked.
2021-06-19 14:51:18 +02:00
Itamar
a5f69efa5c LibDebug: Store optional parent_offset in Dwarf::DIE objects
In the current implementation, only DIE objects that are created via
DIE::for_each_child() will have parent offsets.

DIE objects that are created with CompilationUnit::get_die_at_offset()
do not currently store a parent offset.

We may improve this in the future, but this is enough for what we
currently need.
2021-06-19 14:51:18 +02:00
Itamar
84609aecc1 LibDebug: Add AttributeForm field to Dwarf::AttributeValue
In some contexts, it's helpful to also know the "Attribute Form",
in addition to the "Attribute Type".

An example for such context is the interpretation of the
"DW_AT_high_pc" attribute, which has different meaning if the form
is an address or a constant.
2021-06-19 14:51:18 +02:00
Itamar
a45ce0c6eb LibCoreDump: Use "eip - 1" when creating backtrace entries
We need to do this because the return address from a function frame is
the instruction that comes after the 'call' instruction.
2021-06-19 14:51:18 +02:00
Itamar
98a774a68d LibDebug: Add LineProgram::get_directory_and_file(size_t)
This function returns the directory path & filename for a given file
index.
2021-06-19 14:51:18 +02:00
Itamar
0d89f70b66 LibDebug: Move Dwarf::LineProgram into Dwarf::CompilationUnit
Previously, the LineProgram objects were short-lived, and only created
inside DebugInfo::prepare_lines() to create a vector of sorted LineInfo
data.

However, Dwarf::LineProgram also contains other useful data, such as
index-to-string mapping of source directories and filenames.

This commit makes each Dwarf::CompilationUnit own its
Dwarf::LineProgram.
DebugInfo::prepare_lines() then iterates over the compilation units to
prepare its sorted vector of lines.
2021-06-19 14:51:18 +02:00
Itamar
e9e4358a93 LibDebug: Store LibDebug objects on the heap & make them non-copyable
This fixes an issue were some LibDebug objects (for example,
Dwarf::CompilationUnit) held a reference to their parent
Dwarf::DwarfInfo object, which was constructed on the stack and later
moved to the heap.
2021-06-19 14:51:18 +02:00
Itamar
edd79ddd00 LibDebug: Move Dwarf::AttributeValue to a separate file 2021-06-19 14:51:18 +02:00
Itamar
fea9bb8c51 LibDebug: Move get_die_at_offset to Dwarf::CompilationUnit 2021-06-19 14:51:18 +02:00
Itamar
15b3957885 LibDebug: Remove unused DebugInfo::for_each_source_position 2021-06-19 14:51:18 +02:00
Itamar
68ff0788e5 LibDebug: Fix typo in DebugInfo::get_source_position 2021-06-19 14:51:18 +02:00
Andreas Kling
f86e241699 LibJS: Object.getOwnPropertyNames() should enumerate String's .length
We were incorrectly aborting property name enumeration after generating
names for all the indexable properties in the underlying string.
2021-06-19 11:46:08 +02:00
Andreas Kling
686213c2b8 LibJS: Make Object.getOwnPropertyDescriptor() work on String subscripts
String objects are a bit special since the indexed properties are
overridden by the contents of the underlying PrimitiveString.

getOwnPropertyDescriptor() was not taking this into account, and would
instead return undefined when asked about an indexed property in a
String object.
2021-06-19 11:34:19 +02:00
Matthew Olsson
25baefdd1e LibJS: Support object rest elements in the bytecode interpreter 2021-06-19 09:38:26 +02:00
Matthew Olsson
57b9a228ab LibJS: Support array rest elements in the bytecode interpreter 2021-06-19 09:38:26 +02:00
Matthew Olsson
7983324639 LibJS: Implement array destructuring for the bytecode interpreter 2021-06-19 09:38:26 +02:00
Matthew Olsson
14fff5df06 LibJS: Implement more IteratorOperations and organize file
Implemented IteratorComplete and IteratorValue, and sorted functions
based on their spec ordering.
2021-06-19 09:38:26 +02:00
Matthew Olsson
1f8e643ef0 LibJS: Support object destructuring in the bytecode interpreter 2021-06-19 09:38:26 +02:00
Matthew Olsson
f39ab2e60a LibJS: Add JumpUndefined bytecode 2021-06-19 09:38:26 +02:00
Matthew Olsson
3ee627909a LibJS: Ensure GetBy{Id,Value} never load <empty> into the accumulator 2021-06-19 09:38:26 +02:00
Matthew Olsson
ce04c2259f LibJS: Restructure and fully implement BindingPatterns 2021-06-19 09:38:26 +02:00
Matthew Olsson
10372b8118 LibJS: Remove bad spread check in declaration parsing
This would allow assignments such as `let ...{ a } = { a: 20 }`
2021-06-19 09:38:26 +02:00
Linus Groh
fba3c77a04 LibJS: Add missing exception checks to Number() constructor 2021-06-19 02:03:37 +01:00
Linus Groh
8e26c7a1dd LibJS: Make Number() constructor spec compliant
By using to_numeric() and adding BigInt handling, we get support for
`Number(123n)`.

Fixes #8125.
2021-06-19 01:34:17 +01:00
Linus Groh
7f8245439b LibJS: Add a bunch more missing ECMA-262 section/title/URL comments 2021-06-19 00:38:41 +01:00
Matthew Olsson
7f97e33778 LibJS: Disallow 'yield' identifier initializer in GeneratorFunctions 2021-06-19 00:04:57 +01:00
Matthew Olsson
9253fa1bad LibJS: Implement GeneratorFunctionConstructor::construct 2021-06-19 00:04:57 +01:00
Matthew Olsson
22b17219ff LibJS: Add the remaining generator objects
- %GeneratorFunction%
- %GeneratorFunction.prototype%
- %GeneratorFunction.prototype.prototype%
- %Generator%.prototype
2021-06-19 00:04:57 +01:00
DexesTTP
b205c9814a LibCrypto: Fix Hash::MD5's movability
Because MD5 stored a "Bytes {}" wrapper to its internal data buffer,
it was not actually movable. However, its use in several parts of
the system (such as HashManager) assumed it was, leading to crashes.

Fixes #8135
2021-06-19 01:29:21 +04:30
Idan Horowitz
4dc63896de LibJS: Add and use the ArraySpeciesCreate abstract operation
This ensures that the Array.prototype methods produce results using the
constructor of the derived object if it is one instead of always using
the default constructor.
2021-06-18 21:25:16 +01:00
Idan Horowitz
271eeadf25 LibJS: Bring FlattenIntoArray closer to the specification
This fixes the incorrect exception order and missing exception checks
that were caused by the implementation not conforming exactly to the
specification.
2021-06-18 21:25:16 +01:00
Linus Groh
597cf88c08 LibJS: Implement the 'Hashbang Grammar for JS' proposal
Stage 3 since August 2019 - we already have shebang stripping
implemented in js(1), so this removes it from there in favor of adding
support to the lexer directly.

Most straightforward proposal and implementation I've ever seen :^)

https://github.com/tc39/proposal-hashbang
2021-06-18 20:35:23 +01:00
Linus Groh
299c3069c1 LibJS/Tests: Use eval() for toEvalTo(), not Function()
Since we have had eval() for a while now, we can finally use it here -
this allows us to get rid of the confusing return statements in tested
source code.
2021-06-18 20:35:23 +01:00
Idan Horowitz
2e9f665bda LibJS: Throw on detached viewed ArrayBuffer when validating TypedArrays 2021-06-18 20:17:45 +01:00
Idan Horowitz
d5c836dd64 LibJS: Add the TypedArray.prototype.toString property
This is initialized to be the same function object as the initial value
of the Array.prototype.toString generic function.
2021-06-18 20:17:45 +01:00
Idan Horowitz
57db27bcc4 LibJS: Add the TypedArray.prototype.join method 2021-06-18 20:17:45 +01:00
Idan Horowitz
2922a6c053 LibJS: Add the TypedArray.prototype[Symbol.toString] getter accessor 2021-06-18 20:17:45 +01:00
sin-ack
c5073cb287 LibJS: Do not trim whitespace from property names when they're numbers
Fixes #7803.
2021-06-18 19:18:15 +01:00
Luke
8be7bdaac3 LibJS: Add %TypedArray%.prototype.some 2021-06-18 18:13:31 +01:00
Luke
68f11a272b LibJS: Add %TypedArray%.prototype.forEach 2021-06-18 18:13:31 +01:00
Luke
91af985718 LibJS: Add %TypedArray%.prototype.findIndex 2021-06-18 18:13:31 +01:00
Luke
61a8c19556 LibJS: Add %TypedArray%.prototype.find 2021-06-18 18:13:31 +01:00
Luke
65ca2d98af LibJS: Add %TypedArray%.prototype.every 2021-06-18 18:13:31 +01:00
Andreas Kling
de8aa1b17d WindowServer: Move key event handling to its own function
Instead of making WindowManager::event() all about key events.
2021-06-18 18:00:08 +02:00
Andreas Kling
4895f46d8c WindowServer: Make various functions take MouseEvent by const reference
Some paths of the mouse event processing code will upgrade the event
from a regular MouseDown to a MouseDoubleClick. That's why we were
passing `MouseEvent&` everywhere.

For the paths that don't need to do this, passing `MouseEvent const&`
reduces the cognitive burden a bit, so let's do that.
2021-06-18 17:55:41 +02:00
Andreas Kling
82f1ac7390 WindowServer: Don't include frame when determining hovered window
We only consider a window "hovered" if its *content area* is hovered.
2021-06-18 17:40:05 +02:00
Andreas Kling
1537172a6b WindowServer: Simplify handling of the window resize candidate
Always clear the current resize candidate when starting new mouse
event processing (instead of trying to be smart about it.)
2021-06-18 17:40:05 +02:00
Andreas Kling
b5251a70c6 WindowServer: Reorder and annotate the mouse event processing code
Hopefully people can now follow and understand how this works. :^)
2021-06-18 17:40:05 +02:00
Andreas Kling
fa9846ec6f WindowServer: Simplify how we determine the hovered window
Instead of plumbing a Window* through the entire mouse event processing
logic, just do a hit test and say that the window under the cursor is
the hovered window.

It's funny how much easier this is now that we have a way to hit test
the entire window stack with one call.
2021-06-18 17:40:05 +02:00
Andreas Kling
7b3fdd178e WindowServer: Simplify processing of window-specific mouse events
Move the logic for processing a mouse event that hits a specific window
into its own function.

If the window is blocked by a modal child, we now get that out of the
way first, so we don't have to think about it later.
2021-06-18 17:40:05 +02:00
Andreas Kling
2f9e8a982c WindowServer: Unify hit testing between fullscreen/regular windows
Even if a window is in fullscreen mode, we still want hit testing to
walk the window stack. Otherwise child windows of the fullscreen
window will not receive mouse events.
2021-06-18 17:40:05 +02:00
Andreas Kling
09dacf4cd1 WindowServer: Move titlebar button mouse event handling to a function
The button widgets internally rendered by WindowServer are only used
in titlebars, and require a bit of mouse event handling. Instead of
mixing it with the window-oriented mouse event handling, get the
button event stuff out of the way first.
2021-06-18 17:40:05 +02:00
Andreas Kling
5d73e16edf WindowServer: Make deliver_mouse_event() perform coordinate translation
Instead of expecting callers to provide a window-relative position,
just take care of it inside deliver_mouse_event() instead.
2021-06-18 17:40:05 +02:00
Andreas Kling
300711d013 WindowServer: Preserve all members in MouseEvent::translated()
We were forgetting to preserve the m_drag and m_mime_data members of
WindowServer::MouseEvent when making a translated copy.

This didn't affect any reachable code paths before this change.
2021-06-18 17:40:05 +02:00
Andreas Kling
bac200885c LibGUI: Don't restart AbstractView drag on mousemove after escape key
Previously, if a drag operation was aborted by pressing the escape key
(handled by WindowServer), the drag would immediately restart if you
moved the mouse cursor before releasing the mouse button.
2021-06-18 17:40:05 +02:00
Andreas Kling
58823c474e WindowServer: Don't let super key open system menu while tracking input
Previously it was possible to open the system menu while tracking mouse
input after a mousedown event.
2021-06-18 17:40:05 +02:00
Andreas Kling
82a945fa7e WindowServer: Always send mouse events to active input tracker first
If a window is currently actively tracking input events (because
sent it a MouseDown and haven't sent it a MouseUp yet), we now simply
send mouse events to that window right away before doing any other
event processing.

This makes it much easier to reason about mouse events.
2021-06-18 17:40:05 +02:00
Andreas Kling
69dad3b996 WindowServer: Remove an unnecessary temporary variable 2021-06-18 17:40:05 +02:00
Andreas Kling
ad828b3cfc WindowServer: Split up WindowFrame::handle_mouse_event()
Break this function into a couple of smaller functions, one for each
of these areas:

- The titlebar
- The titlebar icon
- The menubar
- The border
2021-06-18 17:40:05 +02:00
Andreas Kling
f88361fc28 WindowServer: Add WindowStack::window_at() and use it a bunch
This performs a hit test on the window stack to find the window under
a given cursor position.
2021-06-18 17:40:05 +02:00
Andreas Kling
4133caba78 WindowServer: Make hit test results richer
Instead of just answering hit/no-hit when hit testing windows, we now
return a HitTestResult object which tells you which window was hit,
where it was hit, and whether you hit the frame or the content.
2021-06-18 17:40:05 +02:00
Andreas Kling
370d3749e5 WindowServer: Remove weird feature where Ctrl+Wheel changed opacity
This feature had been there since early on and was not actually useful
for anything. I just added it because it was fun. In retrospect, it's
not a very good feature and I only ever activated it by accident.
2021-06-18 17:40:05 +02:00
Andreas Kling
e4e94cd43d WindowServer: Allow each WindowStack to have an active window
A window with an inner stack needs to keep track of which inner window
is active.
2021-06-18 17:40:05 +02:00
Andreas Kling
2b0e0b602c WindowServer: Keep track of which WindowStack a Window is part of
Each Window now knows which WindowStack it's part of. We call this the
Window::outer_stack(), in preparation for supporting inner stacks. :^)
2021-06-18 17:40:05 +02:00
Andreas Kling
d0bc3d6002 WindowServer: Convert WindowManager to east-const style 2021-06-18 17:40:05 +02:00
Andreas Kling
d257f58306 WindowServer: Add WindowStack concept
This patch moves the window stack out of WindowManager and into its own
WindowStack class.

A WindowStack is an ordered list of windows with an optional highlight
window. The highlight window mechanism is used during Super+Tab window
switching to temporarily bring a window to the front.

This is mostly mechanical, just moving the code to its own class.
2021-06-18 17:40:05 +02:00
Jesse Buhagiar
906d3e9f44 LibUSBDB: Fix vendor id decoding
This was broken because the whole line was being passed in instead
of a substring..
2021-06-18 19:41:25 +04:30
Gunnar Beutner
cf79b499f6 LibC: Add definition for PRIuPTR 2021-06-18 16:35:15 +02:00
Jesse Buhagiar
01cd474930 Userland/Libraries: Add LibUSBDB library
Simple clone of LibPCIDB to support USB IDs instead of PCI
ones. The format is basically identical, besides a few changes
of the double tab fields.
2021-06-18 17:04:57 +04:30
Jesse Buhagiar
119b8a2692 Userland: Add lsusb :^) 2021-06-18 17:04:57 +04:30
Luke
02de3cbce3 LibJS: Add Number.parseInt
This is initialized to be the same function object as the initial value
of the parseInt function on the global object.
2021-06-18 10:29:33 +01:00
Idan Horowitz
b6a74b6bd9 LibJS: Use existing attributes if any are missing in the new descriptor
The specification defines that we should only change attributes that
exist in the incoming descriptor, but since we currently just overwrite
the existing descriptor with the new one, we can just set the missing
attributes to the existing values manually.
2021-06-18 10:22:09 +02:00
Luke
50f33bb98e LibJS: Add missing exception check in Date.prototype.toJSON
It was missing an exception check on the call to to_primitive.
This fixes test/built-ins/Date/prototype/toJSON/called-as-function.js
from test262 crashing, but does not fix the test itself.
2021-06-18 10:21:29 +02:00
Marco Cutecchia
24c243942d Browser: Add setting to change homepage URL 2021-06-18 10:20:24 +02:00
Elliot Maisl
90873781c1 PixelPaint: Add new selection moving modes
If you press "spacebar" while moving a selection, it will now move the
origin point of the selection; and if you press "control" it will move
it relatively to the center.
2021-06-17 23:02:53 +02:00
brapru
c62804df46 passwd: Do not allow empty passwords
The user should use the delete flag when wanting to issue an empty
password. passwd should return an error after receiving empty input.
2021-06-17 19:54:38 +02:00
brapru
1a9d0dee2c passwd: Provide more verbose output regarding status of changed passwd
passwd should explicitly indicate the status of the password change.
2021-06-17 19:54:38 +02:00
brapru
4fd842f566 passwd: Retype password to confirm
Previously passwd would accept the first password input by the user. It
should ask the user to re-type the password to check for mismatches and
prevent typos in the password.
2021-06-17 19:54:38 +02:00
brapru
b0f8bccd08 passwd: Prompt for the current password before setting new password
This changes passwd to authenticate non-root users before prompting for
new password.
2021-06-17 19:54:38 +02:00
Erik Sommer
96588adbd4
PixelPaint: Update debug message in the copy action to the used method (#8113) 2021-06-17 19:53:45 +02:00
Idan Horowitz
cc5c1df64b LibJS: Add the TypedArray.of() method 2021-06-17 18:13:20 +01:00
Idan Horowitz
dcb55db99b LibJS: Replace boolean without_side_effects parameters with an enum 2021-06-17 16:52:15 +02:00
Idan Horowitz
864beb0bd5 LibJS: Remove the unused IndexedProperties::append_all method 2021-06-17 16:52:15 +02:00
stelar7
22851287b1 Spreadsheet: Pledge 'fattr' to avoid crashing after exporting as csv 2021-06-17 18:49:44 +04:30
Ali Mohammad Pur
2fe9c81b30 Everywhere: Replace the multiple impls of print_buffer() with :hex-dump 2021-06-17 18:44:00 +04:30
sin-ack
10f56166e5 LibJS: Cast to i64 for is_integral_number
This fixes the built-ins/Number/isInteger/integers.js test.
9007199254740991 is still an integer, though not a safe one.
2021-06-17 13:44:01 +01:00
Idan Horowitz
a85a95fe8d LibJS: Stop overwriting existing accessors in Object::define_property 2021-06-17 13:20:18 +01:00
Idan Horowitz
1cf5663e38 LibJS: Add the Object.prototype.__lookup{Getter, Setter}__ methods
These are a part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Idan Horowitz
f98c0ca528 LibJS: Add the Object.prototype.__define{Getter, Setter}__ methods
These are a part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Idan Horowitz
37340aa599 LibJS: Add the Object.prototype.__proto__ native accessor property
This is part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Linus Groh
d1c109be96 LibJS: Fix .length attributes of various native functions
Namely the Proxy revocation, Promise resolving, Promise then/catch
finally, and Promise GetCapabilitiesExecutor functions.
They were all missing an explicit 'Attribute::Configurable' argument
and therefore incorrectly used the default attributes (writable,
enumerable, configurable).
2021-06-17 13:10:06 +01:00
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Gunnar Beutner
0ca5a393d1 SystemServer: Improve error message when execv() fails
Previously perror() would just tell us that the file specified
for execv() doesn't exist.
2021-06-17 11:03:51 +02:00
Idan Horowitz
70697a5999 LibJS: Throw a syntax error when an identifier is a reserved word
From the specification:
It is a Syntax Error if StringValue of IdentifierName is the same
String value as the StringValue of any ReservedWord except for yield
or await.
It is a Syntax Error if this phrase is contained in strict mode code
and the StringValue of IdentifierName is: "implements", "interface",
"let", "package", "private", "protected", "public", "static", or
"yield".
2021-06-17 10:56:11 +02:00
Idan Horowitz
d6df955305 LibJS: Add missing to_property_key exception check in ClassExpression 2021-06-17 10:56:11 +02:00
Luke
9cbd90fdb6 LibJS: Add BigInt64Array and BigUint64Array
This fixes ~297 test262 test cases :^)
2021-06-17 02:20:03 +01:00
Luke
411c72da27 js: Add print_number method and use it to print out TypedArray values
We can't construct Values with u64 and i64.
I tried adding these constructors, but then it refuses to build in
lagom.
2021-06-17 02:20:03 +01:00
Luke
8d90e137a5 LibJS: Fix check for byteOffset instead of byteLength in byteLength test 2021-06-17 02:20:03 +01:00
Luke
9c2eff8859 LibJS: Make TypedArray use numeric_to_raw_bytes and raw_bytes_to_numeric
It was previously writing directly to the underlying buffer instead of
using these methods. This has a benefit of dealing with BigInt64 and
BigUint64 for us already.
2021-06-17 02:20:03 +01:00
Luke
80edf6f5b6 LibJS: Refactor numeric_to_raw_bytes and raw_bytes_to_numeric
This is to make use of the new Value conversion methods.
This also moves the clamped u8 tag to ArrayBuffer from TypedArray and
the conversion to these methods, as the spec does it here.
2021-06-17 02:20:03 +01:00
Luke
7ff144d533 LibJS: Add a bunch of numeric conversions to Value
Namely:
- BigInt64
- BigUint64
- i16
- u16
- i8
- u8
- Clamped u8

These will be used in ArrayBuffer::numeric_to_raw_bytes later.
2021-06-17 02:20:03 +01:00
sin-ack
aa91284485 Userland: Allow multiple files to be run by js
js only accepted a single script file to run before this.  With this
patch, multiple scripts can be run in the same execution environment,
allowing the user to specify a "preamble script" to be executed before
the main script.
2021-06-17 00:07:04 +02:00
Idan Horowitz
b9d9187feb LibJS: Automatically & lazily coerce PropertyNames into numbers
This commit expands on 5eef07d232 by
automatically trying to coerce Type::String PropertyNames into numbers
when a caller checks if the PropertyName is_number/is_string.
This has several benefits:
 - We no longer have to duplicate the number coercion code to every
   function that accepts a PropertyNumber. (Or more likely, forget to.)
 - This keeps the lazy nature of only doing the coercion when and if
   there is a semantic difference to the different PropertyName types,
   which means this shouldnt cause any performance drop.
 - Since this coercion changes the state of the PropertyName itself the
   result is essentially cached and can speed up any repeat uses of the
   same PropertyName instance.
2021-06-16 22:54:48 +01:00
Idan Horowitz
623eadb44e LibJS: Stop overwriting existing indexed accessors in define_accessor
The previous implementation only checked the shape, ignoring existing
accessors when using number property names.
2021-06-16 22:54:48 +01:00
Idan Horowitz
6352a33ed2 LibJS: Respect Object::get's without_side_effects parameter for numbers 2021-06-16 22:54:48 +01:00
Linus Groh
317b88a8c3 LibJS: Replace Object's create_empty() with create() taking a prototype
This now matches the spec's OrdinaryObjectCreate() across the board:
instead of implicitly setting the created object's prototype to
%Object.prototype% and then in many cases setting it to a nullptr right
away, it now has an 'Object* prototype' parameter with _no default
value_. This makes the code easier to compare with the spec, very clear
in terms of what prototype is being used as well as avoiding unnecessary
shape transitions.

Also fixes a couple of cases were we weren't setting the correct
prototype.

There's no reason to assume that the object would not be empty (as in
having own properties), so let's follow our existing pattern of
Type::create(...) and simply call it 'create'.
2021-06-16 22:49:04 +01:00
Linus Groh
7489189645 LibJS/Tests: Use Object.prototype.toString() for values in test details
Using String() like we did before depends on objects having either
toString, valueOf, or  @@toPrimitive, which is not the case for objects
with no prototype.
2021-06-16 22:49:04 +01:00
Ali Mohammad Pur
66e5e74374 Spreadsheet: Remove the offset used for exception TextRanges
After yet another rewrite of how GUI::TextEditor interprets text ranges
this was broken yet again :P
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
0c9a505ad1 Spreadsheet: Remove 'return (...)' workaround in conditional formatting
Now that LibJS can evaluate expressions correctly, that workaround was
breaking conditional formatting.
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
16b4a78072 Spreadsheet: Do not cancel drag-select when moving over a cell corner
Fixes #4277.
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
a01358f015 Spreadsheet: Correctly resolve nonstandard column names 2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
b11b3c2f1c Spreadsheet: Make the XSV parser start with a preview parse
Instead of parsing the whole document. That's really wasteful and
super slow.
2021-06-17 01:08:27 +04:30
Andreas Kling
88b168ff16 WindowServer: Simplify WindowFrame shadow logic a little bit
Remove the confusingly-named inflate_for_shadow() function and inline
its logic into render_to_cache(). And remove the m_shadow_offset
member variable since it was only needed locally in one place.

Also improve some variable names to make it more understandable what
is going on.
2021-06-16 21:53:10 +02:00
Andreas Kling
20fb30d857 LibGfx: Add a bunch of [[nodiscard]] to Point 2021-06-16 21:53:10 +02:00
Andreas Kling
df0248b096 LibGfx: Convert Point to east-const style 2021-06-16 21:53:10 +02:00
Andreas Kling
243dfb3bdc LibGfx: Add a bunch of [[nodiscard]] to Size 2021-06-16 21:53:10 +02:00
Andreas Kling
bd9096c97d LibGfx: Convert Size to east-const style 2021-06-16 21:53:10 +02:00
Andreas Kling
3f57037ee7 LibGfx: Convert Rect to east-const style 2021-06-16 21:53:10 +02:00
Andreas Kling
316fb6cf31 LibGfx: Add a bunch of [[nodiscard]] to Gfx::Rect 2021-06-16 21:53:10 +02:00
Andreas Kling
d924d93fa2 WindowServer: Fix unnecessary local variable shadowing in WindowFrame 2021-06-16 21:53:10 +02:00
Aatos Majava
a49a15cabf PixelPaint: Set the image title when creating a new image 2021-06-16 21:27:05 +02:00
Idan Horowitz
25a292f534 LibJS: Add the String.prototype.search method
This is only the String.prototype side of search, for full
functionality Symbol.search has to be implemented in our RegExp
built-in object.
2021-06-16 20:05:18 +01:00
Idan Horowitz
bad2108d3c LibJS: Add the String.prototype.matchAll method
This is only the String.prototype side of matchAll, for full
functionality Symbol.matchAll has to be implemented in our RegExp
built-in object.
2021-06-16 20:05:18 +01:00
Idan Horowitz
8e05b49089 LibJS: Add the String.prototype.codePointAt() method
This commit also brings charAt & charCodeAt closer to the specification
2021-06-16 20:05:18 +01:00
Idan Horowitz
9f71e3cab4 LibJS: Handle UTF whitespace characters in String's trim{,Start,End}
This helps a bit, but doesnt handle UTF-16 surrogates in the strings.
2021-06-16 20:05:18 +01:00
Gunnar Beutner
8393e737b7 LibC: Make sure the definition for struct timeval is available
Ideally we'd have a separate header with just struct timeval and include
that (i.e. in a way similar to how macOS, FreeBSD and glibc do this).
2021-06-16 20:08:13 +02:00
Gunnar Beutner
f589acaac9 AudioServer: Put the m_zero_filled_buffer variable into the .bss segment
This way we don't have to allocate this at runtime. I'm intentionally
not using static constexpr here because that would put the variable
into the .rodata segment and would therefore increase the binary by
4kB.

The old code also failed to free() the buffer in the destructor, however
that wasn't much of an issue because the Mixer object exists throughout
the program's entire lifetime.
2021-06-16 20:07:37 +02:00
Timon Kruiper
3e73cfc08c Help: When opening a page, make sure it is selected in the tree view
This has to be called with a `deferred_invoke`, since on startup the
tree view contains no data yet.
2021-06-16 16:30:54 +04:30
Timon Kruiper
a5ecac5494 Help: Make sure the home page is actually shown when opening the app
Previously `open_page` was called multiple times when opening the
application, once for the actual page, but also in
`tree_view.on_selection_change`. At startup there is no valid selection
yet, which caused an empty page to be loaded. Prevent this by early
returning if the `path` is null.
2021-06-16 16:30:54 +04:30
sin-ack
74d76528d6 LibRegex: Display correct position for Compare in REGEX_DEBUG
When REGEX_DEBUG is enabled, LibRegex dumps a table of information
regarding the state of the regex bytecode execution. The Compare opcode
manipulates state.string_position directly, so the string_position value
cannot be used to display where the comparison started; therefore, this
patch introduces a new variable to keep track of where we were before
the comparison happened.
2021-06-16 16:30:12 +04:30
sin-ack
6b2e264093 LibRegex: Fix incorrect case-sensitive comparisons
A tiny typo was introduced in bc8d16ad which caused all case insensitive
comparisons to fail.
2021-06-16 16:30:12 +04:30
Idan Horowitz
9127d83927 LibJS: Rename Value::{is_integer => is_integral_number}
The implementation matches the specification, so lets match the name
as well. :^)
2021-06-16 12:57:55 +01:00
Idan Horowitz
07992c8da6 LibJS: Throw when delete-ing a non-configurable property in strict mode 2021-06-16 12:57:48 +01:00
Idan Horowitz
c619ad4fec LibJS: Allow no-op define property calls on non-configurable objects
This brings us slightly closer to the specification's 10.1.6.3
ValidateAndApplyPropertyDescriptor.
2021-06-16 12:57:48 +01:00
Andreas Kling
0c8dce60a2 PixelPaint: Don't open new images in background tabs
When opening/creating a new image, let's make it the foreground tab.
2021-06-16 12:12:39 +02:00
Andreas Kling
abc40af809 PixelPaint: Make images keep track of their path & title
The title is either "Untitled" (default), or the basename of the
image after we've opened or saved it.
2021-06-16 12:12:39 +02:00
Andreas Kling
35456f035c PixelPaint: Make ImageEditor::image() return a reference (Image&)
In the new tabbed world, every ImageEditor always has an associated
Image, so this simplifies a bunch of things. :^)
2021-06-16 12:12:39 +02:00
Andreas Kling
c6dd3377ee PixelPaint: Make the main UI tabbed and allow multiple open images :^)
This patch adds a GUI::TabWidget to the main UI and allows having
multiple images open at the same time.

Some of the changes here are a bit hackish and mechanical and there's
still code around that needs more work to fit better in the new world.

One nice side-effect of this change is that ImageEditor now always
has one Image associated with it, and it never changes.
2021-06-16 12:12:39 +02:00
Andreas Kling
8763492e34 PixelPaint: Make main window a little bit taller by default 2021-06-16 12:12:39 +02:00
Idan Horowitz
2299be474b LibJS: Add the String.fromCodePoint() method 2021-06-16 10:29:10 +01:00
Apoorv Mishra
89855d0b8c HexEditor: Use Yes/No/Cancel prompts for message boxes
Use Yes/No/Cancel prompts in message box for saving changes
on closing a file with unsaved changes.

Fixes #7169
2021-06-16 10:52:23 +02:00
Brian Gianforcaro
6c114ecaef LibCpp: Remove InlineLinkedList from the list of known types 2021-06-16 10:40:01 +02:00
Brian Gianforcaro
8063ca881d Shell: Remove unused InlineLinkedList header include 2021-06-16 10:40:01 +02:00
Brian Gianforcaro
8f1e7c5a72 WindowServer: Remove unused AK::InlineLinkedList header includes 2021-06-16 10:40:01 +02:00
stelar7
63b1296821 LibCore: Allow TCPServer to be blocking 2021-06-16 09:10:48 +02:00
Idan Horowitz
e1b0719435 LibJS: Add all of the FinalizationRegistry.prototype methods
More specifically: cleanupSome, register & unregister.

FinalizationRegistery.prototype.cleanupSome is actually still a stage 2
proposal, but since test262 test cases already exist for it, i decided
to go for it :)
2021-06-15 23:59:21 +01:00
Idan Horowitz
de9fa6622a LibJS: Add the FinalizationRegistry built-in object
As well as the needed functionality in VM to enqueue and run cleanup
jobs for the FinalizationRegistry instances.
2021-06-15 23:59:21 +01:00
Idan Horowitz
8c7fe8d6c8 AK: Add support for removing SinglyLinkedList nodes during iteration
This commit also fixes the now-broken usage of SinglyLinkedList::remove
in the Piano application.
2021-06-15 23:59:21 +01:00
Idan Horowitz
08ff148bc3 LibJS: Use OrderedHashTable instead of HashTable in the Set built-in
This ensures insertion-order iteration.
2021-06-15 23:51:20 +01:00
Idan Horowitz
a27fbfd45f LibJS: Use OrderedHashMap instead of HashMap in the Map built-in
This ensures insertion-order iteration.
2021-06-15 23:51:20 +01:00
Valtteri Koskivuori
c69ea44397 Userland: Teach the file utility that empty files also exist
Previously, empty files with no identifiable file type extension would
show up as `text/plain`. This fixes it up to show empty files as what
they really are - full of nothing.
2021-06-15 21:30:55 +02:00
Ali Mohammad Pur
1414c7b049 LibJS: Add a basic pass manager and add some basic passes
This commit adds a bunch of passes, the most interesting of which is a
pass that merges blocks together, and a pass that places blocks that
flow into each other next to each other, and a very simply pass that
removes duplicate basic blocks.
Note that this does not remove the jump at the end of each block in that
pass to avoid scope creep in the passes.
2021-06-15 22:06:33 +04:30
Ali Mohammad Pur
e81fd7106b LibJS: Rename the overridden Instruction methods to foo_impl
These are pretty hairy if someone forgets to override one, as the
catchall function in Instruction will keep calling itself over and over
again, leading to really hard-to-debug situations.
2021-06-15 22:06:33 +04:30