Commit Graph

6175 Commits

Author SHA1 Message Date
Andreas Kling
3f5c9d3edb CrashReporter: Fix bogus register alignment on x86_64 2021-07-01 11:35:52 +02:00
Idan Horowitz
e37f96ccfe LibJS: Stop coercing this to object in Function's Symbol.hasInstance 2021-07-01 11:35:16 +02:00
Idan Horowitz
6ef56f79bd LibJS: Stop coercing Date.prototype[Symbol.toPrimitive] hint to string 2021-07-01 09:55:50 +01:00
Idan Horowitz
9295f1936c LibELF: Check for missing PT_LOAD alignment header value
This ensures we dont divide by zero when checking for valid alignment
values.
2021-07-01 10:50:49 +02:00
Gunnar Beutner
f9a8c6f053 LibELF: Implement support for RELA relocations 2021-07-01 10:50:00 +02:00
Gunnar Beutner
1f93ffcd72 LibELF: Simplify ELF load address calculations
These were unnecessarily complicated.
2021-07-01 10:50:00 +02:00
Gunnar Beutner
2dbd3f83c1 LibELF: Fix incorrect error message 2021-07-01 10:50:00 +02:00
Idan Horowitz
7a1a91d7f2 LibJS: Check for DataView in ArrayBuffer.isView() 2021-07-01 09:20:00 +01:00
DoubleNegation
e992658c12 DisplaySettings: Adjust FontSettings.gml to work with dark themes
The FontSettings widget now uses background_role instead of
background_color to ensure that it displays properly independently of
the active system theme.
2021-07-01 00:10:25 +02:00
DoubleNegation
d19edb0762 LibGUI: Add foreground_role and background_role property to GUI::Widget
These properties allow GML files to specify a Gfx::ColorRole instead of
a color, so that the effective color of the Widget is resolved using the
system theme.
2021-07-01 00:10:25 +02:00
Idan Horowitz
dfed8f61cb LibJS: Use the GetFunctionRealm abstract-op in ArraySpeciesCreate 2021-06-30 18:41:32 +01:00
Idan Horowitz
c254e4cf10 LibJS: Get the prototype of a new String from the constructor's realm 2021-06-30 18:41:32 +01:00
Idan Horowitz
5606332ed7 LibJS: Add a [[Realm]] getter to FunctionObject and use it where needed
Defined by https://tc39.es/ecma262/#sec-ordinaryfunctioncreate step #17
and by https://tc39.es/ecma262/#sec-createbuiltinfunction step #6.
2021-06-30 18:41:32 +01:00
Idan Horowitz
38b8fa8f3e LibJS: Ensure shift values in left_shift are modded by 32
This is equivalent to 58d6a2d0192b7860ecb2edb4aa5d36b389213a15 but for
the left shift operation.
2021-06-30 19:06:01 +02:00
Hendiadyoin1
2c2cf90661 Utilities: Fix Build on x86_64 2021-06-30 19:05:51 +02:00
Hendiadyoin1
8e575d2f62 Debugger: Compile on x86_64
This is not guaranteed to work at all
2021-06-30 19:05:51 +02:00
Hendiadyoin1
59eea93d2a Userland: Disable Hackstudio and UE on x86_64 2021-06-30 19:05:51 +02:00
davidot
7a3b057a20 LibJS: Add String.prototype.split using the @@split methods on object 2021-06-30 16:08:00 +01:00
davidot
36668893a6 LibJS: Add String.prototype.indexOf position argument 2021-06-30 16:08:00 +01:00
Olivier De Canniere
a4c1666b71 HeaderView: Fix horizonal section size miscalculation
When calculating the horizonal size of a section in
`HeaderView::visible_section_range()`, the horizonal padding is now
correctly taken into account.

This fixes header missalignment issues in Spreadsheet, SystemMonitor
and maybe also the playlist tab of SoundPlayer

closes #8268
2021-06-30 15:15:25 +02:00
Max Wipfli
c1fbfdc164 LibCoreDump: Change Backtrace debug info cache to member variable
This changes the previously static s_debug_info_cache to a member
variable. This is required so the cache is not kept alive if the
Backtrace object is destroyed.

Previously, the cache object would keep alive MappedFile objects and
other data, resulting in CrashReporter and CrashDaemon using more than
100 MB of memory even after the Backtrace objects have been destroyed
(and the data is thus no longer needed). This was especially the case
when handling crashes from Browser (due to libweb.so and libjs.so).

Due to this change, object_info_for_region has been promoted to a
instance method. It has also been cleaned up somewhat.
2021-06-30 15:15:15 +02:00
Gunnar Beutner
fe2716df21 Kernel: Disable __thread and TLS on x86_64 for now
They're not yet properly supported.
2021-06-30 15:13:30 +02:00
Gunnar Beutner
c0bd2c0691 LibPthread: Remove redundant return statement
The pthread_exit() function doesn't return and is marked as such.
2021-06-30 15:13:30 +02:00
Timothy Flynn
2a6e6c42d2 LibWeb: Define hot DOMTreeJSONModel methods in-line 2021-06-30 15:13:18 +02:00
Timothy Flynn
067f7ae60a LibWeb: Store JSON pointers in the OOPWV DOM Inspector model indices
Currently, the DOM Inspector stores a numeric ID for each DOM node. This
is used to look up the data for that node in the JSON representation of
the DOM. The method to do this search performs a depth-first search
through the JSON value, and is invoked quite frequently.

Instead, we can just store a pointer to the JSON value in the index, and
avoid this search altogether. This is similar to how the IPWV stores a
pointer to the DOM node.
2021-06-30 15:13:18 +02:00
Timothy Flynn
7604c2f38e LibWeb: Do not create copies of JSON values in OOPWV DOM Inspector
To improve the performance of the DOM Inspector when the Browser is run
in multi-process mode, do not create copies of the JSON values sent via
IPC when searching for a model index. Methods that are guaranteed to
return a value now return a reference. Methods that do not have such a
guarantee return a pointer (rather than an Optional, because Optional
cannot hold references).

The DOM Inspector performs well at first, but will start lagging again
once the tree is expanded a few nodes deep and/or with many nodes
visible in the tree.
2021-06-30 15:13:18 +02:00
Idan Horowitz
7d055dd039 LibJS: Optimize & Bring String.prototype.repeat closer to the spec
Specifically, we immediately return an empty string when `this` is an
empty string, instead of wasting time in a loop doing nothing N times.
2021-06-30 14:01:25 +01:00
Idan Horowitz
5f09d78b9d LibJS: Bring the Array constructor slightly closer to the specification
Specifically, we now cast to a u32 instead of an i32, as well as use
the validity check required by the specification. The current
constructor is still quite far from the specification, as we directly
set the indexed properties' length instead of going through the Array's
overriden DefineOwnProperty. (and as a result the checks imposed by the
ArraySetLength abstract operation)
2021-06-30 12:35:24 +01:00
Andreas Kling
80cf8bb27c Assistant: Use static_cast instead of dynamic_cast
When the type is guaranteed to be known, there's no need to use RTTI.
2021-06-30 11:44:52 +02:00
Andreas Kling
6c630437e9 Assistant: Don't add a subtitle label widget if we don't need it 2021-06-30 11:44:34 +02:00
Andreas Kling
65db56cd9f LibKeyboard: Remove an unnecessary #include when building with KERNEL 2021-06-30 11:30:28 +02:00
Andreas Kling
050db0cc33 run-tests: Update for LexicalPath API changes 2021-06-30 11:19:21 +02:00
Max Wipfli
d8be530397 AK+Everywhere: Remove "null state" of LexicalPath
This removes the default constructor of LexicalPath, and subsequently
modifies all its users to accommodate the change.
2021-06-30 11:13:54 +02:00
Max Wipfli
7405536a1a AK+Everywhere: Use mostly StringView in LexicalPath
This changes the m_parts, m_dirname, m_basename, m_title and m_extension
member variables to StringViews onto the m_string String. It also
removes the m_is_absolute member in favour of computing if a path is
absolute in the is_absolute() getter. Due to this, the canonicalize()
method has been completely rewritten.

The parts() getter still returns a Vector<String>, although it is no
longer a const reference as m_parts is no longer a Vector<String>.
Rather, it is constructed from the StringViews in m_parts upon request.
The parts_view() getter has been added, which returns Vector<StringView>
const&. Most previous users of parts() have been changed to use
parts_view(), except where Strings are required.

Due to this change, it's is now no longer allow to create temporary
LexicalPath objects to call the dirname, basename, title, or extension
getters on them because the returned StringViews will point to possible
freed memory.
2021-06-30 11:13:54 +02:00
Max Wipfli
fc6d051dfd AK+Everywhere: Add and use static APIs for LexicalPath
The LexicalPath instance methods dirname(), basename(), title() and
extension() will be changed to return StringView const& in a further
commit. Due to this, users creating temporary LexicalPath objects just
to call one of those getters will recieve a StringView const& pointing
to a possible freed buffer.

To avoid this, static methods for those APIs have been added, which will
return a String by value to avoid those problems. All cases where
temporary LexicalPath objects have been used as described above haven
been changed to use the static APIs.
2021-06-30 11:13:54 +02:00
Max Wipfli
9b8f35259c AK: Remove the LexicalPath::is_valid() API
Since this is always set to true on the non-default constructor and
subsequently never modified, it is somewhat pointless. Furthermore,
there are arguably no invalid relative paths.
2021-06-30 11:13:54 +02:00
Max Wipfli
9f0ce2dc81 LibGUI: Add PasswordBox
This patch adds a PasswordBox. At the moment, it's simply a TextBox with
it's substitution code point set to '*', and the undo and redo actions
disabled.
2021-06-30 11:12:25 +02:00
Max Wipfli
de67d86696 LibGUI: Add glyph substitution to TextEditor
This patch adds the member variable m_substitution_code_point to
GUI::TextEditor. If non-zero, all gylphs to be drawn will be substituted
with the specified code point. This is mainly needed to support a
PasswordBox.

While the primary use-case is for single-line editors, multi-line
editors are also supported.

To prevent repeated String construction, a m_substitution_string_data
members has been added, which is an OwnPtr<Vector<u32>>. This is used as
a UTF-32 string builder. The substitution_code_point_view method uses
that Vector to provide a Utf32View of the specified length.
2021-06-30 11:12:25 +02:00
Max Wipfli
37961bf7cb LibGUI: Fix double-clicking words in syntax-highlighted text
This patch fixes a bug where double-clicking on a word in a TextEditor
with syntax highlighting would also select an additional character after
the word. This also simplifies the logic for double- and
triple-clicking.
2021-06-30 11:12:25 +02:00
FalseHonesty
988e17ed05 LibVideo: Migrate to east-const style & apply other minor fixes
This patch brings all of LibVideo up to the east-const style in the
project. Additionally, it applies a few fixes from the reviews in #8170
that referred to older LibVideo code.
2021-06-30 11:03:51 +02:00
FalseHonesty
7d4053dde1 LibVideo/VP9: Implement most of block_mode_info methods (6.4.15-6.4.18) 2021-06-30 11:03:51 +02:00
FalseHonesty
42fdaa7f60 LibVideo/VP9: Implement most of inter_frame_mode_info (6.4.11-6.4.14) 2021-06-30 11:03:51 +02:00
FalseHonesty
e687f05b42 LibVideo/VP9: Implement intra_frame_mode_info procedure (6.4.6) 2021-06-30 11:03:51 +02:00
FalseHonesty
cc1a9e3d1c LibVideo/VP9: Add SAFE_CALL macro to help propagate failure state 2021-06-30 11:03:51 +02:00
FalseHonesty
741677b992 LibVideo/VP9: Refactor how TreeParser accesses decoder data
The TreeParser requires information about a lot of the decoder's
current state in order to parse syntax tree elements correctly, so
there has to be some communication between the Decoder and the
TreeParser. Previously, the Decoder would copy its state to the
TreeParser when it changed, however, this was a poor choice. Now,
the TreeParser simply has a reference to its owning Decoder, and
accesses its state directly.
2021-06-30 11:03:51 +02:00
FalseHonesty
375dbad144 LibVideo/VP9: Begin decoding VP9 blocks 2021-06-30 11:03:51 +02:00
FalseHonesty
2ce4155b42 LibVideo/VP9: Successfully parse partition syntax element 2021-06-30 11:03:51 +02:00
FalseHonesty
7ff6315246 LibVideo/VP9: Begin creating a tree parser to parse syntax elements 2021-06-30 11:03:51 +02:00
FalseHonesty
cfd65eafa9 LibVideo/VP9: Begin decoding tiles 2021-06-30 11:03:51 +02:00
FalseHonesty
f9899fc17f LibVideo/VP9: Parse compressed header data
This patch adds compressed header parsing to the VP9 decoder (section
6.4 of the spec). This is the final decoder step before we can start to
decode tiles.
2021-06-30 11:03:51 +02:00
Andrew Kaster
ae4240788c Userland: Unlink file after waiting for child in run-tests
TestProcFs expects to be able to stat its stdout and stderr. The new
ProcFS implemetnation properly forwards the symlinks for
/proc/pid/fd/[1,2] to the temporary file that we had unlinked prior to
spawning the process. However, this makes it so that a normal stat on
the symlink to that file fails (as expected). Move the unlink to after
we've waited on the child, so that we know it won't be trying any funny
business with its stdout/stderr anymore.
2021-06-30 09:39:57 +04:30
Andrew Kaster
cc0a376c95 Base+Utilities: Add run-tests program to run system tests with LibTest
This test program heavily pulls from the JavaScriptTestRunner/test-js,
but with a twist. Instead of loading JavaScript files into the current
process, constructing a JS environment for them, and executing test
suites/tests directly, run-tests posix_spawns each test file.

Test file stdout is written to a temp file, and only dumped to console
if the test fails or the verbose option is passed to the program. Unlike
test-js, times are always printed for every test executed for better
visibility in CI.
2021-06-30 08:18:28 +04:30
Andrew Kaster
601c9e89de Userland+Tests: Split out generic test runner from JS TestRunner
Split out the functionality to gather multiple tests from the filesystem
and run them in turn into Test::TestRunner, and leave the JavaScript
specific test harness logic in Test::JS::TestRunner and friends.
2021-06-30 08:18:28 +04:30
Andrew Kaster
5e8a0c014e LibRegex: Make regex::Regex move-constructible and move-assignable
For some reason the default move constructor and default move-assign
operator were deleted, so we explicitly default them instead.
2021-06-30 08:18:28 +04:30
Andrew Kaster
b15fe2b926 LibCore: Add getter for how many groups exist in a Core::ConfigFile
This can be used by an application to find out if any config sections
were loaded from the file after a reparse.
2021-06-30 08:18:28 +04:30
davidot
fc9cc74555 LibJS: Handle the different realms case in ArraySpeciesCreate 2021-06-29 23:34:06 +01:00
Andreas Kling
384cffaa04 LibWeb: Fix build breakage after merging the oldish DOM inspector PR 2021-06-29 23:11:09 +02:00
Adam Hodgen
1e5e02c70b LibWeb+Browser: Support DOM Inspector for OutOfProcessWebView
This introduces a new DOMTreeJSONModel, which provides the Model for the
InspectorWidget when the Browser is running using the
OutOfProcessWebView.

This Model is constructed with a JSON object received via IPC from the
WebContentServer.
2021-06-29 23:06:48 +02:00
Adam Hodgen
cd6b9613c5 LibWeb+WebContent: Add IPC flow for Inspect DOM Tree
Add `inspect_dom_tree` to WebContentServer and 'did_get_dom_tree' to
WebContentClient.

These two async methods form a request & response for requesting a JSON
representation of the Content's DOM tree.
2021-06-29 23:06:48 +02:00
Adam Hodgen
4affe052b8 LibWeb: Add JSON serialization method to DOM::Node
This method builds a JSON object representing the full state of the
DOM tree.

The JSON that is built will be used for building the DOM Inspector
widget for the OutOfProcessWebView.
2021-06-29 23:06:48 +02:00
Ali Mohammad Pur
f4eab69785 LibHTTP: Finish the request up on TLS connection finish
...unless it has already been done.
Otherwise we'd be spinning in RequestServer waiting for more read
events.
2021-06-30 01:23:25 +04:30
ngc6302h
e2187f2956 SoundPlayer: Don't limit duration inference to WAV files 2021-06-30 00:58:06 +04:30
Ali Mohammad Pur
2665cdf2a1 LibGUI: Don't allocate a scope-local MouseEvent on the heap
This fixes the build by hiding the problem from the compiler, but it's
a useful change in and of itself anyway.
A malloc/free per every mouse event is pretty annoying, especially when
we can actually avoid it.
2021-06-29 21:40:41 +02:00
Liav A
3d89938c4a SystemServer+Meta: Use the new SysFS
We make SystemServer to mount the new SysFS in /sys.
2021-06-29 20:53:59 +02:00
Daniel Bertalan
65b2d3add3 Shell: Don't do null check on NonnullRefPtr<T>
This will cause a problem when `NonnullRefPtr<T>::operator T*` will be
declared as RETURNS_NONNULL. Clang emits a warning for this pointless
null check, which breaks CI.
2021-06-29 22:57:52 +04:30
Gunnar Beutner
2016354c12 Kernel+LibCoreDump: Implement more x86_64 coredump functionality 2021-06-29 20:03:36 +02:00
Gunnar Beutner
d3127efc01 LibELF: Implement PLT relocations for x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner
1d4ae9194e LibC: Fix struct layout for sys_dirent on x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner
5afec84cc2 LibELF: Add stub for R_X86_64_TPOFF64 2021-06-29 20:03:36 +02:00
Gunnar Beutner
811f9d562d LibELF: Make sure the mmap() regions are large enough
Sometimes we'd end up requesting a smaller range for .text and .data
than was actually necessary.
2021-06-29 20:03:36 +02:00
Gunnar Beutner
2eb025b2ea LibELF: Use correct accessor macros on x86_64 for some ELF fields 2021-06-29 20:03:36 +02:00
Gunnar Beutner
c81d959afb LibELF: Implement GNU hash section lookups for x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner
d138424549 DynamicLoader: Implement self relocations for x86_64 2021-06-29 20:03:36 +02:00
Idan Horowitz
3cfe1a8914 LibJS: Support the radix argument in BigInt.prototype.toString 2021-06-29 16:55:54 +01:00
Idan Horowitz
005d75656e LibCrypto: Replace from_base{2,8,10,16}() & to_base10 with from_base(N)
This allows us to support parsing and serializing BigIntegers to and
from any base N (such that 2 <= N <= 36).
2021-06-29 16:55:54 +01:00
Idan Horowitz
12e66de410 LibJS: Check the target function of a bound function in is_constructor
This is not exactly compliant with the specification, but our current
bound function implementation isn't either, so its not currently
possible to implement it the way the specification requires.
2021-06-29 16:03:21 +01:00
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
Andreas Kling
844efde54b LibJS: Unbreak test-js test that depended on function object class name 2021-06-27 22:51:39 +02:00
Andreas Kling
cd53d046b2 LibJS: Fix typo "sweeped" => "swept" everywhere 2021-06-27 22:40:49 +02:00
Andreas Kling
1bd52ce789 LibJS: Stop qualifying AK::Function
Now that JS function objects are JS::FunctionObject, we can stop
qualifying AK::Function and just say "Function" everywhere. Nice. :^)
2021-06-27 22:40:49 +02:00
Andreas Kling
c8270dbe2e LibJS: Rename ScriptFunction => OrdinaryFunctionObject
These are basically what the spec calls "ordinary function objects",
so let's have the name reflect that. :^)
2021-06-27 22:36:04 +02:00
Andreas Kling
ba9d5c4d54 LibJS: Rename Function => FunctionObject 2021-06-27 22:36:04 +02:00
Andrew Kaster
e389ae3c97 LibJS: Ensure shift values in shift_right are modded by 32
The unsigned shift right implementation was already doing this, but
the spec requires a mod32 of rhs before the shift for the signed shift
right implementation as well. Caught by UBSAN and oss-fuzz.
2021-06-27 22:35:37 +02:00
Andrew Kaster
1f2720ce0d LibJS: Avoid undefined static cast of negative values in to_u32
If the value we get after fmod in Value::to_u32 is negative, UBSAN
complains that -N is out of bounds for u32. An extra static cast to i64
makes it stop complaining. An alternative implementation could add 2^32
if the fmod'd value is negative. Caught by UBSAN and oss-fuzz.
2021-06-27 22:35:37 +02:00
Tom
091628202f WindowServer: Un-tile window if resizing warrants it
Since being tiled means we restrict rendering a window to the screen it
is on (so that we don't "bleed" into an adjacent screen), we need to
untile it if the window either can't fit into the screen, or it is
detached from the screen edges.
2021-06-27 22:35:12 +02:00
Linus Groh
d3fc8652c7 LibJS: Add content type check to IntegerIndexedElementSet()
Resolves a FIXME.
2021-06-27 21:01:07 +01:00
Linus Groh
e08702a235 LibJS: Add content type check to InitializeTypedArrayFromTypedArray()
Resolves a FIXME.
2021-06-27 21:01:02 +01:00
Linus Groh
d7750999b3 LibJS: Implement the TypedArray [[ContentType]] internal slot 2021-06-27 21:01:01 +01:00
Linus Groh
93bae37dd9 LibJS: Add 'is detached' check to InitializeTypedArrayFromTypedArray()
Resolves a FIXME.
2021-06-27 21:01:01 +01:00
Linus Groh
48e7fd52e7 LibJS: Make variables in InitializeTypedArrayFromTypedArray() match spec
This makes it easier to follow the code and compare it to the spec.
2021-06-27 21:01:01 +01:00
Linus Groh
abb5a1f05c LibJS: Add missing InitializeTypedArrayFromTypedArray() spec link
Also move the others outside of their functions.
2021-06-27 21:00:57 +01:00
Andreas Kling
67d1b28b97 FileManager: Pass launch origin rects to spawned programs
This makes GUI applications animate their initial window showing up
on screen. :^)
2021-06-27 19:38:11 +02:00
Andreas Kling
6a132d8672 WindowServer+LibGUI: Allow specifying a "launch origin" for new windows
The launch_origin_rect parameter to create_window() specifies where on
screen the window was launched from. It's optional, but if you provide
it, the new window will have a short wireframe animation from the origin
to the initial window frame rect.

GUI::Window looks for the "__libgui_launch_origin_rect" environment
variable. Put your launch origin rect in there with the format
"<x>,<y>,<width>,<height>" and the first GUI::Window shown by the app
will use that as the launch origin rect.

Also it looks pretty neat, although I'm sure we can improve it. :^)
2021-06-27 19:38:11 +02:00
Andreas Kling
75f870a93f WindowServer: Add a more generic mechanism for animations
This patch adds the WindowServer::Animation class, which represents
a simple animation driven by the compositor.

An animation has a length (in milliseconds) and two hooks:

- on_update: called whenever the animation should render something.
- on_stop: called when the animation is finished and/or stopped.

This patch also ports the window minimization animation to this new
mechanism. :^)
2021-06-27 19:38:11 +02:00
Gunnar Beutner
f285241cb8 Kernel: Rename Thread::tss to Thread::regs and add x86_64 support
We're using software context switches so calling this struct tss is
somewhat misleading.
2021-06-27 15:46:42 +02:00
Gunnar Beutner
233ef26e4d Kernel+Userland: Add x86_64 registers to RegisterState/PtraceRegisters 2021-06-27 15:46:42 +02:00
Ali Mohammad Pur
fd72597999 LibWeb: Make ExceptionOr capable of holding all error types in the spec
The WebIDL spec specifies a few "simple" exception types in addition to
the DOMException type, let's support all of those.
This allows functions returning ExceptionOr<T> to throw regular
javascript exceptions (as limited by the webidl spec) by returning a
`DOM::SimpleException { DOM::SimpleExceptionType::T, "error message" }`
which is pretty damn cool :^)
2021-06-27 12:49:49 +01:00
Andreas Kling
dff3439ad0 Profiler: Cache the timeline histograms instead of recomputing on paint
There was an aggressive amount of work happening on every paint. :^)
2021-06-27 12:05:28 +02:00
Tom
a9906cfcd1 WindowServer: Try to auto-add unconfigured framebuffer devices
This will try to auto-add framebuffer devices that haven't been
explicitly configured to the right-hand side.
2021-06-27 09:46:27 +02:00
Tom
38af4c29e6 WindowServer: Coalesce flushing buffers into one ioctl() call
We regularily need to flush many rectangles, so instead of making many
expensive ioctl() calls to the framebuffer driver, collect the
rectangles and only make one call. And if we have too many rectangles
then it may be cheaper to just update the entire region, in which case
we simply convert them all into a union and just flush that one
rectangle instead.
2021-06-27 09:46:27 +02:00
Tom
708f27ca0e WindowServer: Use relative coordinates when flushing screen dirty rects
The framebuffer device expects coordinates relative to itself.
2021-06-27 09:46:27 +02:00
Tom
c12cbb96ce WindowServer: Fix geometry label not updating if it isn't moving
This fixes a regression where the geometry label isn't updating even
though the window geometry had changed because the geometry label's
location isn't changing.
2021-06-27 09:37:07 +02:00
Andreas Kling
f61a9f2dc5 LibJS: Don't extend arguments object to match the parameter count
The `arguments` object should only have the *arguments* as numeric
properties, not the *parameters*.

Given this function:

    function foo(a, b) {
        return arguments.length;
    }

Calling foo() with no arguments now correctly returns 0 instead of 2.
2021-06-27 00:37:07 +02:00
Andreas Kling
beb43f673e AK: Undo bogus Variant::downcast() rename
I accidentally renamed these to verify_cast() when doing the global
AK::downcast() rename.
2021-06-26 21:27:58 +02:00
Linus Groh
337ad6d15c LibJS: Implement the GetMethod() abstract operation as a Value method
This was a standalone function previously (get_method()), but instead of
passing a Value to it, we can just make it a method.

Also add spec step comments and fix the receiver value by using GetV().
2021-06-26 19:24:35 +01:00
Linus Groh
31f5797e89 LibJS: Implement the GetV() abstract operation
Like Get(), but with any value instead of an object - it's calling
ToObject() for us and passes the value to [[Get]]() as the receiver.

This will be used in GetMethod() (and a couple of other places, which
can be updated over time).

I also tried something new here: adding the three steps from the spec as
inline comments :^)
2021-06-26 19:17:28 +01:00
Linus Groh
dbda5a9a4c LibJS: Move install_error_cause() from Object to Error
This is only used by Error and its subclasses, so it doesn't need to be
available to all objects.
2021-06-26 19:06:55 +01:00
davidot
a63cc2c6b9 LibJS: Skip tests which broke with reversion of f102b563
These tests are correct as other engines pass them but are now broken
2021-06-26 18:16:53 +01:00
davidot
83dd0164b2 Revert "LibJS: Fix this_value in native setters and getters"
This reverts commit f102b563
The reverted to behavior is not correct for example with a double proxy
But this change lead to problems with DOMNodes
2021-06-26 18:16:53 +01:00
davidot
19f505d320 LibJS: Fix propagation of setters and getters from prototypes
If we define a property with just a setter/getter (not both) we must:
- take the previous getter/setter if defined on the actual object
- overwrite the other to nullptr if it is from a prototype
2021-06-26 18:16:53 +01:00
davidot
b1441a47b1 LibJS: Allow setting the length of an object with prototype Array
Before this it would always go through the native setter thus
 modifying the array but now you can set length to anything
2021-06-26 18:16:53 +01:00
davidot
b38fb418f8 LibJS: Don't remove non-configurable items in Array when setting length 2021-06-26 18:16:53 +01:00
davidot
c7aaf40a35 LibJS: Make Array.prototype.lastIndexOf slightly more spec compliant 2021-06-26 18:16:53 +01:00
Andreas Kling
9683b10aec LibJS: Make sure this in the global environment is the global object
Fixes regressed with 0f9038b732.
2021-06-26 17:06:36 +02:00
Andreas Kling
49018553d3 LibJS+LibCrypto: Allow '_' as a numeric literal separator :^)
This patch adds support for the NumericLiteralSeparator concept from
the ECMAScript grammar.
2021-06-26 16:30:35 +02:00
Andreas Kling
527c639c1f LibJS: Fix spelling mistake in one of the syntax error descriptions 2021-06-26 16:25:11 +02:00
Luke
a1f3e711c0 LibJS: Add %TypedArray%.prototype.entries 2021-06-26 13:32:53 +01:00
Luke
a6324481e1 LibJS: Add %TypedArray%.prototype.values 2021-06-26 13:32:53 +01:00
Luke
fb43b778ab LibJS: Add %TypedArray%.prototype.keys 2021-06-26 13:32:53 +01:00
Luke
293974c1cb LibJS: Add TypedArray support to ArrayIterator
ArrayIteratorPrototype::next seems to implement CreateArrayIterator,
which is an issue for a separate PR.
2021-06-26 13:32:53 +01:00
Andreas Kling
ee4fc97038 LibJS: Align ObjectEnvironmentRecord member names with the spec
In the spec, object environments have a [[BindingObject]], so let's
call it the same thing in our implementation.
2021-06-26 10:39:16 +02:00
Andreas Kling
0f9038b732 LibJS: Remove unnecessary GlobalObject& member on global environment
We already store the GlobalObject& in a base class, so no need to also
store it in the subclass. :^)
2021-06-26 10:34:55 +02:00
Andreas Kling
6d7d8f3db9 LibJS: Create new object earlier in VM::construct()
Also make use of OrdinaryCreateFromConstructor() instead of setting
the prototype manually.

This fixes 2 function tests in test262. :^)
2021-06-26 00:04:54 +02:00
Linus Groh
a59ba0e21f LibJS: Change PropertyName(i32) => template<Integral T> PropertyName(T)
Negative numeric properties are not a thing (and we even VERIFY()'d this
in the constructor). It still allows using types with a negative range
for now as we have various places using int for example (without
actually needing the negative range, but that's a different story).

u32 is the internal type of `m_number` already, so this now allows us to
leverage the full u32 range for numeric properties.
2021-06-25 22:01:23 +01:00
Linus Groh
f4867572b7 LibJS: Change PropertyName(Symbol*) => PropertyName(Symbol&)
Requires a bunch of find-and-replace updates across LibJS, but
constructing a PropertyName from a nullptr Symbol* should not be
possible - let's enforce this at the compiler level instead of using
VERIFY() (and already dereference Symbol pointers at the call site).
2021-06-25 22:01:23 +01:00
Andreas Kling
d436d6d565 LibJS: Rename ScriptFunction::m_parent_scope => m_environment
This is for the [[Environment]] slot so let's have a matching name. :^)
2021-06-25 21:22:37 +02:00
Andreas Kling
667bba2410 LibJS: Add the Function.[[ThisMode]] field
This is not a behavioral change in itself, just prep work for future
spec-compliance changes.
2021-06-25 21:15:04 +02:00
Andreas Kling
b650d11dd3 LibJS: FunctionEnvironment.[[FunctionObject]] is the *invoked* function
We were setting the wrong [[FunctionObject]] on the environment when
going through ProxyObject and BoundFunction.
2021-06-25 20:38:43 +02:00
Andreas Kling
08d2ea3fac LibJS: Rename the context in Call/Construct ops to "callee context"
This matches what the spec calls them.
2021-06-25 20:38:43 +02:00
Andreas Kling
06787410ad LibJS: Make assertion in BindThisValue mirror the spec exactly :^) 2021-06-25 20:38:43 +02:00
Tom
8cfb4c82f0 WindowServer: Change rendering drag&drop to use the Overlay class
This enables flicker-free rendering.
2021-06-25 20:38:13 +02:00
Tom
84cab29c59 WindowServer: Change window geometry label to use the Overlay class
This enables flicker-free rendering.
2021-06-25 20:38:13 +02:00
Tom
8b26debda1 DisplaySettings: Show screen numbers when showing the Monitors tab
This will be helpful once we allow the user to rearrange the displays.
2021-06-25 20:38:13 +02:00
Tom
41859ad3fe WindowServer: Add an Overlay class for flicker-free overlay rendering
An Overlay is similar to a transparent window, but has less overhead
and does not get rendered within the window stack. Basically, the area
that an Overlay occupies forces transparency rendering for any window
underneath, which allows us to render them flicker-free.

This also adds a new API that allows displaying the screen numbers,
e.g. while the user configures the screen layout in DisplaySettings

Because other things like drag&drop or the window-size label are not
yet converted to use this new mechanism, they will be drawn over the
screen-number currently.
2021-06-25 20:38:13 +02:00
Tom
42cb38b71a WindowServer: Enhance simple shadow function to include optional frame
If the shadow bitmap contains portions of the frame then we need to
slightly tweak the logic dealing with very small width and/or height.
2021-06-25 20:38:13 +02:00
Sahan Fernando
bab6fb76b7 WindowServer: Redraw screen when switching back from tty 2021-06-25 19:26:30 +02:00
Sahan Fernando
974e996d33 Userland: Add FB_FLUSH ioctl for fbdev 2021-06-25 19:26:30 +02:00
Sam Atkins
8e9fb3766d FileManager: Add "Open in New Window" context menu action 2021-06-25 19:19:57 +02:00
Itamar
e16c24bb95 HackStudio: Do not create a new LanguageClient unless needed
Previously, whenever Editor::set_document() was called, we destroyed
the previous LanguageClient instance of the editor and created a new
one.

We now check if the language of the existing LanguageClient matches the
new document, and if so we do not create a new LanguageClient instance.

This fixes an issue where doing "goto definition" would crash
HackStudio. This was probably introduced in 44418cb351.

The crash occurred because when doing "goto definition", we called a
AK::Function callback from the LanguageClient, which internally called
Editor::set_document().

Editor::set_document() destroyed the existing LanguageClient, which
cased a VERIFY in Function::clear() to fail because we were trying to
destroy the AK::Function object while executing inside it.
2021-06-25 18:58:34 +02:00
Itamar
7331b74731 LibGUI: Add TextEditor::has_document() 2021-06-25 18:58:34 +02:00
Itamar
743157348d HackStudio: Add LanguageClient::Language() getter 2021-06-25 18:58:34 +02:00
kleines Filmröllchen
22d7e57955 LibAudio: Implement a basic FLAC loader
This commit adds a loader for the FLAC audio codec, the Free Lossless
Audio codec by the Xiph.Org foundation. LibAudio will automatically
read and parse FLAC files, so users do not need to adjust.

This implementation is bare-bones and needs to be improved upon.
There are many bugs, verbatim subframes and any kind of seeking is
not supported. However, stereo files exported by libavcodec on
highest compression setting seem to work well.
2021-06-25 20:48:14 +04:30
kleines Filmröllchen
184a9e7e67 LibAudio: Make ResampleHelper templated for different sample types
Previously, ResampleHelper was fixed on handling double's, which makes
it unsuitable for the upcoming FLAC loader that needs to resample
integers. For this reason, ResampleHelper is templated to support
theoretically any type of sample, though only the necessary i32 and
double are templated right now.

The ResampleHelper implementations are moved from WavLoader.cpp to
Buffer.cpp.

This also improves some imports in the WavLoader files.
2021-06-25 20:48:14 +04:30
kleines Filmröllchen
488de12ed4 LibAudio: Make LoaderPlugin::error_string return String&
Previously, error_string() returned char* which is bad Serenity style
and caused issues when other error handling methods were tried. As both
WavLoader and (future) FLAC loader store a String internally for the
error message, it makes sense to return a String reference instead.
2021-06-25 20:48:14 +04:30
kleines Filmröllchen
d599a14545 LibAudio: Add the Int32 sample format
The signed 32-bit PCM sample format is required for the FLAC standard.
2021-06-25 20:48:14 +04:30
kleines Filmröllchen
463a645d37 LibCore: Add InputFileStream::seek
As a file is able to seek(), InputFileStreams can delegate the seek()
easily. This allows for seeking to specific locations in the file.
2021-06-25 20:48:14 +04:30
Andreas Kling
57214268dd LibJS: Make sure to always initialize Reference::m_base_value 2021-06-25 17:25:55 +02:00
Andreas Kling
7b28fa99ba LibJS: Rename Reference methods to match the spec
- get -> get_value (GetValue in the spec)
- put -> put_value (PutValue in the spec)

Also add spec links. :^)
2021-06-25 17:20:23 +02:00
Andreas Kling
bce7fdba81 LibJS: Bring Reference records a bit closer to the ECMAScript spec
Our Reference class now has the same fields as the spec:

- Base (a non-nullish value, an environment record, or `unresolvable`)
- Referenced Name (the name of the binding)
- Strict (whether the reference originated in strict mode code)
- ThisValue (if non-empty, the reference represents a `super` keyword)

The main difference from before is that we now resolve the environment
record that a reference interacts with. Previously we simply resolved
to either "local variable" or "global variable".

The associated abstract operations are still largely non-conforming,
since we don't yet implement proper variable bindings. But this patch
should at least fix a handful of test262 cases. :^)

There's one minor regression: some TypeError message strings get
a little worse due to doing a RequireObjectCoercible earlier in the
evaluation of MemberExpression.
2021-06-25 16:58:36 +02:00
Andreas Kling
6e1932e8b2 LibJS: Evaluate this in terms of ResolveThisBinding 2021-06-25 16:58:36 +02:00
Andreas Kling
92ce4ac23f LibJS: Remove outdated FIXME in GetThisEnvironment 2021-06-25 16:58:36 +02:00
Andreas Kling
07acdc7be2 LibJS: Rename VM::get_reference() => resolve_binding()
This function maps to the ResolveBinding operation from the spec,
so let's rename it to match.
2021-06-25 16:58:36 +02:00
Paul Irwin
5eb65286b6 LibWeb: Support :active pseudo-class for hyperlinks, :focus possibly
Adds support for the :active pseudo-class for hyperlinks (<a> tags
only).

Also, since it was very similar to :focus and an element having a
focused state was already implemented, I went ahead and implemented
that pseudo-class too, although I cannot come up with a working
example to validate it.
2021-06-25 01:02:29 +02:00
Aatos Majava
457edaa4d2 Browser: Add alternate shortcut F6 for focusing the location box 2021-06-25 01:01:37 +02:00
Aatos Majava
d50ff2b422 LibGUI: Add alternate shortcut F5 to the "reload" common action 2021-06-25 01:01:37 +02:00
Aatos Majava
601dc8a128 LibGUI: Make Action::shortcut() return const&
Also do the same for Action::alternate_shortcut().
2021-06-25 01:01:37 +02:00
Aatos Majava
b05078b610 LibGUI: Add a new constructor to Action
This constructor allows you to omit the modifier keys.

Instead of doing "{ 0, Key_F5 }" you can now just do "Key_F5"
2021-06-25 01:01:37 +02:00
Aatos Majava
3e6a5af32b LibGUI: Actually use the Action alternate shortcut
This adds the actual functionality to Window and Application.
2021-06-25 01:01:37 +02:00
Aatos Majava
21a193ed5a LibGUI: Add support for an alternate keyboard shortcut in Action
This patch adds the alternate_shortcut member to LibGUI::Action, which
enables one Action to have two keyboard shortcuts.

Note that the string used in menus and tooltips only shows the main
shortcut, which is the same behaviour as in Firefox and Chrome.
2021-06-25 01:01:37 +02:00
Spencer Dixon
5b79d53c89 LibGUI: Add update() when changing widget color or palette 2021-06-24 23:32:38 +02:00
Alexander
a2a3f5228a WindowServer: Scale Mouse movements
This fixes a bug where if the current screen was using scaling, the
mouse would be twice as fast as normal.
2021-06-25 01:49:07 +04:30
Andreas Kling
e59bf87374 Userland: Replace VERIFY(is<T>) with verify_cast<T>
Instead of doing a VERIFY(is<T>(x)) and *then* casting it to T, we can
just do the cast right away with verify_cast<T>. :^)
2021-06-24 21:13:09 +02:00
Andreas Kling
7fef8c5648 LibJS: Protect execution context variable environments from GC
At the moment these environments are always the same as the lexical
ones, so this didn't cause any trouble. Once we start separating them
we have to make sure both environments are protected.
2021-06-24 20:10:31 +02:00
Andreas Kling
ee3a73ddbb AK: Rename downcast<T> => verify_cast<T>
This makes it much clearer what this cast actually does: it will
VERIFY that the thing we're casting is a T (using is<T>()).
2021-06-24 19:57:01 +02:00
Andreas Kling
6215a9c2cb LibJS: Rename ExecutionContext::callee => function
This matches what ECMAScript calls it. Also make it a JS::Function*
instead of a generic Value, since it will always either be a function
object or null.
2021-06-24 19:28:00 +02:00
Andreas Kling
c2ad599783 LibJS: Rename CallFrame => ExecutionContext
This struct represents what the ECMAScript specification calls an
"execution context" so let's use the same terminology. :^)
2021-06-24 19:28:00 +02:00
Ali Mohammad Pur
7c88caf99f LibVT: Only resize the line after all rewrapping is done
Otherwise we would end up inserting empty cells into the wrapped lines.
Fixes #8227.
2021-06-24 18:50:45 +02:00
Daniel Bertalan
2d2747cb15 LibCore+AK: Use proper atomics in Singleton 2021-06-24 17:35:49 +04:30
Daniel Bertalan
e364845456 LibGfx: Don't constexpr functions returning Strings
Since strings don't have a constexpr constructor, these won't have any
effect anyways. Furthermore, this is explicitly disallowed by the
standard, and makes Clang tools freak out.
2021-06-24 17:35:49 +04:30
Daniel Bertalan
f28f00c654 Userland: Disambiguate dependent types
Clang produced an error on these pieces of code without the `typename`
keyword.
2021-06-24 17:35:49 +04:30
Daniel Bertalan
f820917a76 Everywhere: Use nothrow new with adopt_{ref,own}_if_nonnull
This commit converts naked `new`s to `AK::try_make` and `AK::try_create`
wherever possible. If the called constructor is private, this can not be
done, so we instead now use the standard-defined and compiler-agnostic
`new (nothrow)`.
2021-06-24 17:35:49 +04:30
brapru
4c0c4f3102 Utilities: Validate user with Core::Account in userdel
Previously the remove home directory option never actually removed the
user's home directory because it was not properly unveiled. By
validating the user with Core::Account, we can identify the user's home
directory earlier in the program and unveil as necessary.

Additionally, by identifying if the user does not exist much earlier in
the program, this elimates depending on getpwent to validate the user
and creating unneccessary temp files.
2021-06-24 17:33:14 +04:30
Andreas Kling
bc1930e0e0 LibJS: Fix clang-tidy warnings in AST.h
- Add/remove `move()` as suggested.
- Add missing `explicit` on single-parameter constructors.
2021-06-24 13:38:21 +02:00
Andreas Kling
0eeb7f67a7 LibJS: Don't use m_ prefix for argument name in ScriptFunction 2021-06-24 13:29:25 +02:00
Andreas Kling
ce2747692d LibJS: Remove unused DeclarativeEnvironmentRecord::type()
Nothing was using this, and we now have separate classes for the
different types of environment records instead.
2021-06-24 13:28:15 +02:00
Andreas Kling
0cd65b55bd LibJS: Add ObjectEnvironmentRecord.[[IsWithEnvironment]] field
This is true for environments created by `with` statements, and false
for other (global) object environments.

Also add the WithBaseObject abstract operation while we're here.
2021-06-24 13:26:00 +02:00
Jamie Mansfield
3f8857cd21 Games: Add Spider
Scoring is designed to mimic Microsoft's implementation - starting at
500, decreasing by 1 every move, and increasing by 100 for every full
stack.

Fixes GH-5319.
2021-06-24 10:32:53 +02:00
Jamie Mansfield
b7e806e15e LibCards: Support non-alternating colour patience games
This introduces a new MovementType concept to LibCards, starting the
process to allow other patience games to be implemented using it - that
differ more substantially from Klondike in logic.

This is currently used for two purposes: 1. to verify that the
'grabbed' stack of cards is valid* (sequential and correct colours) and
2. to allow 'grabbed' stacks to be pushed onto same-colour,
either-colour, or alternating-colour stacks

* Klondike doesn't need this logic, as per how the game works any
  'grabbed' selection is guaranteed to be valid.
2021-06-24 10:32:53 +02:00
Gunnar Beutner
1ae7d68885 LibSymbolication: Fix incorrect argument type for symbolicate() 2021-06-24 09:27:13 +02:00
Gunnar Beutner
f2eb759901 Profiler: Use u32 when constructing InstructionData
When constructing values of the InstructionData type we assume that
the event_count field is a size_t while it actually is a u32. On x86_64
this fails because those are different types.
2021-06-24 09:27:13 +02:00
Gunnar Beutner
c9a8dfa1bf Userland: Add more TODO()s for arch-specific code
This enables building more of the userspace applications for x86_64.
2021-06-24 09:27:13 +02:00
Sam Atkins
f2d6cac692
Solitaire: Maybe fix rare crash from completing a game with TAB (#8217)
The crash happens very rarely and is hard to reproduce so it is
hard to know for certain, but I am confident this fixes it.

I previously delayed the start of the game-over animation by one
frame, but neglected to check m_start_game_over_animation_next_frame
wasn't set. This means multiple calls to start_game_over_animation()
on the same frame (or rather, before the first timer_event) would
each call Object::start_timer(). Now that we do check the flag,
that should no longer be possible.

Fixes #8122.
2021-06-24 09:25:01 +02:00
Gunnar Beutner
ac650d2362 Userland: Remove dummy IPC methods
They're not used anywhere and are unnecessary boilerplate code. So let's
remove them and update IPCCompiler to allow for empty endpoint
declarations.
2021-06-24 00:38:58 +02:00
Hendiadyoin1
37253ebcae LibELF: Fix missing include
A few files are expecting that someone brings PAGE_SIZE from possibly
the Kernel with them
2021-06-24 00:38:23 +02:00
Jan de Visser
5c4890411b LibSQL: Make lexer and parser more standard SQL compliant
SQL was standardized before there was consensus on sane language syntax
constructs had evolved. The language is mostly case-insensitive, with
unquoted text converted to upper case. Identifiers can include lower
case characters and other 'special' characters by enclosing the
identifier with double quotes. A double quote is escaped by doubling it.
Likewise, a single quote in a literal string is escaped by doubling it.

All this means that the strategy used in the lexer, where a token's
value is a StringView 'window' on the source string, does not work,
because the value needs to be massaged before being handed to the
parser. Therefore a token now has a String containing its value. Given
the limited lifetime of a token, this is acceptable overhead.

Not doing this means that for example quote removal and double quote
escaping would need to be done in the parser or in AST node
construction, which would spread lexing basically all over the place.
Which would be suboptimal.

There was some impact on the sql utility and SyntaxHighlighter component
which was addressed by storing the token's end position together with
the start position in order to properly highlight it.

Finally, reviewing the tests for parsing numeric literals revealed an
inconsistency in which tokens we accept or reject: `1a` is accepted but
`1e` is rejected. Related to this is the fate of `0x`. Added a FIXME
reminding us to address this.
2021-06-24 00:36:53 +02:00
Jan de Visser
4198f7e1af LibSQL: Move Lexer and Parser machinery to AST directory
The SQL engine is expected to be a fairly sizeable piece of software.
Therefore we're starting to restructure the codebase for growth.
2021-06-24 00:36:53 +02:00
Federico Guerinoni
e0f1c237d2 HackStudio: Make TODO entries clickable
Now you can click a TODO entry to set focus on that position of that
file.
2021-06-23 19:00:11 +01:00
Federico Guerinoni
935c7b2f4b HackStudio: Add TODO entries widget 2021-06-23 19:00:11 +01:00
Federico Guerinoni
26a7356e90 LanguageServers: Add function to collect TODO entries in a document 2021-06-23 19:00:11 +01:00
Federico Guerinoni
c397e030f4 LibCpp: Add function for retrieving TODO comments from the parser
Now `get_todo_entries` collects all TODO found within a comment
statement.
2021-06-23 19:00:11 +01:00
Ali Mohammad Pur
fcef84c461 LibVT: Rewrap the terminal history along with the normal buffer 2021-06-23 19:04:08 +02:00
Ali Mohammad Pur
4bf14715a1 LibLine: Recalculate the origin on resize 2021-06-23 19:04:08 +02:00
Ali Mohammad Pur
2f2b7814d1 LibVT+Terminal: Implement line wrapping
This commit implements line wrapping in the terminal, and tries its best
to move the cursor to the "correct" position.
2021-06-23 19:04:08 +02:00
Ali Mohammad Pur
424965954f LibVT: Keep track of the 'true' line endings 2021-06-23 19:04:08 +02:00
Aatos Majava
3b2a528b33 LibTextCodec: Add Turkish (aka ISO-8859-9, Windows-1254) encoding 2021-06-23 16:32:47 +01:00
Gunnar Beutner
21ee0ad6fc LibVT: Don't crash when clicking outside of the terminal's buffer area
When resizing a terminal window the number of columns may change.
Previously we assumed that this also affects lines which were in the
terminal's buffer while that is not necessarily true.
2021-06-23 16:26:40 +02:00
Linus Groh
c503a28e19 LibJS: Make AggregateError inherit from Error
This is our way of implementing the [[ErrorData]] internal slot, which
is being used in Object.prototype.toString().
2021-06-23 13:59:17 +01:00
Linus Groh
0e8cbfb7b5 LibJS: Fix AggregateError's class_name() 2021-06-23 13:55:43 +01:00
Andreas Kling
15faa13c95 LibJS: Add spec links to a bunch of the environment record methods 2021-06-23 13:25:57 +02:00
Andreas Kling
cf34313fad LibJS: Remove no-longer-needed environment record shape
We had a cached shape for environment records to make instantiating
them fast. Now that environment records don't inherit from JS::Object,
we can just get rid of this. :^)
2021-06-23 13:08:40 +02:00
Andreas Kling
9ccc2f6c4d LibJS: Make EnvironmentRecord inherit directly from Cell
Previously, EnvironmentRecord was a JS::Object. This was done because
GlobalObject inherited from EnvironmentRecord. Now that this is no
longer the case, we can simplify things by making EnvironmentRecord
inherit from Cell directly.

This also removes the need for environment records to have a shape,
which was awkward. This will be removed in the following patch.
2021-06-23 13:08:27 +02:00