Commit Graph

5899 Commits

Author SHA1 Message Date
Idan Horowitz
1d94d7a367 LibJS: Make Array.of(...items) generic
As well as bring it generally closer to the specification.
2021-06-29 16:03:21 +01:00
Andreas Kling
3ecd1d603f Assistant: Add subtitle field to the Result class
This allows providers to specify an appropriate subtitle instead of
making that something the UI layer has to figure out. :^)
2021-06-29 13:23:51 +02:00
Max Wipfli
9c8a2a5f69 AK+Spreadsheet+LibWeb: Remove JsonObject::get_or()
This removes JsonObject::get_or(), which is inefficient because it has
to copy the returned value. It was only used in a few cases, some of
which resulted in copying JsonObjects, which can become quite large.
2021-06-29 13:18:03 +02:00
Max Wipfli
f45273649f AK+Everywhere: Change int to size_t in JsonObject and JsonArray 2021-06-29 13:18:03 +02:00
Max Wipfli
e0ed160372 AK: Use OrderedHashMap in JsonObject
This changes JsonObject to use the new OrderedHashMap instead of an
extra vector for tracking the insertion order.

This also adds a default value for the KeyTraits template argument in
OrderedHashMap. Furthermore, it fixes two cases where code iterating
over a JsonObject relied on the value argument being copied before
invoking the callback.
2021-06-29 13:18:03 +02:00
Andreas Kling
9179a2ea73 Assistant: Fix crash when activating empty search result
If there are no search results in the list, we shouldn't do anything
when you try to active the selected result, since there isn't one.

Fix this by using an Optional<size_t> to store the selected index.
2021-06-29 13:08:21 +02:00
Andreas Kling
bec2b3086c LibGUI: Don't fire on_change hook at start of TextEditor::paint_event()
If something happens in response to on_change that causes the widget
to get unparented, creating a GUI::Painter will fail since it can't
find the window to paint into.

Since painting only cares about the syntax highlighting spans, what we
really want is to ensure that spans are up-to-date before we start
painting.

The problem was that rehighlighting and the on_change hook were bundled
together in an awkward lazy update mechanism. This patch fixes that by
decoupling rehighlighting and on_change. Rehighlighting is now lazy
and only happens when we handle either paint or mouse events. :^)

Fixes #8302.
2021-06-29 11:22:57 +02:00
Andreas Kling
114e8fffcd LibELF: Don't validate PT_LOAD alignment in ET_CORE files
This was causing CrashDaemon to choke on our coredumps. Note that we
didn't care about the validation failures before this change either,
this patch simply reorders the checks to avoid divide-by-zero when
validating an ET_CORE file.
2021-06-29 10:43:58 +02:00
Diego Garza
c37ad5a1d3 LibC: Add struct keyword to FBRects.rects to make it C compiler safe 2021-06-29 10:04:29 +02:00
Tom
85bb13e081 WindowServer: Fix animations not triggering rendering
When starting the first animation and while animations are ongoing we
need to make sure we trigger rendering.
2021-06-29 10:03:53 +02:00
Andrew Kaster
882002c566 LibSantizer: Read $UBSAN_OPTIONS to set deadliness on first print
The first time we want to print a UBSAN violation, the UBSAN runtime
in userspace will get the UBSAN_OPTIONS environment variable to check if
it contains the string "halt_on_error=1". This is clearly not robust to
invalid options or adding more options, but it gets the job done at the
moment. :^)
2021-06-29 07:17:34 +04:30
Andrew Kaster
97444f0a25 LibCrypto: Avoid unaligned reads in GHash constructor
The fact that this always reads 16 bytes from the input byte stream
for the key data is still a bit on the suspicious side, but at least
it won't crash UBSAN anymore.
2021-06-29 07:17:34 +04:30
Ali Mohammad Pur
3058ff1500 LibHTTP: Relax the finish_up() "must be called once" limitation a bit
It's alright for this function to be called multiple times, as it quits
early when a partial flush doesn't empty the download buffer.
Relax the assertion to having scheduled "did_finish()" only once.
2021-06-29 01:57:16 +04:30
Erik Sommer
b12e5de047 WindowServer: Change animation time to duration
The time interval for animations is most often described as `duration`
in animation contexts and the `WindowServer::Animation` class
should reflect that.
2021-06-28 22:29:39 +02:00
Gunnar Beutner
0cb937416b Meta: Install 64-bit libgcc_s.so for x86_64 targets 2021-06-28 22:29:28 +02:00
Gunnar Beutner
086b7a4537 LibC: Implement memcpy and memset for x86_64 2021-06-28 22:29:28 +02:00
Gunnar Beutner
d4c0d28035 Kernel: Properly set up the userland context for new processes on x86_64 2021-06-28 22:29:28 +02:00
Gunnar Beutner
158355e0d7 Kernel+LibELF: Add support for validating and loading ELF64 executables 2021-06-28 22:29:28 +02:00
Xavier Defrang
04fc7d708c LibVT: Paste full path when dropping file on widget
Prioritize URLs over plain text content in order to
insert absolute path instead of basename
2021-06-29 00:23:40 +04:30
Itamar
ab3aa0759a LanguageServers: Don't VERIFY that set_todo_entries callback exists
The callback may not exist if the CodeComprehensionEngine is running
in the context of tests (i.e CppLanguageServer -t).
2021-06-29 00:07:19 +04:30
Itamar
4123be7639 LibCpp: Update Parser test data after Type=>NamedType change 2021-06-29 00:07:19 +04:30
Itamar
ccb52b005e CppLanguageServer: Make properties_of_type return any property
Previously, CppComprehensionEngine::properties_of_type only returned
variables.
2021-06-29 00:07:19 +04:30
Itamar
d7aa831a43 LibCpp: Differentiate between Type and NamedType
This adds a new ASTNode type called 'NamedType' which inherits from
the Type node.

Previously every Type node had a name field, but it was not logically
accurate. For example, pointer types do not have a name
(the pointed-to type may have one).
2021-06-29 00:07:19 +04:30
Itamar
10cad8a874 LibCpp: Add LOG_SCOPE() macro for debugging the parser's flow
LOG_SCOPE() uses ScopeLogger and additionally shows the current token
in the parser's state.
2021-06-29 00:07:19 +04:30
Itamar
c1ee0c1685 LibCpp: Support parsing enum classes 2021-06-29 00:07:19 +04:30
Linus Groh
5ee753ffaa LibJS/Tests: Fix toBeFalse() details prefix
Copy/paste error from toBeTrue().
2021-06-28 19:16:06 +01:00
Leon Albrecht
57b7f4ec5b
LibJS: Mark FunctionObject::is_ordinary_function() as override 2021-06-28 19:25:35 +02:00
Tom
30f531a55f WindowServer: Fix menu location on screens other than main screen
The menus always thought they were being outside of the main screen,
which caused them to be left and/or top aligned. This also fixes the
calculation of the available space by using the screen rectangle where
it will be displayed.
2021-06-28 17:02:37 +02:00
Andreas Kling
2d4eb40f59 LibJS: Add the CreateMappedArgumentsObject abstract operation
This patch adds a new ArgumentsObject class to represent what the spec
calls "Arguments Exotic Objects"

These are constructed by the new CreateMappedArgumentsObject when the
`arguments` identifier is resolved in a callee context.

The implementation is incomplete and doesn't yet support mapping of
the parameter variables to the indexed properties of `arguments`.
2021-06-28 16:52:20 +02:00
Tom
a55cf08ef9 WindowServer: Fix regression flushing scaled displays
This accidentally was broken by 38af4c29e
2021-06-28 16:40:15 +02:00
Tom
4c8f7113ff WindowServer: Make vertical maximize work on other screens
This doesn't yet restrict rendering to the screen it's being maximized
on.
2021-06-28 16:40:04 +02:00
Marcus Nilsson
beccc7e4fc Utilities/top: Remove unused header includes 2021-06-28 16:38:44 +02:00
Marcus Nilsson
adb80c33ec Utilities/top: Add sort-by and delay-time options
Add optional arguments to top so that the user can choose which field to
sort by and change the update frequency.
2021-06-28 16:38:44 +02:00
Ali Mohammad Pur
55fa2329de LibHTTP: Ensure finish_up() is not called more than once
There's no reason to manually call it on TLS close, the HTTP reading
logic is smart enough to handle connection closes transparently.
Fixes #8211.
2021-06-28 16:35:04 +02:00
Ali Mohammad Pur
2a7cb4fe42 LibTLS: Ensure that on_tls_finished is called only once
Connection state changes when the logical transport is closed should
not trigger tls_finished.
2021-06-28 16:35:04 +02:00
Spencer Dixon
cef2f55a8b Taskbar: Move 'Assistant' Desktop::AppFile to member for quicker access
We care about showing 'Assistant' app as fast as possible when the
hotkey is pressed. In order to do that, we can parse the `.af` file
ahead of time and have it ready to use.
2021-06-28 16:29:02 +02:00
Spencer Dixon
b9d1ef99de Assistant+Taskbar: Use AppFile::spawn() utility 2021-06-28 16:29:02 +02:00
Spencer Dixon
ae20c178b9 LibDesktop: Add spawn() to AppFiles
This adds a convenience utility to AppFiles for quickly launching the
apps backed by the AppFile.
2021-06-28 16:29:02 +02:00
Spencer Dixon
cbe67ed665 Taskbar: Open 'Assistant' with Super+Space 2021-06-28 16:29:02 +02:00
Spencer Dixon
4f11138e8e LibGUI+WindowServer: Add new WMEvent Super+Space
To make Assistant useful we need a way to quickly trigger it. I've
added a new specialized event coming from the window server for when a
user is holding down 'Super' and hits 'Space'.

The Taskbar will be able to listen for this event and spawn a new
instance of the Assistant if it's not already running.
2021-06-28 16:29:02 +02:00
Spencer Dixon
66c13edb98 Userland: Add new app called Assistant
'Assistant' is similar to macOS spotlight where you can quickly open a
text input, start typing, and hit 'enter' to launch apps or open
directories.
2021-06-28 16:29:02 +02:00
Spencer Dixon
d16db6a67c Meta: Tidy up include path and alphabetic ordering 2021-06-28 16:29:02 +02:00
Idan Horowitz
8eb48039c9 LibJS: Bring Reflect.construct() closer to the specification
This includes checking that the target is a constructor, not just a
function, as well as switching the order of the list creation and
argument validation to match the specification, to ensure correct
exception throwing order.
2021-06-28 14:22:35 +01:00
Idan Horowitz
596324ae9c LibJS: Rewrite String.raw() closer to the specification
This includes not throwing a custom exception and using the
length_of_array_like abstract operation where required.
2021-06-28 13:27:13 +01:00
Andreas Kling
d1ffeaf66d LibJS: Use CreateUnmappedArgumentsObject for non-simple parameter lists
This patch implements the IsSimpleParameterList static semantics for
ordinary function objects.

We now also create an unmapped arguments object for callee contexts
with non-simple parameter lists, instead of only doing it in strict
mode. Covered by test262.
2021-06-28 12:18:58 +02:00
Idan Horowitz
e2e695bc9f LibJS: Add and use the %ThrowTypeError% intrinsic 2021-06-28 08:55:14 +01:00
Idan Horowitz
581f20e6f2 LibJS: Accept FlyStrings in the NativeFunction constructors
This makes the implicit run-time assertion in PropertyName::to_string()
into an explicit compile-time requirement, removes a wasteful FlyString
-> PropertyName -> FlyString construction from NativeFunction::create()
and allows setting the function name to a null string for anonymous
native functions.
2021-06-28 08:55:14 +01:00
Idan Horowitz
a939ffc617 LibJS: Handle values close to -0.5 correctly in Math.round(x)
This is done by just using the built-in ceiling and subtracting from
the result if its in the 0.5 range.
2021-06-28 01:19:11 +01:00
Andreas Kling
9eed7444de LibJS: Implement the CreateUnmappedArgumentsObject abstract operation 2021-06-28 02:00:46 +02:00
Linus Groh
63a1275378 LibJS/Tests: Improve valueToString() output
This regressed recently and would only output a bunch of '[object Foo]',
the reason being that String(value) failed in some cases - which is
easily fixed by trying that first and using Object.prototype.toString()
as a fallback in the case of an exception :^)
2021-06-27 22:17:05 +01:00