Commit graph

1454 commits

Author SHA1 Message Date
Timothy Flynn
6a7d7624a7 LibSQL: Fix parsing of lists of common-table-expression
Misread the graph: In the "WITH [RECURSIVE] common-table-expression"
section, common-table-expression is actually a repeating list. This
changes the parser to correctly parse this section as a list. Create a
new AST node, CommonTableExpressionList, to store both this list and the
boolean RECURSIVE attribute (because every statement that uses this list
also includes the RECURSIVE attribute beforehand).
2021-04-22 18:08:15 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Linus Groh
024fd9b957 LibWeb: Fix HTML injection on FrameLoader error page
Small regression introduced by 3857148, we still have to escape HTML
entities.
2021-04-22 10:17:00 +02:00
Andreas Kling
de7062af9c LibRegex: Unbreak the ALL_DEBUG build 2021-04-22 09:23:28 +02:00
Andreas Kling
3857148028 LibWeb+Base: Use AK::SourceGenerator for error pages
Instead of storing a format string in a file, let's be reasonable
and use SourceGenerator's template functionality. :^)
2021-04-22 00:00:59 +02:00
Andreas Kling
0005fa0e2b LibELF: Convert String::format() => String::formatted() 2021-04-21 23:49:03 +02:00
Andreas Kling
7254d4c4b8 LibCoreDump: Convert String::format() => String::formatted() 2021-04-21 23:49:03 +02:00
Andreas Kling
f4a15c8d42 LibCore: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
9db2036437 LibGUI: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
9a8dd38493 LibWeb+Base: Convert String::format() to String::formatted()
This error page template is slightly hilarious and should probably
be replaced with AK::SourceGenerator or some such, but for now let's
just get rid of the call to String::format().
2021-04-21 23:49:02 +02:00
Andreas Kling
83d3003208 LibDebug: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
c68dcf45b6 LibRegex: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
90ee84621f LibLine: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
4e6d2374b6 LibVT: Convert String::format() => String::formatted() 2021-04-21 23:49:02 +02:00
Andreas Kling
2a6a54dea5 Userland: Use Core::DirIterator::next_full_path()
Simplify some code by using this instead of concatenating the full path
ourselves at the call site.
2021-04-21 23:49:01 +02:00
Andreas Kling
dba58ad9ec LibX86: Convert String::format() => String::formatted() 2021-04-21 23:49:01 +02:00
Andreas Kling
e875d4e044 LibGfx: Convert String::format() => String::formatted() 2021-04-21 23:49:01 +02:00
Andreas Kling
d996e43df6 LibGfx: Minor clean-ups in Gfx::FontDatabase
Use Core::DirIterator::next_full_path() instead of manually building
each path.

Also convert a fprintf(stderr, ...) to warnln()
2021-04-21 23:49:01 +02:00
Andreas Kling
e5318d51e6 LibCore: Remove the barely-used Core::safe_syscall()
This was a helper that would call a syscall repeatedly until it either
succeeded or failed with a non-EINTR error.

It was only used in two places, so I don't think we need this helper.
2021-04-21 23:49:01 +02:00
Rafał
c41c41cc0f
LibGUI: Prevent selecting empty line in TextEditor on double click (#6537) 2021-04-21 23:48:26 +02:00
Timothy Flynn
6cbf88ad4c LibSQL: Rename TestSqlParser -> TestSqlStatementParser
A little bit clearer what is being tested now, since the expression
parser also lives in its own file.
2021-04-21 21:37:55 +02:00
Timothy Flynn
733806b6a1 LibSQL: Parse DELETE statement 2021-04-21 21:37:55 +02:00
Timothy Flynn
ce6c7ae18a LibSQL: Parse most language expressions
https://sqlite.org/lang_expr.html

The entry point to using expressions, parse_expression(), is not used
by SQL::Parser in this commit. But there's so much here that it's easier
to grok as its own commit.
2021-04-21 21:37:55 +02:00
Timothy Flynn
8c8d611fb3 LibSQL: Add forwarding header
SQL AST nodes will need to have other node types forward declared before
using them.
2021-04-21 21:37:55 +02:00
Timothy Flynn
a11f49f627 LibSQL: Add Parser::consume_if helper
The following is a common (and soon to be *very* common) expression:

    if (match(token_type))
        consume();

Using consume_if() makes this a bit simpler and makes it less likely to
forget to invoke consume() after the match().
2021-04-21 21:37:55 +02:00
Timothy Flynn
570aa57df3 LibSQL: Lex string and blob literals
Blob literals are the same as string literals except prefixed with an
'x' or 'X'.
2021-04-21 21:37:55 +02:00
Lenny Maiorani
ece8aeaaf4 Everywhere: Remove redundant inline keyword with constexpr
Problem:
- `constexpr` functions are additionally decorated with `inline`
  keyword. This is redundant since `constexpr` implies `inline`.

Solution:
- Remove redundancies.
2021-04-21 20:49:49 +02:00
Idan Horowitz
ec67b1ac32 LibWeb: Implement scientific notation parsing in PathDataParser
This was required by webkit.org and is based on the following spec:
https://svgwg.org/svg2-draft/paths.html#PathDataBNF
2021-04-21 18:57:50 +02:00
iCristalrope
8bb4409a5d
LibGUI: Track selection starting index in AbstractView (#6515)
Modifying the selection while holding the shift button and selecting
with the mouse or the arrow keys no longer results in broken selections.

Fixes #6279.
2021-04-21 17:09:04 +02:00
jakewestrip
b9fc7780ae LibGUI: Remove premature return in Window::handle_key_event 2021-04-21 15:24:57 +02:00
Ali Mohammad Pur
f90a1f83ed LibJS: Precompile Heap.h and GlobalObject.h
This is somewhat noticable difference (~10s), as these two headers are
basically included in every single JS file anyway.
2021-04-21 14:29:46 +02:00
FalseHonesty
58d6781cbb HackStudio+LibDebug: Support stopping a debugged process
In LibDebug this required implementing the Kill debug action, and
in HackStudio this required making the toolbar's stop action stop
the debugger if active.
2021-04-21 13:42:09 +02:00
Brian Gianforcaro
5a31ca06db LibPthread: Add non functional pthread_attr_[set|get]scope stubs
Standard: https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getscope.html

Needed for https://fio.readthedocs.io
2021-04-21 13:13:23 +02:00
Brian Gianforcaro
14f6425b8f LibC: Add pwrite(..) implementation to match the existing pread(..)
Add a basic non-thread safe implementation of pwrite, following the
existing pread(..) design.

This is needed for https://fio.readthedocs.io
2021-04-21 13:13:23 +02:00
Brian Gianforcaro
56ba3e1cbd LibC: Add LOG_NOWAIT stub to syslog.h
Needed for porting https://fio.readthedocs.io
2021-04-21 13:13:23 +02:00
Brian Gianforcaro
2ebb3f3c0d LibC: Add a definition for INET6_ADDRSTRLEN
Although serenity doesn't implement IPv6 yet, applications
will often declare buffers to be of size `INET6_ADDRSTRLEN`
so it's guaranteed to work in both IPv4 / IPv6 environments.

This is needed specifically for a port of Flexible IO Tester
https://fio.readthedocs.io

This is standardized here:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/netinet/in.h.html
2021-04-21 08:04:52 +02:00
Brian Gianforcaro
a1720eed2a LibC: Setup a unit test harness for LibC, add ctime_r / asctime_r tests.
LibC is no different than any other code, it should be unit tested where
appropriate / possible.
2021-04-21 08:04:52 +02:00
Brian Gianforcaro
df808f0ed3 LibC: Fix missing '\n' at the end of ctime/ctime_r/asctime/asctime_r
@linusg noticed this bug in the original implementation during code review.
This makes all of these API's more spec conforming.
2021-04-21 08:04:52 +02:00
Brian Gianforcaro
440b81deba LibC: Add ctime_r() and asctime_r() implementations
Need this for a port of FIO (Flexible IO Tester)
https://fio.readthedocs.io/
2021-04-21 08:04:52 +02:00
Marco Biscaro
8124719c3d Tests: Reorganize LibCompress unit tests
Move LibCompress unit tests to LibCompress/Tests directory and register
them with CMake's add_test. This allows us to run these tests with
ninja test instead of running a separate executable.

Also split the existing tests in 3 test files that better follow the
source code structure (inspired by AK tests).
2021-04-21 08:00:32 +02:00
Andreas Kling
78733417a4 LibWeb: Register FormAssociatedElement with their owner form
This will eventually allow us to implement HTMLFormControlsCollection.
2021-04-20 23:38:27 +02:00
Andreas Kling
e454e1a45d LibWeb: Make HTMLSelectElement a FormAssociatedElement 2021-04-20 23:38:27 +02:00
Gunnar Beutner
2520ccfca4 LibPthread: Add stubs for pthread_spin_* functions
The stress-ng port depends on these now that it detects we have
thread support.
2021-04-20 21:08:17 +02:00
Gunnar Beutner
88cebb05ad LibC+LibPthread: Implement function forwarding for libpthread
GCC will insert various calls to pthread functions when compiling
C++ code with static initializers, even when the user doesn't link
their program against libpthread explicitly.

This is used to make static initializers thread-safe, e.g. when
building a library that does not itself use thread functionality
and thus does not link against libpthread - but is intended to
be used with other code that does use libpthread explicitly.

This makes these symbols available in libc.
2021-04-20 21:08:17 +02:00
Linus Groh
7400e3d8fc LibWeb: Don't call ResourceLoader error callback on 4xx status code
A website with a 4xx status code is still a valid website, we should not
artificially hide it. In fact, many websites implement custom 404 error
pages for example, often containing search functionality or links back
to the homepage.
This might have implications regarding the loading of stylesheets where
the request 404s, but since we were not handling 5xx status codes as
errors either, I think that's fine for now (but might need additional
work later). Worst case, the parser rejects to load some error page HTML
as CSS :^)
2021-04-20 19:47:23 +02:00
Linus Groh
7af1d2c170 LibJS: Make Object.getOwnPropertyDescriptor() work with string indexed property
E.g. for "0" we have to contruct a PropertyName with Type::Number so it
looks in the indexed properties as expected.
2021-04-20 18:53:07 +02:00
Linus Groh
614bad86bc LibJS: Fix Object.getOwnPropertyDescriptor() attributes for numeric property
We were getting the attributes of the existing value and then
immediately assigned the default attributes instead.
2021-04-20 18:42:10 +02:00
Tobias Christiansen
5338708091 LibWeb: Display <ol> and respect list-style-type in <ul>
In the ListItemMarkerBox render the correct thing when painting.
This covers decimal counting for ordered lists as well as square,
disc, and circle for unordered lists. Thus all currently supported
list-style-types are displayed correctly.

This closes #2059
2021-04-20 18:29:19 +02:00
Tobias Christiansen
bfcfe84240 LibWeb: Make the ListItemMarkerBox index-aware.
In the ListItemBox we get the index of the current <li> element in the
parent and pass it to the ListItemMarkerBox.

This patch is work towards #2059
2021-04-20 18:29:19 +02:00
Tobias Christiansen
c09ac536c5 LibWeb: Add capabilities to find the index of a child in its parent.
For Elements depending on the index they are inside their parent. Most
notably the <ol> element.
Also added a typed version to only count children of a certain type.

This patch is work towards #2059
2021-04-20 18:29:19 +02:00
Timothy Flynn
e92bffb2e3 LibSQL: Parse DROP TABLE statement 2021-04-20 18:28:34 +02:00
Timothy Flynn
d41d1d2035 LibSQL: Add unit testing of the SQL parser 2021-04-20 18:28:34 +02:00
Timothy Flynn
377992d33e LibSQL: Create a very barebones SQL parser
This parser builds on the LibSQL lexer and currently only allows users
to parse 'CREATE TABLE' statements.
2021-04-20 18:28:34 +02:00
Timothy Flynn
90517da9ca LibSQL: Introduce a SQL library with a tokenizer
LibSQL aims to be a SQLite clone for SerenityOS. Step 1 is creating a
tokenizer to lex SQL tokens. This lexer is heavily influenced by the
LibJS lexer.
2021-04-20 18:28:34 +02:00
Idan Horowitz
63af67ea01 LibJS: Throw on a regex searchString in String.startsWith
As is required by the specification:
"Let isRegExp be ? IsRegExp(searchString). If isRegExp is true,
throw a TypeError exception."
2021-04-20 14:38:54 +02:00
Idan Horowitz
b1e5330e64 LibJS: Stop early-returning on missing searchString in String.startsWith
A missing searchString is allowed by the specification and is treated
as js_undefined. ("undefined test".startsWith() => true)
2021-04-20 14:38:54 +02:00
Idan Horowitz
81d7d68416 LibWeb: Use correct event name for the onmousemove global event handler
The current event name was accidentally set for the onmousedown event.
2021-04-20 14:38:54 +02:00
Andreas Kling
b092353e4d LibWeb: Add basic support for HTMLInputElement.form
HTMLInputElement now inherits from FormAssociatedElement, which will
be a common base for the handful of elements that need to track their
owner form (and register with it for the form.elements collection.)

At the moment, the owner form is assigned during DOM insertion/removal
of an HTMLInputElement. I didn't implement any of the legacy behaviors
defined by the HTML parsing spec yet.
2021-04-20 12:05:56 +02:00
Andreas Kling
00d8e3b02b LibWeb: Don't include "Wrapper" suffix in JS wrapper class_name()
The "Wrapper" suffix is not useful information to someone using the
JS console, so let's just drop it from the string returned when calling
class_name() on a JS binding wrapper.
2021-04-20 12:05:56 +02:00
Andreas Kling
4d35ffdf3c LibJS: Include the class name of objects in MarkupGenerator output
Add a little label before the "{ }" so you can see what kind of object
it is. This makes Browser's JS console significantly nicer to use. :^)
2021-04-20 12:05:56 +02:00
Idan Horowitz
28b8a2ec7a LibIPC: Make Connection::send_sync return a NonnullOwnPtr
Since we VERIFY that we received a response, the response pointer is
always non-null.
2021-04-20 10:10:15 +02:00
Idan Horowitz
a2b34b7e6b LibDesktop: Fail gracefully on allowlist failures instead of asserting
IPC::Connection::send_sync asserts that a response was received, so the
current gracefull fail check was useless, as LibIPC would always assert
before reaching it.
2021-04-20 10:10:15 +02:00
Linus Groh
ac3e7ef791 LibJS: Fix crash in Object.{freeze,seal}() with indexed properties
This was failing to take two things into account:

- When constructing a PropertyName from a value, it won't automatically
  convert to Type::Number for something like string "0", even though
  that's how things work internally, since indexed properties are stored
  separately. This will be improved in a future patch, it's a footgun
  and should happen automatically.
- Those can't be looked up on the shape, we have to go through the
  indexed properties instead.

Additionally it now operates on the shape or indexed properties directly
as define_property() was overly strict and would throw if a property was
already non-configurable.

Fixes #6469.
2021-04-20 09:38:22 +02:00
Linus Groh
085816645f LibJS: Take PropertyName in Object::set_integrity_level() internal lambda
At least for IntegrityLevel::Frozen we already construct a PropertyName
from the key value, let's reuse that.
2021-04-20 09:38:22 +02:00
Leandro Pereira
29fd75f22f LibGUI: Make statusbar label flat when displaying override_text
Changing the statusbar appearance when overriding text makes it less
confusing as it's supposed to be something temporary, e.g.  only when
hovering over a toolbar or menu item.

This behavior is present on old Windows systems, although things work
slightly differently there (where only the overridden text is displayed
rather than all the segments).
2021-04-20 09:24:52 +02:00
Andreas Kling
955eef83b0 LibWeb: Add basic support for HTMLCanvasElement.toDataURL() :^)
This allows you to serialize a <canvas> element's bitmap into a
data: URI. Pretty neat! :^)
2021-04-19 23:49:16 +02:00
Andreas Kling
6793574003 LibGfx: Improve PNG encoder API somewhat
This is still far from ideal, but let's at least make it take a
Gfx::Bitmap const&.
2021-04-19 23:49:16 +02:00
Gunnar Beutner
ddcd149224 LibC: Avoid division by zero in fread()/fwrite() 2021-04-19 22:13:52 +02:00
Itamar
4831dc0e30 LibCpp: Support parsing class declarations 2021-04-19 21:48:42 +02:00
Gunnar Beutner
cd432860d8 LibC: Additional functionality for getaddrinfo()
When node is NULL and AI_PASSIVE is specified we are supposed to use
the "any" address, otherwise we should use the loopback address.
2021-04-19 21:00:23 +02:00
Gunnar Beutner
38619a9f24 LibELF: Ignore DT_SYMBOLIC entries
The shared library libicudata.so has a DT_SYMBOLIC entry:

Dynamic Section:
  NEEDED               libgcc_s.so
  SONAME               libicudata.so.69
  SYMBOLIC             0x00000000
  HASH                 0x00000094
  STRTAB               0x000000c8
  SYMTAB               0x000000a8
  STRSZ                0x0000002a
  SYMENT               0x00000010

According to the ELF spec DT_SYMBOLIC has no special meaning
for the dynamic loader.
2021-04-19 20:39:22 +02:00
Gunnar Beutner
6c729993a8 LibELF: Allow shared objects which don't have a text segment
Shared objects without a text segment are perfectly OK. For
example libicudata.so has only data segments:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .hash         00000014  00000094  00000094  00000094  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .dynsym       00000020  000000a8  000000a8  000000a8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynstr       0000002a  000000c8  000000c8  000000c8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .rodata       01b562d0  00000100  00000100  00000100  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .eh_frame     00000000  01b563d0  01b563d0  01b563d0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynamic      00000070  01b573d0  01b573d0  01b563d0  2**2
2021-04-19 20:39:22 +02:00
Conor Byrne
88ecfa164a LibGUI+WindowServer: Add WM_SuperKeyPressed event
This commit adds an event called WM_SuperKeyPressed which is sent to all
windows via WindowManagerServerConnection.
The event is fired from WindowManager when the super key is pressed,
which is the windows key on most keyboards :)
2021-04-19 20:03:25 +02:00
Brian Gianforcaro
3e87e43f9d LibC: Expose new profiling_free_buffer(..) syscall.
Expose the new `profiling_free_buffer` syscall to user space.
2021-04-19 18:30:37 +02:00
Panagiotis Vasilopoulos
9de58a2d89 LibC: Added sysexits.h 2021-04-19 18:27:55 +02:00
Gunnar Beutner
a5be8d8976 LibC: Improve error logging for execvp() 2021-04-19 18:27:09 +02:00
Gunnar Beutner
bd08f9188a Pthread: Add stubs for pthread_cleanup_{push,pop}
The stubs are necessary to make the xz port properly detect pthread
support. The two functions are only used in the configure script and
nowhere else.
2021-04-19 17:55:35 +02:00
Ali Mohammad Pur
74f0fdab98 LibLine: Avoid trying to restore() if the editor isn't initialized
Fixes #6472.
2021-04-19 16:28:33 +02:00
Ali Mohammad Pur
e1e84fe0fe LibLine: Redraw the suggestions when terminal size changes 2021-04-19 16:28:33 +02:00
Adam Hodgen
b9c6059984 LibWeb: Correctly calculate height of TableRowGroupBox
As well as correctly calculating the height of TableRowBox, this change
calculates the heights of TableRowGroupBoxs also.

As before, this does not correctly take into consideration the 'height'
attribute.

Now the horizontal layout is approximately correct for the
TableRowGroupBoxs we can now see that the `layout_row` method will need
updating to correctly calculate cell width across all rows, not just the
current TableRowGroupBox.
2021-04-19 12:26:05 +02:00
Adam Hodgen
ae02acb8e1 LibWeb: Properly handle thead and tfooter HTML tags
As the spec for the table fixup algorythm says:

> Treat table-row-groups in this spec also encompass the specialized
> table-header-groups and table-footer-groups.
2021-04-19 12:26:05 +02:00
Gunnar Beutner
c32b58873a LibELF: Fix calculation for TLS relocations
The calculation for TLS relocations was incorrect which would
result in overlapping TLS variables when more than one shared
object used TLS variables.

This bug can be reproduced with a shared library and a program
like this:

    $ cat tlstest.c
    #include <string.h>
    __thread char tls_val[1024];
    void set_val() { memset(tls_val, 0, sizeof(tls_val)); }

    $ gcc -g -shared -o usr/lib/libtlstest.so tlstest.c

    $ cat test.c
    void set_val();
    int main() { set_val(); }
    $ gcc -g -o tls test.c -ltlstest

Due to the way the TLS relocations are done this program would
clobber libc's TLS variables (e.g. errno).
2021-04-19 12:14:43 +02:00
Gunnar Beutner
0cca23def5 LibELF: Improve error message for missing symbols 2021-04-19 12:00:40 +02:00
Gunnar Beutner
1dab5ca5fd LibELF: Fix support for relocating weak symbols
Having unresolved weak symbols is allowed and we should initialize
them to zero.
2021-04-19 12:00:40 +02:00
Gunnar Beutner
97d7450571 LibELF: Remove VERIFY() calls and let control flow return to the caller
This way we get better error messages for unresolved symbols because
the caller logs the file and symbol names.
2021-04-19 12:00:40 +02:00
DexesTTP
d3a89ce737 LibWebSocket: Add a new websocket library
This library currently contains a basic WebSocket client that can
handle both standard TCP websockets and TLS websockets.
2021-04-18 22:42:10 +02:00
DexesTTP
b30f5dc8b5 LibCore: Add ArgsParser::add_option(String&)
The API existed for add_positional_argument, but not for named arguments.
2021-04-18 22:42:10 +02:00
Idan Horowitz
397269d21e LibGfx: Report font glyph presence based on glyph's specific width
This uses the per glyph width to determine if the glyph is actually
present in the font, and not just inside the range the font can covers

This means that characters that are in the font's range but that are
missing a glyph will show up as the missing character glyph instead of
being invisible.
2021-04-18 22:10:25 +02:00
Idan Horowitz
18ae37439a FontEditor+LibGfx: Allow user to specify if a specific glyph is present
This replaces the glyph width spinbox in the font editor with a
checkbox when editing fixed width fonts that indicates if the
currently selected character's glyph is present in the edited font
(For variable width fonts a non zero width implies presence)

This commit also changes the background color of glyphs in the glyph
map based on the presence of each specific glyph in the font.
2021-04-18 22:10:25 +02:00
Idan Horowitz
08d1b16a8d LibGfx: Always load font widths array and use it for glyph presence
Since we were always saving the glyph widths array to the font file, we
now also always load it, even on (which also simplifies the logic a bit)
fixed width fonts. We also set it initially to 0 instead of the default
fixed width, which allows us to use it to check for glyph presence in
both fixed width and variable width fonts.
2021-04-18 22:10:25 +02:00
Idan Horowitz
3c894d1e6f LibGfx: Use size_t instead of int for glyph count
The count is always non-negative
2021-04-18 22:10:25 +02:00
Idan Horowitz
f461ee7d01 LibGfx: Add support for fonts that include the Hebrew Unicode Block 2021-04-18 18:57:35 +02:00
Linus Groh
8d490aba76 LibJS: Implement console.assert() 2021-04-18 18:28:17 +02:00
Linus Groh
a178255a8b LibJS: Use 'if constexpr' / dbgln_if() instead of '#if LEXER_DEBUG' 2021-04-18 18:14:50 +02:00
Linus Groh
87a43fa87c LibJS: Use 'if constexpr' instead of '#if HEAP_DEBUG' 2021-04-18 18:14:44 +02:00
Linus Groh
51676d7c33 LibJS: Use dbgln_if() instead of '#if OBJECT_DEBUG' 2021-04-18 18:10:42 +02:00
FalseHonesty
7a1396f509 LibDebug: Implement ability to set watchpoints
Now we can set hardware watchpoints for our variables! :^)
These watchpoints will be automatically removed when
they go out of scope.
2021-04-18 17:02:40 +02:00
FalseHonesty
3123ffb19d Kernel: Add ptrace commands for reading/writing the debug registers
This adds PT_PEEKDEBUG and PT_POKEDEBUG to allow for reading/writing
the debug registers, and updates the Kernel's debug handler to read the
new information from the debug status register.
2021-04-18 17:02:40 +02:00
Andreas Kling
12546259ff Everywhere: Rename title_bar => titlebar 2021-04-18 16:35:18 +02:00
Gunnar Beutner
81daca5dd7 LibC: Implement assignment suppression for vsscanf
The vsscanf library function lets the user skip assigning
parsed values to the arguments, e.g. with %*c - even though
a character is scanned it is not assigned to one of the
arguments.

The figlet port uses this. With this patch the port is actually
usable.
2021-04-18 16:35:00 +02:00
Hendiadyoin1
f682c9f100 LibC: Add netinet/in_systm.h 2021-04-18 15:52:07 +02:00
Gunnar Beutner
07adbf19c4 LibDebug: Implement support for AttributeDataForm::Data8
I came across this while analyzing a crash dump for openttd.
2021-04-18 15:51:13 +02:00
AnotherTest
ae49171755 LibCrypto: Avoid creating bools from anything except bools 2021-04-18 14:18:16 +02:00
AnotherTest
db8f0a2fa6 LibCore: Remove the no-longer-used Core::DateTime::is_before() function 2021-04-18 14:18:16 +02:00
AnotherTest
38f4441103 LibTLS: Parse X.509 certificates with the new ASN.1 parser
As a nice side effect, also correctly test for certificate validity :^)
2021-04-18 14:18:16 +02:00
AnotherTest
13abbc5ea8 LibCrypto: Implement UTCTime and GeneralizedTime parsers 2021-04-18 14:18:16 +02:00
AnotherTest
39997e2ab1 LibCore: Implement operator less-than for Core::DateTime
that just compares their timestamps.
2021-04-18 14:18:16 +02:00
AnotherTest
ed28008d78 LibCrypo: Add an ASN.1/DER pretty-printer
It's much easier to debug things when we can actually *see* them :P
2021-04-18 14:18:16 +02:00
AnotherTest
65de2d236d LibCrypto: Allow the user to override the DER read kind and class
This is useful for parsing non-universal types.
2021-04-18 14:18:16 +02:00
AnotherTest
581f9ff6bb LibCrypto: Add the GeneralizedTime ASN.1 type 2021-04-18 14:18:16 +02:00
Gunnar Beutner
f033416893 Kernel+LibC: Clean up how assertions work in the kernel and LibC
This also brings LibC's abort() function closer to the spec.
2021-04-18 11:11:15 +02:00
Andreas Kling
7ceb4f5330 LibGUI: Add some more status tips to common actions 2021-04-18 10:58:22 +02:00
Andreas Kling
a2086ad56e LibGUI: Rename Action::long_text to Action::status_tip
This feels a bit more descriptive.
2021-04-18 10:58:22 +02:00
Gunnar Beutner
407b066ba4 Ports: Update the gcc port with the patches from the toolchain 2021-04-18 10:55:25 +02:00
Gunnar Beutner
6cb28ecee8 LibC+LibELF: Implement support for the dl_iterate_phdr helper
This helper is used by libgcc_s to figure out where the .eh_frame sections
are located for all loaded shared objects.
2021-04-18 10:55:25 +02:00
Gunnar Beutner
8dc375da96 LibElf: Allow PT_GNU_EH_FRAME program headers
These are built when compiling an executable with exception support.
2021-04-18 10:55:25 +02:00
Gunnar Beutner
ebca6aabc0 LibC: Make atexit handlers thread-safe 2021-04-18 10:52:05 +02:00
Gunnar Beutner
4075b306f8 LibC+LibPthread: Make sure TLS keys are destroyed after everything else
This ensures that __thread variables can be used when global destructors
are being invoked.
2021-04-18 10:52:05 +02:00
Linus Groh
2b0c361d04 Everywhere: Fix a bunch of typos 2021-04-18 10:30:03 +02:00
Andreas Kling
d6c6880674 LibCore: Use is<T> in Object::find_*_of_type helpers
This allows us to add fast-paths for commonly used types.
2021-04-17 23:01:24 +02:00
AnotherTest
fb80d5adda LibLine: Check the terminal size at the start of get_line()
There are cases where the line editor could miss the WINCH signal
(e.g. in the shell, while another program is in the foreground),
This patch makes it so that LibLine notices the change in terminal size
in such cases.
2021-04-17 22:10:35 +02:00
AnotherTest
b58dbc29fc LibLine: Add support for ^X^E
This keybind opens the current buffer in an editor (determined by
EDITOR from the env, or the default_text_editor key in the config file,
and set to /bin/TextEditor by default), and later reads the file back
into the buffer.
Pretty handy :^)
2021-04-17 22:10:35 +02:00
Andreas Kling
5e945c5169 LibWeb: Don't load anything for <iframe> without src attribute
Completing an empty URL string from the document base URL will just
return the document URL, so any document that had an "<iframe>"
would endlessly load itself in recursive iframes.
2021-04-17 21:38:38 +02:00
Andreas Kling
22ed6a70eb LibGUI: Add "override text" to GUI::Statusbar
Each statusbar segment now has an optional "override text" which can
be set, and if non-null will be displayed instead of the regular text.

This allows programs to display contextual information in the statusbar
temporarily without losing whatever text was already on there.
2021-04-17 20:49:53 +02:00
Andreas Kling
3bf2f7a329 LibGUI: Make GUI::Toolbar buttons generate ActionEnter and ActionLeave
Now you'll get the same event whether you hover an action in a menu
or in a toolbar. :^)
2021-04-17 20:49:53 +02:00
Andreas Kling
7d0b59cb05 LibGUI: Add action enter/leave hooks on GUI::Application
Apps can now hook into these events by assigning a callback to the
on_action_enter and on_action_leave hooks on GUI::Application. :^)
2021-04-17 20:49:53 +02:00
Andreas Kling
4c6f541d5b LibGUI: Add Action* accessors on GUI::Button 2021-04-17 20:49:53 +02:00
Andreas Kling
e7263a7e75 LibGUI: Add a "long text" string to GUI::Action
Actions can now have a longer text description, in addition to its
regular UI string. The longer text will soon be used to display
a more detailed description of hovered actions in statusbars.
2021-04-17 20:49:53 +02:00
Andreas Kling
ba7e1ca2fb WindowServer+LibGUI: Notify GUI clients about menu item enter/leave
We now send out MenuItemEntered and MenuItemLeft messages to the client
when the user hovers/unhovers menu items.

On the client side, these become GUI::ActionEvent, with one of two
types: ActionEnter or ActionLeave. They are sent to the Application.

This will allow GUI applications to react to these events.
2021-04-17 20:49:53 +02:00
Linus Groh
eedde500eb LibJS: Replace MAX_U32 with NumericLimits<u32>::max() 2021-04-17 19:35:32 +02:00
Idan Horowitz
4a2c0d721f LibTextCodec: Implement a Windows-1255 decoder.
This is a superset of ascii that adds in the hebrew alphabet.
(Google currently assumes we are running windows due to not
recognizing Serenity as the OS in the user agent, resulting
in this encoding instead of UTF8 in google search results)
2021-04-17 18:13:20 +02:00
Idan Horowitz
79b1270711 LibJS: Take reference instead of pointer in prepare_arguments_list
This argument is always non-null (and the function assumes so), so
theres no point to taking a pointer instead of a reference.
2021-04-17 17:38:50 +02:00
Idan Horowitz
6cd318d784 LibJS: Convert matched regex result to string in Symbol.replace
This would crash on an undefined match (no match), since the matched
result was assumed to be a string (such as on discord.com). The spec
suggests converting it to a string as well:
https://tc39.es/ecma262/#sec-regexp.prototype-@@replace (14#c)
2021-04-17 16:10:45 +02:00
Andreas Kling
358697a32f LibGUI: Make sure we depend on the WindowManager IPC endpoints 2021-04-17 15:58:34 +02:00
sin-ack
aa56f9a1e0 LibGUI+WindowServer: Separate window manager IPC from regular IPC
With this patch the window manager related functionality is split out
onto a new endpoint pair named WindowManagerServer/Client.  This allows
window manager functionality to be potentially privilege separated in
the future.  To this end, a new client named WMConnectionClient
is used to maintain a window manager connection.  When a process
connects to the endpoint and greets the WindowServer as a window manager
(via Window::make_window_manager(int)), they're subscribed to the events
they requested via the WM event mask.

This patch also removes the hardcoding of the Taskbar WindowType to
receive WM events automatically.  However, being a window manager still
requires having an active window, at the moment.
2021-04-17 13:06:25 +02:00
Gunnar Beutner
c33592d28c Kernel+LibC: Update struct stat to use struct timespec instead of time_t
Some programs unconditionally expect struct stat to have nanosecond support.
2021-04-17 11:12:42 +02:00
Sahan Fernando
e6b396c248 LibGfx: Fix sse enabled builds by removing implicit float conversion 2021-04-17 11:00:04 +02:00
Luke
dfb23babbb LibGfx: Make top highlight of classic buttons fit to the top left corner 2021-04-17 09:56:22 +02:00
Egor Ananyin
1d343116a9 LibWeb: Fix height calculation for absolutely positioned boxes
This commit fixes algorithm for computing auto height (CSS 2.2 10.6.7)
by including floating boxes into computation and implements one of the cases
for computing the height of absolutely positioned, non-replaced elements (10.6.4 rule 3)
2021-04-17 09:48:27 +02:00
Andreas Kling
94b247c5a9 LibELF: Make get_library_name() take String instead of StringView 2021-04-17 01:27:31 +02:00
Andreas Kling
a1a6d30b54 LibCore: Make File take String instead of StringView 2021-04-17 01:27:31 +02:00
Andreas Kling
510aad6515 LibCore: Make DirIterator take String instead of StringView 2021-04-17 01:27:30 +02:00
Andreas Kling
0e4eb62dd8 LibGUI: Make some API's take String instead of StringView 2021-04-17 01:27:30 +02:00
Andreas Kling
36f27094d0 LibTTF: Make load_from_file() take String instead of StringView 2021-04-17 01:27:30 +02:00
Andreas Kling
e873d27ab1 LibGfx: Switch a bunch of API's from taking StringView to String
These were all getting converted into String internally anyway.
2021-04-17 01:27:30 +02:00
Andreas Kling
050648b270 LibGUI: Make Window::set_title() take a String 2021-04-17 01:27:29 +02:00
Andreas Kling
942a5afd23 LibCore: Don't needlessly use StringView in Core::Object APIs
Taking a StringView parameter that gets immediately converted to
a String anyway is silly. Just take a String directly instead.

This pattern is the main reason we have the "StringView internal
StringImpl pointer" optimization, and I suspect that we can throw
that whole thing out if we make a couple more patches like this.
2021-04-17 01:27:29 +02:00
Andreas Kling
d33fdc925b LibGUI: Make GUI::Widget::set_tooltip() take a String
There was no reason for this to take a StringView.
2021-04-17 01:27:29 +02:00
Idan Horowitz
586f10b6e1 LibJS: Accept symbol property in the in operator
This is used by discord.com and allowed by the specification:
https://tc39.es/ecma262/#sec-relational-operators-runtime-semantics-evaluation
2021-04-17 00:59:36 +02:00
Tobias Christiansen
7744048d0f LibWeb: Fix misplaced bullet points on list items
The bullet point should not be centered in the height of the list item,
but rather stay in front of the first line.
So, instead of giving the marker the full height of the ListItemBox,
it gets the height of a single line.

This closes #6384
2021-04-17 00:28:55 +02:00