Commit Graph

22436 Commits

Author SHA1 Message Date
Timothy Flynn
1a2053781f FlappyBug: Persist high score to disk
Previously, the high score was only in-memory, so only persisted for as
long as the FlappyBug window was open.
2021-06-22 23:05:10 +02:00
Timothy Flynn
25c53e35e7 FlappyBug: Convert the main game widget to a GUI::Frame 2021-06-22 23:05:10 +02:00
Gunnar Beutner
928364e102 TextEditor: Don't open files when the user cancelled saving changes
Steps to reproduce:

1. Start TextEditor and make some changes to the document.
2. Try to open an existing file.
3. When prompted choose to save the changes to the existing document.
4. Close the file picker by clicking 'Cancel'.
5. Note how the file was opened anyway and your changes were lost.

Same applies to the 'New File' action.
2021-06-22 22:56:22 +02:00
Gunnar Beutner
92fdc5bd69 Playground: Prompt to save changes after the user picked a file to open
There's no point in saving the file - and potentially having to ask the
user for a file name - if the user abandons the 'Open' action by
clicking 'Cancel' in the file picker. This now also matches TextEditor's
behavior.
2021-06-22 22:56:22 +02:00
Gunnar Beutner
c2ae25967a Playground: Add a menu action to save the file
There was already 'Save As' and now we also have 'Save'.
2021-06-22 22:56:22 +02:00
Gunnar Beutner
de84b3fa1c Playground: Ask to save changes even when the document was never saved
This makes sure to ask the user whether they want to save changes to
their current document when opening a file even if the document has
never been saved before.
2021-06-22 22:56:22 +02:00
PAUL007
3d42297ecd Taskbar: Check if executable in .af exist in filesystem
This adds access X_OK check in discover_apps_and_categories()
to see executable specified in .af files exist before
registering them for start menu.
2021-06-22 22:48:32 +02:00
Andreas Kling
8a3c9d9851 LibJS: Remove direct argument loading since it was buggy
The parser doesn't always track lexical scopes correctly, so let's not
rely on that for direct argument loading.

This reverts the LoadArguments bytecode instruction as well. We can
bring these things back when the parser can reliably tell us that
a given Identifier is indeed a function argument.
2021-06-22 22:20:17 +02:00
Andreas Kling
1082e99e08 LibJS: Make GlobalEnvironmentRecord forward to the right function
This was accidentally deleting a property from the object record object
itself, rather than from the object record.

It's quite confusing that Environment Records are objects, but moving
away from that will require some large changes.
2021-06-22 22:18:23 +02:00
davidot
f7e2994f35 LibJS: Make string to integer parsing for properties more strict
This does break two TypedArray test262 test but those really were not
  correct because hasProperty was not implemented
2021-06-22 20:49:28 +01:00
davidot
105e72cdad LibJS: Add HasProperty to TypedArray 2021-06-22 20:49:28 +01:00
davidot
f102b56345 LibJS: Fix this_value in native setters and getters
This fixes getting values from double proxies:
var p = new Proxy(new Proxy([], {}), {});
p.length
2021-06-22 20:49:28 +01:00
davidot
9d1fd403af LibJS: Fix small issues in Array.prototype.concat 2021-06-22 20:49:28 +01:00
davidot
91de1135a5 LibJS: Fix a number of regressions in the test262 tests
In get_own_properties:
Entries which are deleted while iterating need to be skipped

In PropertyDescriptor::from_dictionary
If the getter/setter is undefined it should still mark it as present
2021-06-22 20:49:28 +01:00
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
49340f98f7 LibSQL: Create databases in writable directory 2021-06-22 18:54:40 +04:30
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
coderdreams
9ffb3e7e30 LibCore: Add unit test for File::read_line 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
Sam Atkins
ab7023dbe5 Kernel: Ensure Ext2FSInode's lookup is populated before using it
This fixes #8133.

Ext2FSInode::remove_child() searches the lookup cache, so if it's not
initialized, removing the child fails. If the child was a directory,
this led to it being corrupted and having 0 children.

I also added populate_lookup_cache to add_child. I hadn't seen any
bugs there, but if the cache wasn't populated before, adding that
one entry would make it think it was populated, so that would cause
bugs later.
2021-06-22 11:01:59 +02: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
Sahan Fernando
bd5b1d1413 Kernel: Use fewer supervisor pages in VirtIOQueues 2021-06-22 10:58:36 +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
Brian Gianforcaro
e9b4a0a830
Meta: Disable USB IDs file download in CI
These IDs aren't used during the CI build, so there's no use in
downloading them needlessly.
2021-06-21 21:52:57 +01: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