Commit Graph

6196 Commits

Author SHA1 Message Date
Tom
0fcb048448 WindowServer: Rename Window::outer_stack -> Window::window_stack
Also, make it return a reference as aside from only three special
situations (creating, destroying, and moving a window between stacks)
a window should always be on a window stack. Any access during those
brief situations would be a bug, so we should VERIFY this.
2021-07-03 12:27:23 +02:00
Tom
6ec35c91bc WindowServer: Improve occlusion calculations
This solves two problems:
* A window was sometimes deemed occluded when the window rect was
  entirely covered by other rectangles, transparent or opaque. This
  caused a window to stop rendering even if a small portion was still
  visible, e.g. when it was merely covered by a window shadow.
* The window switcher is interested in window updates even when a
  window is entirely covered by another one, or when it is on another
  desktop. This forces windows to be not occluded in those cases.
2021-07-03 12:27:23 +02:00
Tom
c06e765a5a WindowServer: Show window's desktop in window switcher if needed
If there are windows on more than one desktop then the window switcher
should show on which one they are located.
2021-07-03 12:27:23 +02:00
Tom
cc707270ae Taskbar: Only show the current desktop's window buttons
By tracking what virtual desktop a window is on, and what desktop is
being viewed we can show or hide the window buttons accordingly.
2021-07-03 12:27:23 +02:00
Tom
5acee4b4d0 DisplaySettings: Add new Desktop tab with virtual desktop settings
This allows the user to configure the virtual desktop setup as desired.
2021-07-03 12:27:23 +02:00
Tom
6472ee0eff WindowServer: Support two window switcher modes: all or current desktop
When using the Super+Tab hotkey then all windows will be displayed,
and we will switch to another virtual desktop if needed.

When using the Alt+Tab hotkey then only the windows on the current
desktop will be displayed.
2021-07-03 12:27:23 +02:00
Tom
7984c2836d WindowServer: Add API to change virtual desktop settings
This also adds the ability to query how many virtual desktops are
set up, and for the Taskbar to be notified when the active virtual
desktop has changed.
2021-07-03 12:27:23 +02:00
Tom
584b144953 WindowServer: Add basic virtual desktop support
This creates a 2-dimensional array of WindowStack instances, one for
each virtual desktop. The main desktop 0,0 is the main desktop, which
is the desktop used for all stationary windows (e.g. taskbar, desktop).
When adding windows to a desktop, stationary windows are always added
to the main desktop.

When composing the desktop, there are usually two WindowStacks
involved. For stationary windows, the main desktop will be traversed,
and for everything else the current virtual desktop will be iterated.
Iteration is interweaved to preserve the correct order. During the
transition animation, two WindowStacks will be iterated at the same
time.
2021-07-03 12:27:23 +02:00
Timothy
944e5cfb35 Everywhere: Use IPC include syntax
Remove superfluous includes from IPCCompiler's generated output and
add include directives in IPC definitions where appropriate.
2021-07-03 12:16:00 +02:00
Timothy
83fb97c301 IPCCompiler: Add include parsing for endpoints
This will find all lines at the start of the file beginning with # and
copy them straight through.
2021-07-03 12:16:00 +02:00
Noah Rosamilia
2feaf59ab2 3DFileViewer: Add primitive mouse controls 2021-07-03 04:02:52 +02:00
Andreas Kling
e8430cf0d3 LibJS: Don't allow delete super.property
This should throw a ReferenceError, since `delete` is not allowed
on super references.
2021-07-03 01:30:30 +02:00
Andreas Kling
1270df257b LibJS: Bring the super keyword in line with the spec
This patch implements spec-compliant runtime semantics for the following
constructs:

- super.property
- super[property]

The MakeSuperPropertyReference AO is added to support this. :^)
2021-07-03 01:12:12 +02:00
Daniel Bertalan
b9f30c6f2a Everywhere: Fix some alignment issues
When creating uninitialized storage for variables, we need to make sure
that the alignment is correct. Fixes a KUBSAN failure when running
kernels compiled with Clang.

In `Syscalls/socket.cpp`, we can simply use local variables, as
`sockaddr_un` is a POD type.

Along with moving the `alignas` specifier to the correct member,
`AK::Optional`'s internal buffer has been made non-zeroed by default.
GCC emitted bogus uninitialized memory access warnings, so we now use
`__builtin_launder` to tell the compiler that we know what we are doing.
This might disable some optimizations, but judging by how GCC failed to
notice that the memory's initialization is dependent on `m_has_value`,
I'm not sure that's a bad thing.
2021-07-03 01:56:31 +04:30
Daniel Bertalan
842249aff5 LibC: Don't use C++ attribute syntax in C-visible headers
Fixes errors when building Clang's compiler-rt, which compiles in C11
more.
2021-07-03 01:56:31 +04:30
Andreas Kling
fd43d1e205 LibJS: Improve ResolveBinding + add GetIdentifierReference
ResolveBinding now matches the spec, while the non-conforming parts
are moved to GetIdentifierReference.

Implementing this properly requires variable bindings.
2021-07-02 22:22:21 +02:00
Max Wipfli
9cc35d1ba3 AK: Implement String::find_any_of() and StringView::find_any_of()
This implements StringUtils::find_any_of() and uses it in
String::find_any_of() and StringView::find_any_of(). All uses of
find_{first,last}_of have been replaced with find_any_of(), find() or
find_last(). find_{first,last}_of have subsequently been removed.
2021-07-02 21:54:21 +02:00
Max Wipfli
3bdaed501e AK+Everywhere: Remove StringView::find_{first,last}_of(char) methods
This removes StringView::find_first_of(char) and find_last_of(char) and
replaces all its usages with find and find_last respectively. This is
because those two methods are functionally equivalent.
find_{first,last}_of should only be used if searching for multiple
different characters, which is never the case with the char argument.

This also adds the [[nodiscard]] to the remaining find_{first,last}_of
methods.
2021-07-02 21:54:21 +02:00
Andreas Kling
5ce9305c5f LibJS: Implement the PrepareForOrdinaryCall abstract operation
This is used by VM::call_internal() and VM::construct() which roughly
map to function objects' [[Call]] and [[Construct]] slots in the spec.

Reorganizing this code revealed something weird: NativeFunction gets
its strictness by checking VM::in_strict_mode(). In other words,
it inherits the strict flag from the caller context. This is quite
weird, but many test-js tests rely on it, so let's preserve it until
we can think of something nicer.
2021-07-02 21:44:08 +02:00
Hediadyoin1
f4072a5038 LibM: Add long double defines of Math Constants 2021-07-02 19:50:43 +02:00
Hendiadyoin1
c74d7adac6 LibM: Implement path for negative powers 2021-07-02 19:50:43 +02:00
Andreas Kling
71fc7ac7ac LibJS: Make SuperCall a proper AST node and clean up evaluation 2021-07-02 19:39:09 +02:00
Andreas Kling
d81f4d5228 LibJS: NewExpression doesn't need compute_this_and_callee()
Now that NewExpression is separated from CallExpression, it doesn't
have to use the ad-hoc compute_this_and_callee() logic.
2021-07-02 18:43:25 +02:00
Andreas Kling
814549b846 LibJS: Split out NewExpression evaluation from CallExpression
This patch adds an override for NewExpression::execute() in the AST
interpreter to separate the logic from CallExpression. As a result,
both evaluation functions are simplified.

Both expressions are still largely non-conforming, but this makes
it easier to work on improving that since we can now deal with them
separately. :^)
2021-07-02 18:25:32 +02:00
Andreas Kling
bad1acf137 LibJS: Break out ArgumentListEvaluation AO from CallExpression 2021-07-02 17:54:34 +02:00
Marcus Nilsson
05e8bea736 PixelPaint: Reset layer widgets when closing last tab
When closing the last tab the layer list widget and layer properties
widget did not reset since they still had a pointer to the image.
2021-07-02 17:54:01 +02:00
Marcus Nilsson
54d4df668a PixelPaint: Add layer to image before setting properties
Previously when opening an image with layers that had properties like
visibility set, PixelPaint would crash when trying to trigger
layer_did_modify_properties() without in image. Avoid this by
adding the layer to the image before setting the properties.
2021-07-02 17:54:01 +02:00
Spencer Dixon
48731e9f17 LibThreading: Add new detach() API to Thread
Sometimes you don't care about `joining()` the result of a thread. The
underlying pthread implementation already existed for detaching and
now we expose it to the higher level API.
2021-07-02 17:52:45 +02:00
Idan Horowitz
f8f3ff65fe LibJS: Bring %TypedArray%.prototype.set slightly closer to spec
Specifically, instead of using the internal {get, put}_by_index methods
we now use the GetValueFromBuffer and SetValueInBuffer abstract
operations, as required by the specification.

While i was here i also replaced a couple custom detached array buffer
error messages with the existing ErrorType::DetachedArrayBuffer.
2021-07-02 15:53:51 +01:00
Spencer Dixon
e6f0b2d817 Assistant: Add a new FileProvider to assist in searching the filesystem
When searching in Assistant, we now dispatch some background jobs to
query the whole filesystem. Activating a result will use the Desktop
launcher's default way of opening that file or directory.
2021-07-02 16:47:14 +02:00
Spencer Dixon
00f93b2545 LibThreading: Add ability to cancel ongoing BackgroundActions
Handlers of the BackgroundAction are responsible for checking if the
action has been cancelled and returning early.
2021-07-02 16:47:14 +02:00
Spencer Dixon
4a3958c8ae Assistant: Remove Result::Kind in favor of native typeid
I was unaware of the `typeid` construct in C++ which can be used to
achieve the same thing I was doing with this extra Kind enum.
2021-07-02 16:47:14 +02:00
Ali Mohammad Pur
ccbc54358d LibJS: Allow patterns in parenthesized arrow function parameters 2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
2e00731ddb LibJS: Allow 'yield' and 'await' as function expression names
The spec says so, and test262 checks for this too.
2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
a6fe27423a LibJS: Allow binding patterns as for in/of targets 2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
bd9f28bba6 LibJS: Allow 'yield' as a variable name outside of generator functions 2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
0292ad33eb LibJS: Make a slash after a curly close mean not-division
There's no grammar rule that allows this.
2021-07-02 14:59:03 +02:00
Ali Mohammad Pur
46ef333e9c LibJS: Parse generator functions in class expressions too 2021-07-02 14:59:03 +02:00
Spencer Dixon
609a0aa75d Assistant: Change to home directory when spawning applications
When launching Terminal via Taskbar we change to the users home
directory. For consistency, let's also `chdir` to `/home/anon` when
launching apps via Assistant's AppProvider.
2021-07-02 14:16:56 +02:00
Tom
26e9140ea1 WindowServer: Fix redrawing menu window that already existed
This fixes redrawing a menu where the window menu is reused at a
different location or with different content.
2021-07-02 13:12:29 +02:00
Brian Gianforcaro
179d8f6815 LibELF: Use StringView literal to avoid string allocations 2021-07-02 10:51:20 +04:30
Brian Gianforcaro
1498dcd9e1 DynamicLoader: Use string view literal to remove a allocation on startup
The ""sv operator switches a const char* to String conversion into
just a StringView literal.
2021-07-02 10:51:20 +04:30
Ali Mohammad Pur
b538e15548 LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails
instead of just "too bad, something went wrong".
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
62ca81fdcc LibJS: Implement the %TypedArray%.set() function 2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
321db0159e LibWeb: Add the WebAssembly.Module constructor 2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
8acc8339d1 LibWeb: Add the WebAssembly.Instance constructor 2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
de4cbc8f08 LibWeb: Use the correct name to refer to WebAssembly.Memory.prototype
Otherwise `instanceof` wouldn't return the correct result.
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
bfb3d9e9d0 LibWeb: Split the WebAssemblyInstance object logic into multiple files
Now that we're adding a constructor to it, let's split it up like the
rest of LibWeb does.
2021-07-02 04:53:01 +04:30
Andreas Kling
a4897ed7b2 LibJS: Throw on failed PutValue into an environment reference
This should really be handled at a different layer of the stack, but
this allows us to make progress on the Object rewrite without breaking
strict mode assignment tests.
2021-07-02 00:32:23 +02:00
Andreas Kling
80170887db LibJS: Make Environment::put_into_environment() return a success bool
This code is non-conforming and will eventually get cleaned out once
we implement proper variable bindings. However, this will aid us in
improving other parts of the code right now.
2021-07-02 00:26:31 +02:00
Andreas Kling
57db058652 LibJS: Make ResolveBinding() produce strict References in strict mode 2021-07-02 00:25:52 +02:00
Timothy Flynn
1bbf3f1d09 LibWeb: Do not encode "internal_id" in DOM JSON
This is now unused.
2021-07-01 19:19:46 +02:00
Timothy Flynn
447ecc2155 LibWeb: Maintain a map of child-to-parent nodes in OOPWV DOM Inspector
Currently, each time parent_index() is invoked, two depth-first searches
are incurred to find the node's parent and grandparent. This becomes
particularly expensive, for example, when trying to scroll through a
large <ul> list.

Instead, upon creation, traverse the DOM JSON and create a map of child
nodes to their parent. Then those two lookups become hash map lookups
rather than a DFS traversal.
2021-07-01 19:19:46 +02:00
Timothy
efcfc8ef7f InspectorServer: Use LocalSocket method to get pid 2021-07-01 17:49:18 +02:00
Timothy
972e5d7292 LibCore: Add peer pid retrieval for LocalSocket
This will allow programs connected over unix sockets to retrieve the
pid of their peers in a nice way.
2021-07-01 17:49:18 +02:00
Andreas Kling
c52ea3dad5 LibJS: Try to fix Clang build (NewClass::m_class_expression is unused) 2021-07-01 17:46:45 +02:00
Johan Dahlin
f6028c2534 LibJS: NewClass bytecode instruction
This adds a the NewClass bytecode instruction, enough of it
is implemented for it to show it in the bytecode (js -d).
2021-07-01 17:34:05 +02:00
Gunnar Beutner
092ee955aa DynamicLoader: Remove obsolete comment 2021-07-01 17:22:22 +02:00
Gunnar Beutner
16b9a2d2e1 Kernel+LibPthread: Add support for usermode threads on x86_64 2021-07-01 17:22:22 +02:00
Gunnar Beutner
93c741018e Kernel+LibPthread: Remove m_ prefix for public members 2021-07-01 17:22:22 +02:00
Idan Horowitz
648b4c7d74 LibJS: Bring JSON.parse slightly closer to the specification
This PR does not fix the main issue with our current implementation:
The specification requires that we first check the JSON string for
validity with an ECMA-404 compliant parser, and then evaluate it as if
it was javascript code, of which we do neither at the moment.
2021-07-01 14:14:41 +01:00
Sam Atkins
f5e63f785a FileManager: Remove clicked breadcrumbs for non-existing directories
This fixes #8204.

In the case that we just navigated up from a directory because it was
deleted, we can detect that easily by checking if the child directory
exists, and then remove the relevant breadcrumbs immediately.

However, it's harder to notice if a child directory for a breadcrumb
is deleted at another time. Previously, clicking that breadcrumb would
crash, but now we check to see if the directory it points to actually
exists. If it doesn't, we pop that breadcrumb and any after it, off
of the breadcrumbbar.

This may not be the ideal solution - maybe it should detect that the
directory is gone automatically - but it works and doesn't involve
managing additional directory watchers.
2021-07-01 17:15:26 +04:30
Sam Atkins
d8e0535116 LibGUI: Add search/removal methods to Breadcrumbbar
Both are used by FileManager in the next commit.

find_segment_with_data() was previously a single-use lambda in
FileManager, but making it a method of Breadcrumbbar means we can
re-use it more easily.
2021-07-01 17:15:26 +04:30
Sam Atkins
17615641db LibGUI: Navigate to parent when FileSystemModel directory is deleted
Previously, FileSystemModel would not notice if the directory it has
open (or a parent one) was deleted. Now, it scans for the closest
existing parent directory and opens that.

Also, deleted files and directories that are children of the open dir
now correctly refresh their parent node instead of their own node.
2021-07-01 17:15:26 +04:30
Andreas Kling
0fa141d058 LibJS: Move Binding struct into the DeclarativeEnvironment class
Nobody on the outside needs to access this.
2021-07-01 12:31:39 +02:00
Andreas Kling
44221756ab LibJS: Drop "Record" suffix from all the *Environment record classes
"Records" in the spec are basically C++ classes, so let's drop this
mouthful of a suffix.
2021-07-01 12:28:57 +02:00
Andreas Kling
56d25d7210 LibWeb: Show "x86_64" in the user agent string on x86_64 :^) 2021-07-01 12:15:52 +02:00
Andreas Kling
33260ea99b LibC: Fix jmp_buf layout on x86_64
This struct was too small on x86_64, but setjmp() would happily write
past the end of it.

This makes `test-js` run to completion on x86_64 :^)
2021-07-01 12:05:59 +02:00
Idan Horowitz
8d50cf492e LibJS: Bring JSON.stringify closer to the specification 2021-07-01 11:44:37 +02:00
Gal Horowitz
3872c31b08 LibCrypto: Replace incorrect operator in SignedBigInteger::bitwise_and 2021-07-01 11:37:16 +02:00
Gal Horowitz
38e9e35380 LibCrypto: Replace use of negate() in SignedBigInteger::bitwise_or
Calling negate() on a big integer does not make it negative, but
rather flips its sign, so this was not actually acting as an OR.
2021-07-01 11:37:16 +02:00
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