Commit graph

13789 commits

Author SHA1 Message Date
Andreas Kling
9103471863 LibIPC: Handle partial messages
Since we're using byte streamed Unix sockets for the IPC protocols,
it's possible for the kernel to run out of socket buffer space with
a partial message near the end of the buffer.

Handle this situation in IPC::Connection by buffering the bytes of
what may be a partial message, and prepending them to the incoming
data next time we receive from the peer.

This fixes WindowServer asserting when a peer is spamming it hard.
2020-10-25 11:37:42 +01:00
Andreas Kling
ace15e0043 Userland: Add missing license header to hexdump 2020-10-25 10:22:34 +01:00
AnotherTest
dd60fe4d37 Kernel: Optionally take some arguments to pass to the init program
This makes it possible to start _everything_ under UserspaceEmulator, by
setting `init_args` to `--report-to-debug,/bin/SystemServer` and `init`
to `/bin/UserspaceEmulator`.
With the UE patches before this, we get to spawn WindowServer, and crash
because of FLD_RM32 (nothing tested past that) in graphical mode.
But we get a working shell in text mode :^) (and DHCPClient fails when
setting whatever settings it has received)
2020-10-25 10:13:03 +01:00
AnotherTest
4d756c7d2d UserspaceEmulator: Remove some unneeded String copies 2020-10-25 10:13:03 +01:00
AnotherTest
57f0f8c9b7 UserspaceEmulator: Handle SO_BINDTODEVICE in setsockopt 2020-10-25 10:13:03 +01:00
AnotherTest
290e7957b7 UserspaceEmulator: Add support for setsid 2020-10-25 10:13:03 +01:00
AnotherTest
fcc38422c6 UserspaceEmulator: Add support for set_thread_name
It should be noted that creating threads is still not supported.
2020-10-25 10:13:03 +01:00
AnotherTest
617c5ba045 UserspaceEmulator: Add support for fchown 2020-10-25 10:13:03 +01:00
AnotherTest
41aa78f6de UserspaceEmulator: Add support for chmod 2020-10-25 10:13:03 +01:00
AnotherTest
b1d36243e5 UserspaceEmulator: Add support for setgroups 2020-10-25 10:13:03 +01:00
AnotherTest
457e00f319 UserspaceEmulator: Add support for sched_(g s)etparam 2020-10-25 10:13:03 +01:00
AnotherTest
33730cbd92 UserspaceEmulator: Add support for some more ioctl() requests 2020-10-25 10:13:03 +01:00
AnotherTest
aee0df19c1 UserspaceEmulator: Add support for emulating SC_mount 2020-10-25 10:13:03 +01:00
AnotherTest
9afe9069a9 UserspaceEmulator: Optionally write reports to the debug log
...and take a flag '--report-to-debug' that determines this behaviour.
2020-10-25 10:13:03 +01:00
Andreas Kling
201d34f6cd Userland: Add a very simple hexdump program :^)
This can definitely be improved, but it does the basic job!
2020-10-25 10:12:03 +01:00
Andreas Kling
80b77cec38 LibGfx+FontEditor+Fonts: Add family, size and weight metadata to fonts
This makes finding fonts from the same family much less difficult. :^)
2020-10-25 10:12:03 +01:00
Andreas Kling
5abc03db0d Fonts: Rename font files consistently
Font files are now all named like this:

    <Family><Weight><Size>.font

This will make it much easier/sane to perform font lookup.
2020-10-25 10:12:03 +01:00
Andreas Kling
688675e89b LibGUI: Make table view row height+padding font-size-relative
This makes tables look a lot nicer with different-sized fonts. :^)
2020-10-25 10:12:03 +01:00
Andreas Kling
8961148cdf Fonts: Add 12px variants of Csilla and CsillaBold
These aren't perfect, but it's a start and we can tweak the glyphs
as we go and discover what might look nice. :^)
2020-10-25 10:12:03 +01:00
AnotherTest
d7577b0338 Base: Document the new brace expansions in Shell's manpage 2020-10-25 10:09:27 +01:00
AnotherTest
f7dbd14a87 Shell: Add some tests for brace expansions 2020-10-25 10:09:27 +01:00
AnotherTest
107a083b5a LibGUI: Update ShellSyntaxHighlighter to also highlight brace expansions 2020-10-25 10:09:27 +01:00
AnotherTest
5640e1bc3a Shell: Add support for brace expansions
This adds support for (basic) brace expansions with the following
syntaxes:
- `{expr?,expr?,expr?,...}` which is directly equivalent to `(expr expr
  expr ...)`, with the missing expressions replaced with an empty string
  literal.
- `{expr..expr}` which is a new range expansion, with two modes:
    - if both expressions are one unicode code point long, the range is
      equivalent to the two code points and all code points between the
      two (numerically).
    - if both expressions are numeric, the range is equivalent to both
      numbers, and all numbers between the two.
    - otherwise, it is equivalent to `(expr expr)`.

Closes #3832.
2020-10-25 10:09:27 +01:00
Tom
567f2f3548 LibGUI: Fix walking Splitter's child widgets 2020-10-25 06:52:48 +01:00
Tom
5f9906f188 LibGUI: Fix Splitter sometimes not working after widgets were resized
We need to skip over widgets that are not visible as the layout does
not update their location. This fixes finding the correct widgets
surrounding the splitter.

Fixes #3491
2020-10-25 00:13:20 +02:00
Linus Groh
2adcabb6b3 LibJS: Disallow escape sequence/line continuation in use strict directive
https://tc39.es/ecma262/#sec-directive-prologues-and-the-use-strict-directive

A Use Strict Directive is an ExpressionStatement in a Directive Prologue
whose StringLiteral is either of the exact code point sequences
"use strict" or 'use strict'. A Use Strict Directive may not contain an
EscapeSequence or LineContinuation.
2020-10-24 16:34:01 +02:00
Linus Groh
4fb96afafc LibJS: Support LegacyOctalEscapeSequence in string literals
https://tc39.es/ecma262/#sec-additional-syntax-string-literals

The syntax and semantics of 11.8.4 is extended as follows except that
this extension is not allowed for strict mode code:

Syntax

    EscapeSequence::
        CharacterEscapeSequence
        LegacyOctalEscapeSequence
        NonOctalDecimalEscapeSequence
        HexEscapeSequence
        UnicodeEscapeSequence

    LegacyOctalEscapeSequence::
        OctalDigit [lookahead ∉ OctalDigit]
        ZeroToThree OctalDigit [lookahead ∉ OctalDigit]
        FourToSeven OctalDigit
        ZeroToThree OctalDigit OctalDigit

    ZeroToThree :: one of
        0 1 2 3

    FourToSeven :: one of
        4 5 6 7

    NonOctalDecimalEscapeSequence :: one of
        8 9

This definition of EscapeSequence is not used in strict mode or when
parsing TemplateCharacter.

Note

It is possible for string literals to precede a Use Strict Directive
that places the enclosing code in strict mode, and implementations must
take care to not use this extended definition of EscapeSequence with
such literals. For example, attempting to parse the following source
text must fail:

function invalid() { "\7"; "use strict"; }
2020-10-24 16:34:01 +02:00
Linus Groh
9f036959e8 LibJS: Report correct line/column for string literal syntax errors
We're passing a token to this function, so m_current_token is actually
the next token - which leads to incorrect line/column numbers for string
literal syntax errors:

    "\u"
        ^
    Uncaught exception: [SyntaxError]: Malformed unicode escape sequence (line: 1, column: 5)

Rather than:

    "\u"
    ^
    Uncaught exception: [SyntaxError]: Malformed unicode escape sequence (line: 1, column: 1)
2020-10-24 16:34:01 +02:00
Linus Groh
d6f8c52245 LibJS: Allow try statement with only finally clause
This was a regression introduced by 9ffe45b - a TryStatement without
'catch' clause *is* allowed, if it has a 'finally' clause. It is now
checked properly that at least one of both is present.
2020-10-24 16:34:01 +02:00
asynts
aa115fe27b AK: Add [[deprecated]] to out(). 2020-10-24 12:56:25 +02:00
asynts
88bca152c9 AK: Eradicate the uses of out(). 2020-10-24 12:56:25 +02:00
asynts
61e73b1a7b AK: Introduce SourceGenerator::fork().
Previously, I abused the copy constructor, this is a lot better.
2020-10-24 12:56:25 +02:00
Andreas Kling
bf1ed34236 LibWeb: Don't send OOPWV repaint requests for views without backing
This fixes an assertion in TextEditor when changing the system theme,
since that would trigger a repaint request for the HTML preview widget
which may not have backing unless it's actually been used to perform
HTML (or Markdown) preview yet.
2020-10-24 12:30:21 +02:00
Andreas Kling
950c999d3a Themes: Add "Desert" theme 2020-10-24 12:23:48 +02:00
Andreas Kling
20ca3d4a99 LibGfx+WindowServer: Handle taller window title fonts better
If the window title font is taller than the theme's specified title
height, compute the title height based on the font instead. :^)
2020-10-24 00:26:13 +02:00
Andreas Kling
f2584bc2eb Fonts: Add 12px variants of Katica and KaticaBold
I only drew the ASCII codepoints so far. We'll probably need to tweak
these here & there, but I feel like they turned out pretty good. :^)
2020-10-24 00:03:43 +02:00
Linus Groh
80bb62b9cc LibJS: Distinguish between statement and declaration
This separates matching/parsing of statements and declarations and
fixes a few edge cases where the parser would incorrectly accept a
declaration where only a statement is allowed - for example:

    if (foo) const a = 1;
    for (var bar;;) function b() {}
    while (baz) class c {}
2020-10-23 19:13:06 +02:00
Linus Groh
f8ae6fa713 LibJS: Disallow NumericLiteral immediately followed by Identifier
From the spec: https://tc39.es/ecma262/#sec-literals-numeric-literals

The SourceCharacter immediately following a NumericLiteral must not be
an IdentifierStart or DecimalDigit.

For example: 3in is an error and not the two input elements 3 and in.
2020-10-23 19:13:06 +02:00
Linus Groh
80bb22788f LibJS: Don't allow TryStatement without catch clause 2020-10-23 19:13:06 +02:00
Linus Groh
82ac936a9d LibJS: Check for exception after executing (do)while test expression
Otherwise we crash the interpreter when an exception is thrown during
evaluation of the while or do/while test expression - which is easily
caused by a ReferenceError - e.g.:

    while (someUndefinedVariable) {
        // ...
    }
2020-10-23 19:06:57 +02:00
Tom
a19d8aade4 LibGUI: TableView should only scroll to the selected cell
Fixes #3825
2020-10-23 19:04:51 +02:00
Andreas Kling
3c5da01f94 LibGUI+LibGfx+Base: Make tooltips color theme aware :^)
Also tweak the default tooltip color to be more bright and yellow!
2020-10-23 12:01:14 +02:00
Andreas Kling
332d05f3fd LibGUI: Make GUI::Label respect the foreground color role 2020-10-23 11:57:00 +02:00
Andreas Kling
f406c2e07f Base: Remove ugly 'Xmas' theme
I added this while doing the original theming implementationa and it's
just not good.
2020-10-23 11:45:35 +02:00
Andreas Kling
9f118e3a26 LibGfx: Filled checked toolbar buttons with a dither pattern
This makes them stand out a bit from buttons that are being pressed
(but not checked.)
2020-10-23 11:37:35 +02:00
Andreas Kling
06a29e8aa5 LibGUI: Add some horizontal padding to multi-line IconView item titles
And don't use the padding from the item's text rect as extra space for
glyphs when breaking lines.
2020-10-23 09:44:56 +02:00
Andreas Kling
5b50174e5d LibGUI: Break IconView item titles into two lines if necessary
This is nice when long item titles don't fit. You can now hover them
(or select them) and we'll break the item text into two lines instead
of just one.

It might make sense to go even further in some cases. Perhaps when
hovering an item, we could show the full item text, painted above
all other items. That's something for a future patch.

It would also be nice if the text didn't jump back and forth when
going in and out of this mode. Also for a future patch.
2020-10-23 09:39:45 +02:00
Wesley Moore
5ee7e9ab64 rm: Exit with status 0 if stat fails and force is set 2020-10-23 09:39:30 +02:00
Andreas Kling
46c15276e9 LibWeb: Fix Document construction mishap in <template> element
Ref-counted objects must not be stack allocated. Make DOM::Document's
constructor private to avoid this issue. (I wish we could mark classes
as heap-only..)
2020-10-23 08:33:16 +02:00
AnotherTest
691b105885 LibLine: Support basic escaped characters in config file
Until we can figure out how shift+enter works (or an alternative), this
can be used to input literal newlines:
```ini
[keybinds]
\\\n=\n
```
2020-10-22 23:49:51 +02:00