Commit graph

16409 commits

Author SHA1 Message Date
Karol Kosek
61dc489778 FileManager: Reduce scope of some variables related to context menu 2022-05-07 20:14:23 +02:00
Karol Kosek
4ef8bf53ba FileManager: Don't use bitwise OR operators on booleans 2022-05-07 20:14:23 +02:00
Karol Kosek
ec02d58b5b FileManager: Rename action_show_dotfiles to show_dotfiles_action
All actions are named that way.
2022-05-07 20:14:23 +02:00
Karol Kosek
ff6df9f27e FileManager: Use VERIFY() instead of if checks with VERIFY_NOT_REACHED
Besides micro simplifying the code, this will also show the failed
condition in the console, instead of vague 'ASSERTION FAILED: false'.
2022-05-07 20:14:23 +02:00
Rafał Babiarz
6463bc7eb3 Browser: Add option to filter entries in Storage Inspector 2022-05-07 20:09:53 +02:00
Rafał Babiarz
d1e6dcfbc2 LibGUI: Show column names when using FilteringProxyModel with TableView 2022-05-07 20:07:48 +02:00
Karol Kosek
c6bcc0f96e LibGUI: Check if a property is a GML Object in ScrollableContainerWidget
Previously we couldn't set the content widget from GML because it was
looking for a GUI::Object, not a GML::Object.
2022-05-07 20:03:17 +02:00
Tim Schumacher
f8aea2a7e5 Profiler: Use absolute mmap paths as-is 2022-05-07 20:02:00 +02:00
Tim Schumacher
89da0f2da5 LibELF: Name library maps with the full file path 2022-05-07 20:02:00 +02:00
Tim Schumacher
2b7b7f2816 LibELF: Separate library resolving into a new function 2022-05-07 20:02:00 +02:00
Luke Wilde
05748ed607 LibJS: Convert Console to use MarkedVector<Value>
Using a Vector<Value> is unsafe as GC cannot see the stored values.
This is then vended to outside users of ConsoleClient, e.g. LibWeb and
WebContent, which is then outside of LibJS's control.

An example issue is if the client stores it for later use and forgets
to visit the stored values, meaning they can be destroyed at any time.
We can save the client from this by vending a MarkedVector<Value> to
them.
2022-05-07 01:22:09 +02:00
Liav A
b69c8b48fc WindowServer: Separate physical resolution from scaling factors
Physical hardware doesn't care about scale factors as this is a concept
being related to WindowServer and userland applications. To ensure we
provide the correct display resolution details to HardwareScreenBackend
objects, we must keep a separate Gfx::IntRect object that reserve the
correct details.
2022-05-06 23:38:08 +02:00
Linus Groh
f7c9bd0760 LibJS: Convert remaining Date AOs using JS::Value as in/output to double
There was an awful lot of JS::Value <-> double conversion going on, even
through these AOs only work with number values anyway.
They don't need a global object either as they won't allocate or throw,
that was simply to pass it to infallible calls of ToIntegerOrInfinity.
2022-05-06 22:32:47 +02:00
Linus Groh
b9b3d01bea LibJS: Add variant of to_integer_or_infinity() for plain doubles
In many cases we already know a certain value is a number, or don't have
JS values at all and would need to wrap doubles in a value. To optimize
these cases and avoid having to pass a global object into functions that
won't ever allocate or throw, add a standalone implementation of this
function that takes and returns doubles directly.
2022-05-06 22:32:47 +02:00
Linus Groh
875e59b740 LibJS: Remove unused LibCore/DateTime.h header from Date.cpp
We use a double for [[DateValue]] and the spec's own AOs for any
calculations now.
2022-05-06 22:32:47 +02:00
Linus Groh
4dd9102f5e LibJS: Move Hours/Minutes/Seconds/ms constants out of the Date class
They can remain in this header, but will be used outside the Date
context in Temporal.
2022-05-06 22:32:47 +02:00
Liav A
659b0d7fb4 WindowServer: Remove hack to restore graphics after switch from console
This hack is not necessary anymore, because WindowServer will try
constantly to write the framebuffer contents to the display connector
devices. After a switch from console mode to graphical mode, the write
syscall on these devices will not be silently ignored but will actually
write to the framebuffer screen.
2022-05-06 18:05:14 +02:00
DexesTTP
530aa51816 LibWeb: Remove a superfluous verify_cast on SVGGraphicsPaintable
Since the layout_box of a SVGGraphicsPaintable is already casted to the
right type, the underlying dom_node was also always of the right type.
This triggers a warning on Lagom builds.
2022-05-06 14:11:03 +02:00
DexesTTP
1af7bfb3a6 LibWeb: Remove unneeded iteration filter on LiveNodeList
Since all items of the subtree are Nodes, the "of type" condition was
always true. This triggers a warning on Lagom builds.
2022-05-06 14:11:03 +02:00
DexesTTP
56d018f6b5 LibWeb: Remove unneeded .gitignore
This was changed a while ago so the generated files are placed in the
Build directory. Let's remove the gitignore file so any old version of
the files stop conflicting with the new generated versions.
2022-05-06 14:11:03 +02:00
DexesTTP
6027ab9e12 LibWeb: Only generate ResourceLoader signposts while on Serenity 2022-05-06 14:11:03 +02:00
DexesTTP
9e5480bcb5 LibWeb: Remove unneeded LibGUI include in Window.cpp 2022-05-06 14:11:03 +02:00
MacDue
bf30348f88 Browser: Remove STL utility include from CookiesModel
This broke clang builds
2022-05-06 13:11:09 +02:00
Liav A
fb7d9186b2 SystemServer: Boot to text mode if there are no device nodes at /dev/gpu
Otherwise, WindowServer will simply crash and fail due to no hardware to
utilize.
2022-05-06 12:28:19 +02:00
Liav A
7ab51b6df2 SystemServer: Remove search of a FramebufferDevice
As the framebuffer devices are gone by now, searching for them makes no
sense, so instead, let's remove this check now. If the user requested to
boot into text mode, he probably knows what he is doing and we should
not try to warn him about this.
2022-05-06 12:28:19 +02:00
IT6uru
00a0b1bd14 BrowserSettings: Add missing code to update filtering checkbox
reset_default_values() now sets default filtering checkbox
state using default_enable_content_filtering.
2022-05-06 11:37:38 +02:00
MacDue
e268659d32 Terminal+TerminalSettings: Allow disabling close confirmations 2022-05-06 02:12:51 +04:30
MacDue
d5b550096e Terminal: Close warnings for background/foreground processes
This implements the "close modified" icon on the terminal,
as well as several close warnings:

- A warning there is a foreground process running
- If there is a background process running
- Or if there are multiple background processes running

Fixes #13751
2022-05-06 02:12:51 +04:30
Linus Groh
88f637a505 js: Print different type for each kind of ECMAScript function object
Instead of just printing 'ECMAScriptFunctionObject' (and leaking an
implementation detail in the process - this is not a public facing name)
let's instead print a different type string for each function kind, and
only keep the old class_name() printing for other JS::FunctionObject
subclasses.
2022-05-05 22:42:10 +02:00
Linus Groh
2ad9641315 js: Implement pretty-printing of generator objects 2022-05-05 22:40:57 +02:00
Linus Groh
53619176f5 LibJS: Set "prototype" property of async generator functions 2022-05-05 22:40:57 +02:00
Linus Groh
09e263dd9c LibJS: Fix "prototype" property of generator functions, again
The change in 3ec0183 wasn't actually correct, the spec tells us to set
the "prototype" property of the function (created with a prototype of
%GeneratorFunction.prototype% itself) to a newly created object:
OrdinaryObjectCreate(%GeneratorFunction.prototype.prototype%)
2022-05-05 22:40:57 +02:00
Linus Groh
dd547c3374 LibJS: Add getters for %{Async,}GeneratorFunction.prototype.prototype%
These exist as {Async,}GeneratorPrototype of course, but the spec
doesn't always refer to them by the direct name.
2022-05-05 22:40:57 +02:00
Linus Groh
0c65624a32 LibJS: Add AsyncGenerator / AsyncGeneratorPrototype
Not implementing any prototype functions yet, but stubbing out async
generator infrastructure will allow us to make some progress in that
direction.
2022-05-05 22:40:57 +02:00
Linus Groh
2c68ec9097 LibJS: Use Object* for 'manual' GlobalObject::foo_prototype() getters
Not doing so only leads to problems down the line, e.g. not being able
to pass them as function pointers to ordinary_create_from_constructor().
2022-05-05 22:40:57 +02:00
networkException
f3f19f8321 Browser: Consolidate StorageWidget tabs into a single gml file
This patch removes the separate CookiesTab.gml file used to define the
layout of the cookies and local storage tabs and moves those defintions
into the StorageWidget.gml file.
2022-05-05 21:57:39 +02:00
Linus Groh
e5196c8e3d WindowServer: Take vertical menu offset into account when adjusting pos
Unconditionally adding the item height offset to the adjusted vertical
position of a menu leads to an incorrect position if we previously
clamped the translation offset so the menu doesn't go off-screen.

Also add some comments to this coordinate math. Always add comments to
coordinate math.
2022-05-05 21:54:53 +02:00
Rafał Babiarz
ac991b0a89 Browser: Set all cookies at once instead adding them separately 2022-05-05 21:54:38 +02:00
Rafał Babiarz
dc66d16dc2 Browser: Rename "on_want_cookies" to match local storage equivalent 2022-05-05 21:54:38 +02:00
Andreas Kling
3a2118cc7d LibGfx: Fix Clang build failulres in VectorN
Clang didn't accept the friend declaration here, as the class has a
requires clause attached to it, and I couldn't immediately figure
out what it wants instead.

Add accessors for VectorN::m_data and use those where needed instead
for now.
2022-05-05 21:46:42 +02:00
Luke Wilde
caf652799f SystemMonitor: Consistently use u64 for ValueFormat::text_formatter
ValueFormat::text_formatter is called with a u64 retrieved from
GraphWidget::m_values. However, the function pointer definition used
size_t and all the users of text_formatter used int.  If bytes was over
~2 billion, we would interpret bytes to be negative. We then pass this
into `human_readable_size` which converts it to a u64, making it out to
be about 15.9 EiB.

This is fixed by making everything in the path take a u64.
2022-05-05 21:25:04 +02:00
Liav A
e301af8352 Everywhere: Purge all support and usage of framebuffer devices
Long live the DisplayConnector object!
2022-05-05 20:55:57 +02:00
Liav A
aad968cc5e Everywhere: Rename fb prefix function names => graphics_connector 2022-05-05 20:55:57 +02:00
Liav A
10adc27eda Everywhere: Rename FB prefix structure names => Graphics 2022-05-05 20:55:57 +02:00
Liav A
d2e93ec50a Everywhere: Rename FB prefix name ioctls => GRAPHICS 2022-05-05 20:55:57 +02:00
Liav A
4ff6150f1b WindowServer: Use FB_IOCTL_FLUSH_HEAD to flush a framebuffer if possible
This ioctl is more appropriate when the hardware supports flushing of
the entire framebuffer, so we use that instead of the previous default
FB_IOCTL_FLUSH_HEAD_BUFFERS ioctl.
2022-05-05 20:55:57 +02:00
Liav A
6d7e2596e0 WindowServer: Implement mechanism to restore safe mode setting
Such mechanism will be used by the Intel Graphics driver, because we
lack support of changing the resolution on this driver currently, so,
when WindowServer will try to mode-set the display then it will fail,
and will use the safe mode-setting call instead to be able to show
something on screen.
2022-05-05 20:55:57 +02:00
Liav A
d9a2706079 DisplaySettings+WindowServer: Add support for display connector devices 2022-05-05 20:55:57 +02:00
Liav A
3a3700f95e LibEDID: Export common structures into a header file
This will be used later in the kernel code to simplify the EDID handling
code.
2022-05-05 20:55:57 +02:00
Liav A
b401f278ad Userland: Re-organize /dev GPU nodes 2022-05-05 20:55:57 +02:00
Liav A
912b8ab965 Kernel/Graphics: Introduce the DisplayConnector class
The DisplayConnector class is meant to replace the FramebufferDevice
class. The advantage of this class over the FramebufferDevice class is:
1. It removes the mmap interface entirely. This interface is unsafe, as
multiple processes could try to use it, and when switching to and from
text console mode, there's no "good" way to revoke a memory mapping from
this interface, let alone when there are multiple processes that call
this interface. Therefore, in the DisplayConnector class there's no
implementation for this method at all.
2. The class uses a new real-world structure called ModeSetting, which
takes into account the fact that real hardware requires more than width,
height and pitch settings to mode-set the display resolution.
3. The class assumes all instances should supply some sort of EDID,
so it facilitates such mechanism to do so. Even if a given driver does
not know what is the actual EDID, it will ask to create default-generic
EDID blob.
3. This class shifts the responsibilies of switching between console
mode and graphical mode from a GraphicsAdapter to the DisplayConnector
class, so when doing the switch, the GraphicsManagement code actually
asks each DisplayConnector object to do the switch and doesn't rely on
the GraphicsAdapter objects at all.
2022-05-05 20:55:57 +02:00
Jelle Raaijmakers
a699e0a9d7 LibSoftGPU: Remove initial fog factor value from Device
This value was always overwritten. No functional changes.
2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
526390ec06 LibSoftGPU: Move back to i32-based subpixels
Our move to floating point precision has eradicated the pixel artifacts
in Quake 1, but introduced new and not so subtle rendering glitches in
games like Tux Racer. This commit changes three things to get the best
of both worlds:

1. Subpixel logic based on `i32` types was reintroduced, the number of
   bits is set to 6. This reintroduces the artifacts in Quake 1 but
   fixes rendering of Tux Racer.

2. Before triangle culling, subpixel coordinates are calculated and
   stored in `Triangle`. These coordinates are rounded, which fixes the
   Quake 1 artifacts. Tux Racer is unaffected.

3. The triangle area (actually parallelogram area) is also stored in
   `Triangle` so we don't need to recalculate it later on. In our
   previous subpixel code, there was a subtle disconnect between the
   two calculations (one with and one without subpixel precision) which
   resulted in triangles incorrectly being culled. This fixes some
   remaining Quake 1 artifacts.
2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
7db68e118c LibGfx: Add Vector::to_rounded<T>() 2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
54108263d6 LibGfx: Add IntVector2/3/4 types
The type `Vector<N, int>` is used often enough that it warrants its own
dedicated type.
2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
f5ea93edfd LibSoftGPU: Remove unused Matrix3x3.h include 2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
e70dc20650 LibSoftGPU: Replace some interpolate() calls with VectorN::dot
The dot product is effectively the same as `interpolate()`, allowing us
to use `VectorN`. No functional changes.
2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
dfb218f6a8 LibSoftGPU: East-const interpolate
No functional changes.
2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
9a1364d784 LibSoftGPU: Use FloatVector4 pixel format for Image
This increases memory usage for textures 4-fold, but allows us to
completely remove calls to `(un)pack_color` in a very hot loop.
2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
6090e79191 LibSoftGPU: Use u64 for Device statistics vars
No functional changes.
2022-05-05 20:50:46 +02:00
Jelle Raaijmakers
365fb36108 LibGL: Split up GLContext implementation into logical units
This allows for faster rebuilds when the implementation changes.
2022-05-05 20:50:14 +02:00
Jelle Raaijmakers
4ace97c550 LibGL: Put the OpenGL API wrapper in a single code unit
We were splitting these API wrappers up into different files without a
quantifiable benefit. Now, it's extremely clear where the direct API
implementation lives. :^)
2022-05-05 20:50:14 +02:00
Undefine
4054c35e9a su: Change the HOME enviroment variable on login 2022-05-05 20:49:18 +02:00
Tim Schumacher
defe7b4ecc LibC: Add IN6_IS_ADDR_MULTICAST 2022-05-05 20:47:38 +02:00
Linus Groh
2fc9481bb6 LibJS: Correct SetMutableBinding fallibility bug in spec comment
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/656f0cf
2022-05-05 09:28:08 +02:00
Karol Kosek
272cf3cbd5 Browser: Set an icon for the 'Edit Bookmark' Dialog 2022-05-04 23:22:10 +02:00
Karol Kosek
ae28e3ff5c LibWeb: Use Unicode data for CSS text-transform property
Previously it was only transforming ASCII characters.
2022-05-04 23:21:34 +02:00
kleines Filmröllchen
ab49fcfb7c LibAudio+Userland: Remove Audio::LegacyBuffer
The file is now renamed to Queue.h, and the Resampler APIs with
LegacyBuffer are also removed. These changes look large because nobody
actually needs Buffer.h (or Queue.h). It was mostly transitive
dependencies on the massive list of includes in that header, which are
now almost all gone. Instead, we include common things like Sample.h
directly, which should give faster compile times as very few files
actually need Queue.h.
2022-05-03 23:09:20 +02:00
kleines Filmröllchen
f14a71eb34 LibAudio: Move WAV sample reading and conversion into own helpers
This completely removes WavLoader's dependency on LegacyBuffer: We
directly create the result sample container and write into it. I took
this opportunity to rewrite most of the sample reading functions as a
single templated function, which combined with the better error handling
makes this "ported" code super concise.
2022-05-03 23:09:20 +02:00
kleines Filmröllchen
a32d675164 LibAudio: Move WavLoader to Core::Stream APIs
This makes the code much more readable and concise, reduces the size of
the WavLoader class itself, moves almost all fallible initialization out
of the constructor and should provide better error handling in general.

Also, a lot of now-unnecessary imports are removed.
2022-05-03 23:09:20 +02:00
kleines Filmröllchen
81a336ea45 LibAudio: Refactor and modernize WavLoader
* All clang-tidy warnings fixed except read_header cognitive complexity
* Use size_t in more places
* Replace #define's with constexpr constants
* Some variable renaming for readability
2022-05-03 23:09:20 +02:00
Linus Groh
50d0f879f7 LibJS: Remove bogus FIXME in ArgumentsObject::internal_get()
Not sure what happened here, but the comment does not match the spec,
and so the FIXME I added is not actually an issue.
2022-05-03 22:51:36 +02:00
Linus Groh
f3768705a9 LibJS: Use consistent phrasing for string length
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/33ea99e
2022-05-03 22:49:31 +02:00
Linus Groh
8b035b80d3 LibJS: Update order of steps in CanonicalNumericIndexString
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/be5db32
2022-05-03 22:49:31 +02:00
Linus Groh
367e7b4fe5 LibJS: Reflect Array.prototype.toLocaleString comment in %TypedArray%
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/2a9ed48
2022-05-03 22:49:31 +02:00
Linus Groh
b9bbf45a81 LibJS: Add assertion (comment) to MakeMatchIndicesIndexPairArray
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/caa6e3f
2022-05-03 22:49:31 +02:00
Linus Groh
ede932287f LibJS: Update spec comments to avoid = comparisons with signed zero
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/b7348e5
2022-05-03 22:49:31 +02:00
Linus Groh
257375f54c LibJS: Update comments for Annex B changes to IsLooselyEqual
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/da3d674
2022-05-03 22:49:31 +02:00
Linus Groh
17fb40bc42 LibJS: Fix type confusion in msFromTime
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/8e572b6
2022-05-03 22:49:31 +02:00
Linus Groh
03e13715ac LibJS: Update two comments saying "completion value"
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/7913cea
2022-05-03 22:49:31 +02:00
Linus Groh
99cc442f5c LibJS: Use more consistent wording for creating empty lists
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/0bf22a9
2022-05-03 22:49:31 +02:00
Linus Groh
438e3ceb4a LibJS: Use CreateDataPropertyOrThrow in MakeMatchIndicesIndexPairArray
This was part of a normative change in the ECMA-262 spec, but didn't get
updated when we implemented that.

See: https://github.com/tc39/ecma262/commit/0209d85
2022-05-03 22:49:31 +02:00
MacDue
44c0672d59 WindowServer: Support hover icons for title buttons
This allows adding "-hover.png" variants of the title button icons.
This can be useful for themes which use the TitleButtonsIconOnly
flag, which otherwise don't have a way of showing the hover state.
2022-05-03 22:00:14 +02:00
Tim Schumacher
dcd76db319 LibC: Hide posix_memalign by default
This should keep ports from preferring `posix_memalign` over other
implementations of aligned memory.
2022-05-03 21:53:19 +02:00
Patrick Meyer
5510b98dc8 DHCPClient: Don't crash if DHCP options contain no gateway
Fixes #13879
2022-05-03 12:37:51 +04:30
Linus Groh
9f3f3b0864 LibJS: Remove implicit wrapping/unwrapping of completion records
This is an editorial change in the ECMA-262 spec, with similar changes
in some proposals.

See:
- https://github.com/tc39/ecma262/commit/7575f74
- https://github.com/tc39/proposal-array-grouping/commit/df899eb
- https://github.com/tc39/proposal-shadowrealm/commit/9eb5a12
- https://github.com/tc39/proposal-shadowrealm/commit/c81f527
2022-05-03 01:09:29 +02:00
Kenneth Myhra
b8de830683 base64: Replace char pointer with StringView 2022-05-02 22:18:27 +02:00
Kenneth Myhra
bd81e15bc9 base64: Use TRY() instead of VERIFY(!result.is_error()) 2022-05-02 22:18:27 +02:00
Kenneth Myhra
ec1f5fd20f base64: Use Core::File standard_input() standard_output() 2022-05-02 22:18:27 +02:00
Patrick Meyer
0bd131ad06 Kernel: Stop requiring working malloc for syscall.h includes
Fixes #13869
2022-05-02 12:44:34 +02:00
cflip
e02579bdab PixelPaint: Set title of default image to 'Untitled' 2022-05-02 12:43:46 +02:00
Andrew Kaster
5120b39d0e Meta+Userland: Add ENABLE_USERSPACE_COVERAGE_COLLECTION CMake option
This option sets -fprofile-instr-generate -fcoverage-mapping for Clang
builds only on almost all of Userland. Loader and LibTimeZone are
exempt. This can be used for generating code coverage reports, or even
PGO in the future.
2022-05-02 01:46:18 +02:00
Andrew Kaster
3c80a4caeb LibM: Remove stale commented out CMake commands 2022-05-02 01:46:18 +02:00
Andrew Kaster
f75edeb9ad DynamicLoader: Remove stale FIXME for removing -nodefaultlibs
The FIXME says "Remove after next toolchain update" and I'm very certain
we've had some :tool: :chain: in the last 7 months.
2022-05-02 01:46:18 +02:00
Andrew Kaster
9b041786ac readelf: Don't error out on invalid interpreter path
This lets us inspect ELF binaries with un-loadable program interpreters,
same as binutils and llvm-readelf.
2022-05-02 01:45:49 +02:00
César Torres
4b0b22d897 LibGfx: Fix typo in Color constructor 2022-05-02 01:45:14 +02:00
Linus Groh
8cbd25f553 LibJS: Simplify Is{Accessor,Data,Generic}Descriptor AOs
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/1c7ae4b
2022-05-01 22:47:38 +02:00
Linus Groh
07ac8b7021 LibJS: Change "Record {}" to "Iterator Record {}" in comments
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/85d910c
2022-05-01 22:47:38 +02:00
Linus Groh
c9bdd59e20 LibJS: Change "Completion {}" to "Completion Record {}" in comments
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/15a7d8a
2022-05-01 22:47:38 +02:00
Linus Groh
719137418d LibJS: Change "as [the] argument[s]" to "with arguments" in comments
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/e671b96
2022-05-01 22:47:38 +02:00
Linus Groh
214d5e3e83 LibJS: Update outdated table reference in BoundFunctionCreate 2022-05-01 22:47:38 +02:00
Linus Groh
7767f9be37 LibJS: Rename some variables from "script body" to "script"
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/38a2584
2022-05-01 22:47:38 +02:00
Linus Groh
acda12597a LibJS: Rename scope to environment
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/3246553
2022-05-01 22:47:38 +02:00
Linus Groh
cb66474fb5 LibJS: Update spec comments testing presence of a field
This is an editorial change in the ECMA-262 spec.

See:
- https://github.com/tc39/ecma262/commit/497f99a
- https://github.com/tc39/ecma262/commit/0b35749
2022-05-01 22:47:38 +02:00
Linus Groh
d33fcad87f LibJS: Update ValidateAndApplyPropertyDescriptor implementation
These are editorial changes in the ECMA-262 spec.

See:
- https://github.com/tc39/ecma262/commit/b9efa97
- https://github.com/tc39/ecma262/commit/6f4ff96
- https://github.com/tc39/ecma262/commit/3d18997
- https://github.com/tc39/ecma262/commit/b3c29fd
2022-05-01 22:47:38 +02:00
Linus Groh
85c16452f9 LibJS: Simplify Array.prototype.splice()
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/193211a
2022-05-01 22:47:38 +02:00
Linus Groh
5a26a547db LibJS: Update a couple of outdated spec comments
These are editorial changes in the ECMA-262 spec.

See:
- https://github.com/tc39/ecma262/commit/e080a7f
- https://github.com/tc39/ecma262/commit/c5a9094
- https://github.com/tc39/ecma262/commit/5091520
- https://github.com/tc39/ecma262/commit/1c6564b
- https://github.com/tc39/ecma262/commit/e06c80c
2022-05-01 22:47:38 +02:00
Linus Groh
ce659e5eeb LibJS: Remove assertions that are now part of structured headers
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/4fde514
2022-05-01 22:13:21 +02:00
Linus Groh
86e3840202 LibJS: Add missing comment in OrdinaryToPrimitive 2022-05-01 22:13:21 +02:00
Maciej
06c90b35ec ifconfig: Stop supporting setting/displaying default gateway
The `route` command allows more sophiscated control over routing tables
now, and supporting this in ifconfig is no longer meaningful.
2022-05-01 13:34:27 +02:00
Daniel Bertalan
bcf124c07d LibC: Implement a faster memset routine for x86-64 in assembly
This commit addresses the following shortcomings of our current, simple
and elegant memset function:
- REP STOSB/STOSQ has considerable startup overhead, it's impractical to
  use for smaller sizes.
- Up until very recently, AMD CPUs didn't have support for "Enhanced REP
  MOVSB/STOSB", so it performed pretty poorly on them.

With this commit applied, I could measure a ~5% decrease in `test-js`'s
runtime when I used qemu's TCG backend. The implementation is based on
the following article from Microsoft:

https://msrc-blog.microsoft.com/2021/01/11/building-faster-amd64-memset-routines

Two versions of the routine are implemented: one that uses the ERMS
extension mentioned above, and one that performs plain SSE stores. The
version appropriate for the CPU is selected at load time using an IFUNC.
2022-05-01 12:42:01 +02:00
Daniel Bertalan
484f70fb43 readelf: Add printing for STT_GNU_IFUNC 2022-05-01 12:42:01 +02:00
Daniel Bertalan
7aca408993 LibELF: Fail gracefully when IFUNC resolver's object has textrels
.text sections of objects that contain textrels have to be writable
during the relocation procedure. Because of this, we would segfault if
we tried to execute IFUNC resolvers defined in them. Let's print a
meaningful error message instead.

Additionally, a warning is now printed when we load objects with
textrels, as in the future, additional security mitigations might
interfere with them being loaded.
2022-05-01 12:42:01 +02:00
Daniel Bertalan
08c459e495 LibELF: Add support for IFUNCs
IFUNC is a GNU extension to the ELF standard that allows a function to
have multiple implementations. A resolver function has to be called at
load time to choose the right one to use. The PLT will contain the entry
to the resolved function, so branching and more indirect jumps can be
avoided at run-time.

This mechanism is usually used when a routine can be made faster using
CPU features that are available in only some models, and a fallback
implementation has to exist for others.

We will use this feature to have two separate memset implementations for
CPUs with and without ERMS (Enhanced REP MOVSB/STOSB) support.
2022-05-01 12:42:01 +02:00
Daniel Bertalan
4d5965bd2c LibELF: Keep track of whether the PLT contains REL or RELA relocations 2022-05-01 12:42:01 +02:00
Daniel Bertalan
ed5f110b40 LibELF: Perform .relr.dyn relocations before .rel.dyn
IFUNC resolvers depend on the resolved function's address having been
relocated by the time they are called. This means that relative
relocations have to be done first.

The linker is kind enough to put R_*_RELATIVE before R_*_IRELATIVE in
.rel.dyn, but .relr.dyn contains relative relocations too.
2022-05-01 12:42:01 +02:00
Andrew Kaster
435a263998 LibELF: Relax restriction on allowed values of EI_OSABI to allow GNU
This check is here to make sure we only try to load serenity binaries.
However, with -fprofile-instr-generate -fcoverage-mapping, clang
sets the EI_OSABI field to 3, for GNU. The instrumentation uses a lot of
retained COMDAT sections for coverage instrumentation that get the
SHF_GNU_RETAINED section header flag set on them, forcing llvm to set
the ABI to GNU.
2022-05-01 12:42:01 +02:00
Idan Horowitz
1a8b5ef80a LibJS: Stop fetching GlobalObject from target's realm in ArrayBuffer
A function object's realm is not necessarily non-null (like when called
via the Reflect API), so we can't blindly dereference it. Instead use
the object's own GlobalObject.
2022-04-30 21:55:39 +02:00
Idan Horowitz
9098257668 LibJS: Reject -00000 as extended year in Date parsing 2022-04-30 21:36:27 +02:00
Idan Horowitz
0399239e3f LibJS: Do not negate zero into negative zero in ToIntegerOrInfinity
When the input value was in the range of [-1, 0] we would incorrectly
negate the resulting integer, resulting in -0 instead of the expected 0
2022-04-30 21:35:16 +02:00
Idan Horowitz
7ac9900023 LibJS: Reorder parsing for TimeSpecWithOptionalTimeZoneNotAmbiguous
Because `TimeHour TimeZoneNumericUTCOffsetNotAmbiguous[opt]
TimeZoneBracketedAnnotation[opt]` can be a subset of
`TimeHourNotValidMonth TimeZone` we would not exhaust the whole input
in some cases, which would result in an incorrectly thrown exception.
2022-04-30 18:36:10 +02:00
brapru
0866a0cd1e Kernel+route: Support global routing table deletion 2022-04-30 16:24:33 +02:00
Tim Schumacher
a212a741df LibC: Add all the POSIX_FADV_* constants 2022-04-30 16:22:40 +02:00
Linus Groh
27793bf76c LibJS: Replace U+2212 MINUS SIGN with U+002D HYPHEN-MINUS
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/bbcd37b
2022-04-29 22:40:46 +02:00
Linus Groh
df1f81ba90 LibJS: Add notes about lifetime of surrounding agent
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/54e4abc
2022-04-29 22:40:46 +02:00
Linus Groh
76a6bd0e75 LibJS: Fix numeric type confusion in GetEpochFromISOParts return value
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/2a59eac
2022-04-29 22:40:46 +02:00
Linus Groh
70593b7448 LibJS: Update for structured headers added to various Temporal AOs
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/e6a15a5
2022-04-29 22:40:46 +02:00
Linus Groh
9a3014c91a LibJS: Drop "integral part of" language
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6ec1608
2022-04-29 22:40:46 +02:00
Linus Groh
cb33320814 LibJS: Fix one more instance of Number value / integer confusion
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/5b1b783
2022-04-29 22:40:46 +02:00
Linus Groh
aac457755d LibJS: Define IsBuiltinCalendar in terms of AvailableCalendars
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/896b72d
2022-04-29 22:40:46 +02:00
Linus Groh
2499911898 LibJS: Rename DateFromFields to CalendarDateFromFields, etc
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fd27b54
2022-04-29 22:40:46 +02:00
Andreas Kling
a7f702a021 LibC: Implement posix_fadvise() (as a harmless no-op) 2022-04-29 22:01:30 +02:00
Andreas Kling
910532b8dc LibC: Add more _POSIX_FOO constants to unistd.h
Let's advertise more of our POSIX capabilities. :^)
2022-04-29 22:01:27 +02:00
Andreas Kling
577b4c73b0 LibC: Add MIN, MAX and howmany macros to sys/param.h 2022-04-29 22:01:27 +02:00
Tim Schumacher
89f9454785 LibC: Actually set the FPU environment instead of its pointer 2022-04-29 22:01:06 +02:00
Linus Groh
7bf4a785c6 LibJS: Fix RoundNumberToIncrement spec number 2022-04-29 21:52:30 +02:00
Sam Atkins
c57410358a ThemeEditor: Show if modified, and prompt before discarding unsaved work 2022-04-29 20:06:39 +02:00
Sam Atkins
eaf24d2fce ThemeEditor: Update displayed alignment when loading a theme file 2022-04-29 20:06:39 +02:00
Sam Atkins
eb76751a76 ThemeEditor: Stop firing unnecessary change callbacks
We only need to fire these callbacks when we want to change the palette.
So, when setting widget values to match a palette that has just been
loaded, or to show the value of the role selected in a ComboBox, we can
skip the callbacks. This saves some work, and means we can reliably use
on_palette_change to know when the palette has actually been modified.
2022-04-29 20:06:39 +02:00
Sam Atkins
6c572006a3 LibGUI+ThemeEditor: Split preview-widget palette-change callback
There are two different things in ThemeEditor that want to know when a
palette changes:
1. The PreviewWidget subclass, so it can update its preview.
2. The ThemeEditor itself, so we know that the palette is modified.

Using a protected virtual function for 1 means that we can do 2 without
them fighting over the same on_palette_change callback.
2022-04-29 20:06:39 +02:00
Sam Atkins
5fd0140772 LibGUI: Add AllowCallback parameter to ColorInput::set_color()
The `TextEditor::on_change` callback now only fires if the user types in
the box, or `set_text()` is called with `AllowCallback::Yes`.
Previously that callback was what set `m_color`, so I've rearranged
things a little so that the color still updates regardless of what
source the color came from.
2022-04-29 20:06:39 +02:00
Sam Atkins
91230ff28d ThemeEditor: Open the FilePicker at the location in the path input
The kernel panic no longer occurs, so we can do this now. :^)
2022-04-29 20:06:39 +02:00
Sam Atkins
e05d5df6aa ThemeEditor: Show a message box if saving fails 2022-04-29 20:06:39 +02:00
Sam Atkins
e15427c5ba ThemeEditor: Propagate failure to create AlignmentModel
Also make the AlignmentValue struct private, and initialize the Vector
in one go instead of empending.
2022-04-29 20:06:39 +02:00
Peter Elliott
12c7b954e1 Kernel+WindowServer: Move setting tty graphical mode to Userspace
This will allow using the console tty and WindowServer regardless of
your kernel command line. Also this fixes a bug where, when booting in
text mode, the console was in graphical mode, and would not accept
input.
2022-04-29 19:52:32 +02:00
Peter Elliott
4b0be17c71 Kernel: Support userspace TTY graphics modesetting
This is a copy of linux's KDSETMODE/KDGETMODE console ioctl(2)
interface.
2022-04-29 19:52:32 +02:00
Linus Groh
bc4a0baa8f LibJS: Remove outdated FIXMEs about required date_from_fields() options
The `options` parameter is no longer required by the function, so we can
stop passing in options as well where not required by the spec.
2022-04-29 19:50:41 +02:00
Jelle Raaijmakers
ae0ca35541 LibAudio: Add a formatter for Audio::Sample
Useful for debugging.
2022-04-29 18:05:42 +02:00
Jelle Raaijmakers
50cf4e6e64 LibCore: Simplify conditional logic in SharedCircularQueue
No functional changes.
2022-04-29 18:05:42 +02:00
Jelle Raaijmakers
581e4dc25b LibAudio: Make includes work from ports
The endpoints were included with a relative path that does not work by
default when compiling ports. Include them from a root-relative path
instead.
2022-04-29 18:05:42 +02:00
Sam Atkins
56e8e0daa1 LibWeb: Remove TokenStream::position() and ::rewind_to_position() 2022-04-29 00:07:31 +02:00
Sam Atkins
2b3185955e LibWeb: Use StateTransaction for UnicodeRange parsing
...and change how the two parsing steps fit together.

The two steps were previously quite muddled. Both worked with the
TokenStream directly, and both were responsible for rewinding that
stream if there was an error. This is both confusing and also made it
impossible to replace the rewinding with StateTransactions.

This commit more clearly divides the work between the two functions: One
parses ComponentValues and produces a string, and the other parses that
string to produce the UnicodeRange. It also replaces manual rewinding
in the former with StateTransactions.
2022-04-29 00:07:31 +02:00
Sam Atkins
dc00657c4f LibWeb: Use StateTransaction in more places 2022-04-29 00:07:31 +02:00
Sam Atkins
f1bb3e5ce5 LibWeb: Use StateTransaction for supports-query parsing 2022-04-29 00:07:31 +02:00
Sam Atkins
dd5927edad LibWeb: Use StateTransaction for media-query parsing
This should be a bit easier to follow.

parse_media_query() no longer rewinds if the media query is invalid,
because it then interprets all the tokens as a "not all" query.
2022-04-29 00:07:31 +02:00
Sam Atkins
28278efafb LibWeb: Extract MediaType to/from_string() logic into functions 2022-04-29 00:07:31 +02:00
Sam Atkins
1f114eaebe LibWeb: Allow whitespace inside An+B again and use StateTransactions
I accidentally broke parsing of internal whitespace (eg `-3n + 7`
instead of `-3n+7`) when implementing `:nth-child(An+B of foo)`.
2022-04-29 00:07:31 +02:00
Sam Atkins
a490f24a2d LibWeb: Add StateTransaction RAII to CSS TokenStream
This is modeled after the one in ISO8601Parser. It rolls back the
TokenStream state automatically at the end of scope unless told to
commit the changes. This should be less error-prone than remembering to
manually call `rewind_to_position()` at the correct time.

For convenience, a StateTransaction can have "child" transactions. When
a transaction is committed, it automatically commits its parents too.
This is useful in situations where you have several nested and don't
want to have to remember to manually `commit()` them all.
2022-04-29 00:07:31 +02:00
Sam Atkins
5c8ff96a94 LibWeb: Move variables in parse_a_n_plus_b_pattern() closer to usage
`a` and `b` had to be declared at the top of the function before since
they were used by the `make_return_value()` lambda. But now that
doesn't exist, we can move them to where they are used - or eliminate
them entirely.
2022-04-29 00:07:31 +02:00
Sam Atkins
f2d6bdce3f LibWeb: Handle trailing tokens outside of parse_a_n_plus_b_pattern()
parse_a_n_plus_b_pattern()'s job is to parse as much of the TokenStream
as it can as a An+B, and then stop. The caller can then deal with any
trailing tokens as it wishes.
2022-04-29 00:07:31 +02:00
Sam Atkins
d6ae08d023 LibWeb: Rename a local variable to not collide with a parameter 2022-04-29 00:07:31 +02:00
Sam Atkins
d784a8aaf0 LibWeb: Replace Result with ErrorOr in CSS Parser
...using a ParseErrorOr type alias.

This lets us replace a bunch of manual error-checking with TRY. :^)

I also replaced the ParsingResult::Done value with returning an
Optional. I wasn't happy with treating "Done" as an error when I first
wrote this, and this makes a clear distinction between the two.
2022-04-29 00:07:31 +02:00
Sam Atkins
761d29d647 LibWeb: Make CSS ParsingContext::m_url not Optional
This always has a value, so let's make that clearer.
2022-04-29 00:07:31 +02:00
huttongrabiel
25970f2763 LibMarkdown: Add strike-through text support to markdown
Using ~~text~~ syntax will strike out the text between the two tildes.

Only missing portion is the terminal rendering of strike through text.
The ansi escape codes for strike through text are \e[9m and \e[29m but
it appears the terminal does not support these. Please correct me if I
am wrong.

I tested that the render_to_terminal function was being called by giving
it bold ANSI escape codes, and that did work so the function is being
called correctly.
2022-04-28 22:15:08 +02:00
MacDue
ac0d708634 ThemeEditor: Add preview window with 'Highlighted' window state
This state has been occasionally missed in themes, adding it
to the preview may help avoid that.
2022-04-28 22:14:18 +02:00
MacDue
332574608c ThemeEditor: Center preview windows accounting for window frame 2022-04-28 22:14:18 +02:00
brapru
19912a0b32 Kernel+Utilities: Add the route utility
This exposes the global routing table in the /proc directory and adds
the userspace utility to query dynamically add from the table.
2022-04-28 08:41:11 -07:00
Jelle Raaijmakers
f8c81b2f01 LibCore: Remove fixed EventLoop FIXME
This was resolved in commit f25123df66.
2022-04-27 22:59:15 +02:00
Tim Schumacher
a87c85f401 unzip: Create parent directory before extracting files 2022-04-27 11:54:57 +02:00
Jelle Raaijmakers
f25123df66 LibCore: Remove main event loop
The main event loop functionality was used in just two places where the
alternative is a bit simpler. Remove it in favor of referencing the
event loop directly, or just invoking `EventLoop::current()`.

Note that we don't need locking in the constructor since we're now only
modifying a thread-local `Vector`. We also don't need locking in the
old call sites to `::with_main_locked()` since we already lock the
event loop in the subsequent `::post_event()` invocation.
2022-04-27 11:54:37 +02:00
Jelle Raaijmakers
9e2a619fdc LibCore: Remove unused EventLoop::is_main_event_loop() 2022-04-27 11:54:37 +02:00
Jelle Raaijmakers
0bf56e6b40 LibCore: Fix typo in EventLoop comment 2022-04-27 11:54:37 +02:00
timre13
14751a4122 HackStudio: Update window close button on document change 2022-04-27 00:49:54 -07:00
huttongrabiel
1e65e916fc LibMarkdown: Correct typo in forward declaration of HorizontalRule
HoriziontalRule -> HorizontalRule
2022-04-26 23:23:36 -07:00
Peter Elliott
287c6228b5 LoginServer: Change login fail message to avoid enumeration attacks
The current message distinguishes between a user that doesn't exist, and
an invalid password. This is considered to be bad practice, because an
attack can first check if a user exists before guessing that users
password.

Also it's just tradition or something.
2022-04-26 21:57:24 -07:00
kleines Filmröllchen
19f6ef3a0c HexEditor: Add UTF16 to the value inspector 2022-04-27 00:02:24 +02:00
kleines Filmröllchen
ef113b2f91 HexEditor: Add UTF8 to the value inspector 2022-04-27 00:02:24 +02:00
kleines Filmröllchen
e5736cdf2f HexEditor: Add ASCII to the value inspector
This is kind of redundant but probably easier to read than the ASCII
column. Also, it seems appropriate after we add other character
encodings.
2022-04-27 00:02:24 +02:00
kleines Filmröllchen
da7a8a8711 HexEditor: Don't require the ValueInspectorModel's value size to be i32 2022-04-27 00:02:24 +02:00
Moustafa Raafat
0a3467d665 LibConfig+ConfigServer: Write config values synchronously
This patch fixes the issue of pressing the ok button of a settings menu
without saving the changes, or not reverting the changes when pressing
the cancel button because the app has died before the new values make
it to the other end.
2022-04-26 22:51:49 +02:00
Ralf Donau
e11fb83bb7 config: Allow setting a key to the empty string 2022-04-26 22:42:54 +02:00
networkException
64c66e26f5 LibGUI: Check if event loop is alive before quitting it in Dialog::close
Previously we would quit the event loop of a dialog without checking if
it is still alive in the Window::close overload. This patch updates the
implementation to make use of the existing done method, handling closes
more gracefully.

This fixes a CommandPalette crashing when opening an about dialog, as
since 1074c399f3 the command palette
dialog would handle a WindowBecameInactive event after closing itself
due to the action already being called.
2022-04-26 22:41:44 +02:00
ForLoveOfCats
2adc5efe2b LibGUI: Don't merge TextDocumentUndoCommand if too much time has elapsed 2022-04-26 19:13:22 +02:00
ForLoveOfCats
ee81c1b07a LibGUI: Split InsertTextCommand undo/redo based on whitespace 2022-04-26 19:13:22 +02:00
ForLoveOfCats
68aec687cf LibGUI: Use ctrl+shift+z for redo action shortcut 2022-04-26 19:13:22 +02:00
Tim Schumacher
8eb886f069 LibC: Don't handle pending exceptions when reading FPU status 2022-04-26 15:02:56 +02:00
Peter Elliott
5847d326c3 LibMarkdown: Treat whitespace-only lines as blank in paragraphs 2022-04-26 15:02:26 +02:00
Peter Elliott
aef5aac772 LibMarkdown: Don't put a newline in empty code blocks
This doesn't actually matter, but I'm trying to match the commonmark
test cases where possible.
2022-04-26 15:02:26 +02:00
Peter Elliott
e084e1ced6 LibMarkdown: Better support for code fences
- Support tildes.
- Support different lengths of fence.
- Begrudgingly keep support for serenities one markdown extension.
2022-04-26 15:02:26 +02:00
Peter Elliott
4d3454d700 LibMarkdown: Support up to 3 spaces before an ATX header 2022-04-26 15:02:26 +02:00
Peter Elliott
116e0dc4de LibMarkdown: Limit headings to 6 levels 2022-04-26 15:02:26 +02:00
Peter Elliott
c15c57a6af LibMarkdown: Make thematic break parsing more correct
also fix a conflict with lists and thematic breaks
2022-04-26 15:02:26 +02:00
Peter Elliott
5ad44ac2e5 LibMarkdown: Ignore backslash on non-punctuation characters 2022-04-26 15:02:26 +02:00
Peter Elliott
0270e23997 LibMarkdown: Add support for indented code blocks 2022-04-26 15:02:26 +02:00
Andreas Kling
b85c8a0b80 Kernel: Add FIOCLEX and FIONCLEX ioctls
These allow you to turn the close-on-exec flag on/off via ioctl().
2022-04-26 14:32:12 +02:00
MacDue
d0aef66bcc LibGUI: Respect TitleButtonsIconOnly in AbstractThemePreview 2022-04-25 23:45:24 +02:00
MacDue
9b30fe9864 LibGfx+WindowServer: Add theme flag TitleButtonsIconOnly
With this flag set to true only the icon of the title button is painted.
This is useful for themes with a more non-serenity look such as
Coffee and Cupertino (that currently try to hide the button).
2022-04-25 23:45:24 +02:00
Ralf Donau
69a896cb82 ini: Use String for arguments 2022-04-25 10:47:56 +02:00
Lucas CHOLLET
86d4b7ebfc LibGUI: Display line number next to the first visual line
The number was previously vertically centered, but it prevents from
quickly seeing a line change.
2022-04-25 10:46:58 +02:00
Lucas CHOLLET
881f499704 LibGUI: Fix text wrap artifact when selecting text
The issue was caused by the usage of the
selection_end_column_within_line variable as if it was the visual line.
This is fixed by taking the minimum between this value and the length of
a visual line.
2022-04-24 19:14:28 +02:00
Moustafa Raafat
7b23dfea79 LibGUI: Remove unused functions in EditingEngine class 2022-04-23 17:04:39 -07:00
Sam Atkins
3cc1a86ef5 ClockSettings: Add a preview of the current time format
When writing a custom format especially, it's nice to be able to see how
it will look as you write it.
2022-04-23 10:48:51 -07:00
Sam Atkins
bd7e896c76 ClockSettings: Tweak timezone layout spacing to not crop the ComboBox 2022-04-23 10:48:51 -07:00
Sam Atkins
ae469b9afa ClockSettings: Don't change format text when checking "Custom"
Previously, when you selected to have a custom format, whatever was in
the custom-format box would get replaced with the format for
12-hour-without-seconds. Now, it keeps whatever was in the box before -
which is less disorientating, and lets you tweak the existing format.
2022-04-23 10:48:51 -07:00
Sam Atkins
c80fca78b3 ClockSettings: Select radio-button that matches the saved clock format
This means that if you save and close ClockSettings with "24-hour"
and "Show seconds" both checked, then they will both be checked when
you re-open ClockSettings, instead of it showing as a "Custom" format.
2022-04-23 10:48:51 -07:00
Daniel Bertalan
e4b7ce3324 UserspaceEmulator: Use boolean operators instead of bitwise ones
Fixes a bitwise-instead-of-logical warning from Clang 14.
2022-04-23 10:43:32 -07:00
Daniel Bertalan
bb92991408 LibC: Use correct inttypes.h format strings on Aarch64
Similarly to x86_64, Aarch64 is LP64, so its `uint64_t` type is
`unsigned long`.

Fixes a bunch of compiler warnings when compiling the LLVM runtime
libraries for the aarch64-pc-serenity target.
2022-04-23 10:43:32 -07:00
Daniel Bertalan
95cff1133d LibC: Unconditionally include bits/posix1_lim.h from limits.h
No other system seems to put this behind a _USE_POSIX ifdef.
2022-04-23 10:43:32 -07:00
Andrew Kaster
f1d47ea618 LibWeb+AudioServer: Remove unused spaceship operators
We aren't actually using these for anything, and the spaceship operator
requires ``<compare>`` from the STL, which we'd rather not include.
2022-04-23 10:43:32 -07:00
sin-ack
bc7c8879c5 Kernel+LibC+LibCore: Implement the unlinkat(2) syscall 2022-04-23 10:43:32 -07:00
Kenneth Myhra
a5514fece9 LibWeb: Move XHR::open() towards more spec compliance
Following FIXMEs have been addressed:
- 1. Let settingsObject be this’s relevant settings object.
- 2. If settingsObject has a responsible document and it is not fully
     active, then throw an "InvalidStateError" DOMException.
- 6. Let parsedURL be the result of parsing url with settingsObject's
     API base URL and settingsObject’s API URL character encoding.
- 8. If the async argument is omitted, set async to true, and set
     username and password to null.
2022-04-23 18:05:55 +02:00
Kenneth Myhra
01194053b7 LibWeb: XHR set_request_header() validate header name and value 2022-04-23 18:05:55 +02:00
Kenneth Myhra
1ca1a73d67 LibWeb: Trim leading and trailing HTTP whitespace bytes
The XMLHttpRequest specification specifices that header values should be
normalized by trimming leading and trailing HTTP whitespace bytes.
2022-04-23 18:05:55 +02:00
Kenneth Myhra
fccea8888e LibWeb: Use a more restrictive regex for method token production
This changes the regular expression for is_method() to a more
restrictive pattern.
2022-04-23 18:05:55 +02:00
Kenneth Myhra
053bcd4859 LibWeb: Combine headers in XMLHttpRequest::set_request_header
This patch adds support for combining header values, in addtion it adds
spec comments for readability.
2022-04-23 18:05:55 +02:00
Ali Mohammad Pur
2c0716e314 LibWasm: Simplify the return instruction execution code a bit 2022-04-22 21:12:47 +04:30
Ali Mohammad Pur
846b2c8a99 LibWasm: Push call results back in reverse order to preserve stack order 2022-04-22 21:12:47 +04:30
Ali Mohammad Pur
6760ea33a0 LibWasm: Make memory_grow validation push back the old memory size 2022-04-22 21:12:47 +04:30
Ali Mohammad Pur
6e07e74261 LibWasm: Make local_tee validation keep the value on the stack 2022-04-22 21:12:47 +04:30
Ali Mohammad Pur
1409a48da6 LibRegex: Check inverse_matched after every op, not just at the end
Fixes #13755.

Co-Authored-By: Damien Firmenich <fir.damien@gmail.com>
2022-04-22 10:02:39 +02:00
Dylan Katz
a79896bb44 Documentation+SQLStudio: Add manual page for SQL Studio 2022-04-22 09:57:40 +02:00
Dylan Katz
582539c570 DevTools: Introduce SQL Studio
SQL Studio is a graphical SQL manager program that allows the user
to create and edit SQL scripts.
2022-04-22 09:57:40 +02:00
Torstennator
b7e8f32323 PixelPaint: Add a histogram widget
This adds a simple histogram widget that visualizes the rgb-channels
and brightness for a given image. When hovering over the image it will
indicate what brightness level the pixel at the mouse position has.
2022-04-21 17:26:52 +02:00
Sam Atkins
5702f016f0 LibGUI+Applications: Add --open-tab option to FooSettings applications
Similar to SystemMonitor's option of the same name, this allows you to
launch the given application with the specific tab open.
2022-04-21 17:24:42 +02:00
Sam Atkins
ded5ba1f87 LibGUI+Applications: Give SettingsWindow tabs a string ID
This gives us a convenient way to refer to them, which will be used in
the following commit.
2022-04-21 17:24:42 +02:00
Sam Atkins
4d2e18fb07 LibCore: Output invalid DateTime::to_string() specifiers as literals
While working on #13764 I noticed that DateTime::to_string() would just
return an empty String if the format included an invalid specifier
(eg `%Q`). This seems to be a mistake. POSIX date(1), which I believe
we are basing our implementation on, only replaces valid specifiers,
and any invalid ones get included as literals in the output.

For example, on Linux `date "+%Quiz"` returns "%Quiz", but we were
returning "".
2022-04-21 16:32:18 +02:00
kleines Filmröllchen
612dbdc671 AudioServer: Auto-pause new clients
This fixes a bunch of audio clients that don't actually play audio.
2022-04-21 13:55:00 +02:00
kleines Filmröllchen
49b087f3cd LibAudio+Userland: Use new audio queue in client-server communication
Previously, we were sending Buffers to the server whenever we had new
audio data for it. This meant that for every audio enqueue action, we
needed to create a new shared memory anonymous buffer, send that
buffer's file descriptor over IPC (+recfd on the other side) and then
map the buffer into the audio server's memory to be able to play it.
This was fine for sending large chunks of audio data, like when playing
existing audio files. However, in the future we want to move to
real-time audio in some applications like Piano. This means that the
size of buffers that are sent need to be very small, as just the size of
a buffer itself is part of the audio latency. If we were to try
real-time audio with the existing system, we would run into problems
really quickly. Dealing with a continuous stream of new anonymous files
like the current audio system is rather expensive, as we need Kernel
help in multiple places. Additionally, every enqueue incurs an IPC call,
which are not optimized for >1000 calls/second (which would be needed
for real-time audio with buffer sizes of ~40 samples). So a fundamental
change in how we handle audio sending in userspace is necessary.

This commit moves the audio sending system onto a shared single producer
circular queue (SSPCQ) (introduced with one of the previous commits).
This queue is intended to live in shared memory and be accessed by
multiple processes at the same time. It was specifically written to
support the audio sending case, so e.g. it only supports a single
producer (the audio client). Now, audio sending follows these general
steps:
- The audio client connects to the audio server.
- The audio client creates a SSPCQ in shared memory.
- The audio client sends the SSPCQ's file descriptor to the audio server
  with the set_buffer() IPC call.
- The audio server receives the SSPCQ and maps it.
- The audio client signals start of playback with start_playback().
- At the same time:
  - The audio client writes its audio data into the shared-memory queue.
  - The audio server reads audio data from the shared-memory queue(s).
  Both sides have additional before-queue/after-queue buffers, depending
  on the exact application.
- Pausing playback is just an IPC call, nothing happens to the buffer
  except that the server stops reading from it until playback is
  resumed.
- Muting has nothing to do with whether audio data is read or not.
- When the connection closes, the queues are unmapped on both sides.

This should already improve audio playback performance in a bunch of
places.

Implementation & commit notes:
- Audio loaders don't create LegacyBuffers anymore. LegacyBuffer is kept
  for WavLoader, see previous commit message.
- Most intra-process audio data passing is done with FixedArray<Sample>
  or Vector<Sample>.
- Improvements to most audio-enqueuing applications. (If necessary I can
  try to extract some of the aplay improvements.)
- New APIs on LibAudio/ClientConnection which allows non-realtime
  applications to enqueue audio in big chunks like before.
- Removal of status APIs from the audio server connection for
  information that can be directly obtained from the shared queue.
- Split the pause playback API into two APIs with more intuitive names.

I know this is a large commit, and you can kinda tell from the commit
message. It's basically impossible to break this up without hacks, so
please forgive me. These are some of the best changes to the audio
subsystem and I hope that that makes up for this :yaktangle: commit.

:yakring:
2022-04-21 13:55:00 +02:00
kleines Filmröllchen
cb0e95c928 LibAudio+Everywhere: Rename Audio::Buffer -> Audio::LegacyBuffer
With the following change in how we send audio, the old Buffer type is
not really needed anymore. However, moving WavLoader to the new system
is a bit more involved and out of the scope of this PR. Therefore, we
need to keep Buffer around, but to make it clear that it's the old
buffer type which will be removed soon, we rename it to LegacyBuffer.
Most of the users will be gone after the next commit anyways.
2022-04-21 13:55:00 +02:00
kleines Filmröllchen
fc7d231b00 LibIPC: Allow transporting a SharedCircularQueue over IPC 2022-04-21 13:55:00 +02:00
kleines Filmröllchen
6b13436ef6 LibCore: Introduce SharedSingleProducerCircularQueue
This new class with an admittedly long OOP-y name provides a circular
queue in shared memory. The queue is a lock-free synchronous queue
implemented with atomics, and its implementation is significantly
simplified by only accounting for one producer (and multiple consumers).
It is intended to be used as a producer-consumer communication
datastructure across processes. The original motivation behind this
class is efficient short-period transfer of audio data in userspace.

This class includes formal proofs of several correctness properties of
the main queue operations `enqueue` and `dequeue`. These proofs are not
100% complete in their existing form as the invariants they depend on
are "handwaved". This seems fine to me right now, as any proof is better
than no proof :^). Anyways, the proofs should build confidence that the
implemented algorithms, which are only roughly based on existing work,
operate correctly in even the worst-case concurrency scenarios.
2022-04-21 13:55:00 +02:00
kleines Filmröllchen
d463f6e00a SystemServer: Boot into graphical mode even if there's no video hardware
SystemServer had safety fallbacks to boot into text mode if the user
errorneously specified graphical mode but no video hardware was present.
As it's now possible to do exactly this intentionally, we should allow
it. This would of course make WindowServer fall over and die if
configured improperly, but if you're messing with the kernel command
line in strange ways, you should be able to fix that.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
935f401714 WindowServer: Create the VirtualScreenBackend
This screen backend is just memory-backed and doesn't connect to any
screen hardware. That way, we can boot Serenity without video hardware
but in full graphical mode :^)

To create a virtual screen, put something like this in your
WindowServer.ini. There's no way yet to do this through Display
Settings, though an existing virtual screen's settings can be changed
there.
```ini
[Screen0]
Mode=Virtual
Left=1024
Top=0
Width=1920
Height=1080
ScaleFactor=1
```
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
be98ce0f9f WindowServer: Add the screen mode property in the screen configuration
This will allow us to change between a couple of properties, for now
it's only Device and Virtual. (How about Remote :^) ) These get handled
by a different screen backend in the Screen.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
e95ae4a143 WindowServer: Make Screen use ScreenBackend
This will allow us to use other screen backends in the future instead.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
0acffa5ef4 WindowServer: Introduce the ScreenBackend concept
The ScreenBackend is a thin wrapper around the actual screen hardware
connection. It contains all the variables specific to that hardware and
abstracts away operations that deal with controlling the hardware. The
standard ScreenBackend implementor is HardwareScreenBackend, which
contains all the existing frame buffer & ioctl handling code of Screen.
I took this opportunity to introduce ErrorOr wherever sensible.
2022-04-21 13:41:55 +02:00
kleines Filmröllchen
1fce201d15 WindowServer: Rename fb_data and friends to flush_rect etc
This was very badly named. All that the "FBData" struct contains is the
currently to-be-flushed rectangles plus a fullness flag, so it should
better be called FlushRectData. This rename is similarly applied to all
variable names.
2022-04-21 13:41:55 +02:00
brapru
a7bb3fe7a8 netstat: Add the wide flag option
Previously netstat would print the whole line of an ip address or
resolved hostname. If the hostname was longer than the address column
length, it would push following columns into disaligned output.

This sets the default behavior to truncate any IP address or symbolic
hostname that is larger than the maximum address column size to provide
cleaner output. In the event the user wishes to see the whole address
name, they can then pass the wide option that will output as wide as
necessary to print the whole name.
2022-04-21 13:17:29 +02:00
brapru
07c2c86314 netstat: Add hostname resolution 2022-04-21 13:17:29 +02:00
brapru
a4d84a76e1 arp: Add hostname resolution 2022-04-21 13:17:29 +02:00
Andreas Kling
02c18bf6de LibC: Stub out posix_memalign() 2022-04-21 11:50:38 +02:00
Andreas Kling
ab878576bb LibC: Make nameinfo (NI_*) constants bitfield-friendly
These are supposed to be used as flags in a bitfield, so let's make
them powers of two.
2022-04-21 11:50:38 +02:00
Andreas Kling
a353ceecf1 LibC: Implement errno via a __errno_location() function
This matches how some other systems implement errno, and makes 3rd party
software that expect us to have __errno_location() work.
2022-04-21 11:49:48 +02:00
ForLoveOfCats
99c0b895fe Shell: Highlight commands with a hyperlink to open their help pages 2022-04-21 09:12:37 +04:30
ForLoveOfCats
85152d2f7f LaunchServer+Help: Open help urls with Help 2022-04-21 09:12:37 +04:30
Linus Groh
95541d7064 LibWeb: Fix various spec comment inconsistencies
- Don't add multiple numbers to nested steps, just the innermost one
  (as rendered in the HTML document)
- "Otherwise" comments go before the else, not after it
- "FIXME:" goes before step number, not between it and the comment text
- Always add a period between number and comment text

The majority of these were introduced in #13756, but some unrelated ones
have been updated as well.
2022-04-20 19:49:01 +02:00
Michael Manganiello
56081cdb6e LibGUI: Remove Tile.date_time member from Calendar
Currently, navigating through different years in the Year view of the
Calendar app or the taskbar is very slow.
Profiling results show that almost all the time is spent in
`Calendar::update_tiles`, and specifically, in `DateTime::create` and
`DateTime::set_time`.

Performance can improve substantially if the `TZ` environment variable
is set [0], but we can improve the current code to perform better
nevertheless :^)

This diff focuses on removing the need of the `Tile` struct to require
the instantiation of a `DateTime` object, which avoids _at least_ 365
object instantiations in the Year view, on each `update_tiles` call.
Instead, as the `date_time` isn't used often, we can instantiate it on
demand when a particular date is selected.

[0] https://blog.packagecloud.io/set-environment-variable-save-thousands-of-system-calls/
2022-04-20 18:37:56 +02:00
Eli Youngs
3afce86e83 mkfifo: Add support for setting permissions with -m 2022-04-20 18:35:08 +02:00
faxe1008
9e323241f8 LibGUI: Use fuzzy matching in CommandPalette
This patch changes the previously used contains method for matching the
user search term with all available commands to use the fuzzy match
algorithm, which makes it more typo tolerant.
2022-04-20 18:34:09 +02:00
faxe1008
b8bd667782 AK: Add FuzzyMatch header
This patch adds a header containing the fuzzy match algorithm
previously used in Assistant. The algorithm was moved to AK
since there are many places where a search may benefit from fuzzyness.
2022-04-20 18:34:09 +02:00