Commit Graph

21463 Commits

Author SHA1 Message Date
Max Wipfli
2164d8aae8 AK: Stop using U+0000 as end of file code point in URL parser
This changes URL parser to use the 0xFFFFFFFF constant instead of 0 to
indicate end of file. This fixes a bug where inputs containing null
bytes would terminate the parser early, because they were interpreted
as end of file.
2021-06-05 10:53:31 +02:00
Max Wipfli
97425c7dfb AK: Make debugging URLParser easier
This patch adds a state_name method to URLParser to convert a state to a
string. With this, the debugging statements now display the state names.

Furthermore, this fixes a bug where non-ASCII code points were
formatted as characters, which fails an assertion in the formatting
system.
2021-06-05 10:53:31 +02:00
Max Wipfli
99d5555134 AK: Do not trim away non-ASCII bytes when parsing URL
Because non-ASCII code points have negative byte values, trimming away
control characters requires checking for negative bytes values.

This also adds a test case with a URL containing non-ASCII code points.
2021-06-05 10:53:31 +02:00
Max Wipfli
44937e2dfc AK: Update URLParser.{cpp,h} to use east const 2021-06-05 10:53:31 +02:00
Idan Horowitz
0f8ed6183b LibJS: Add the Number.{MAX, MIN}_VALUE constants 2021-06-05 02:38:37 +01:00
Jelle Raaijmakers
3dab9d0b5c Kernel: Implement offset for lseek with SEEK_END 2021-06-04 23:49:48 +02:00
Timothy Flynn
f73bb164ad LibCards: Draw card stack background when the entire stack is moving
The stack background should be painted when the entire stack is being
dragged, rather than just the top card.

Fixes #7786. Regressed in 2b762ef940.
2021-06-04 23:48:25 +02:00
Jelle Raaijmakers
f6d372b2ab Kernel: Process::exec(): Check if path is a regular file
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html

  [EACCES] The new process image file is not a regular file and the
           implementation does not support execution of files of its
           type.

Let's check whether the passed `path` is indeed a regular file.
2021-06-04 23:45:17 +02:00
Jelle Raaijmakers
9510425845 Shell: Add TMPDIR environment variable
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/
V1_chap08.html

  TMPDIR  This variable shall represent a pathname of a directory made
          available for programs that need a place to create temporary
          files.

Ports like PHP benefit from having this environment variable set, and
there exist a lot of scripts that assume the presence of such an
environment variable.
2021-06-04 23:44:59 +02:00
Gunnar Beutner
a42383523a Kernel: Update the TX byte counter when sending network packets
This previously worked but was broken by b436dd1.
2021-06-05 00:36:55 +04:30
Max Wipfli
ec2f0fc8eb LibCpp: Fix off-by-one error in SyntaxHighlighter
This changes the C++ SyntaxHighlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.

Contrary to other syntax highlighters, for this one the change has been
made to the SyntaxHighlighter rather than the Lexer. This is due to the
fact that the Parser also uses the same Lexer. I'm soure there is some
more elegant way to do this, but this patch at least unbreaks the C++
syntax highlighting.
2021-06-05 00:32:28 +04:30
Max Wipfli
617c54a00b LibCpp: Do not emit empty whitespace token after include statement
If an include statement didn't contain whitespace between the word
"include" and the '<' or '"', the lexer would previous emit an empty
whitespace token. This has been changed now.
2021-06-05 00:32:28 +04:30
Max Wipfli
2aa0cbaf22 LibCpp: Use CharacterTypes.h and constexpr functions in Lexer 2021-06-05 00:32:28 +04:30
Max Wipfli
d57d7bea1c LibCpp: Use east const style in Lexer and SyntaxHighlighter 2021-06-05 00:32:28 +04:30
Max Wipfli
282a623853 LibWeb: Change a few source end positions in HTMLTokenizer
This patch aims to fix wrong highlighting for some cases in HTML's
syntax highlighter. The values were somewhat experimentally determined
are are subject to change. Regardless, it should be more correct with
this patch than without it. :^)
2021-06-05 00:32:28 +04:30
Max Wipfli
44c438d0ca LibWeb: Fix off-by-one error in SyntaxHighlighter
This changes the HTML SyntaxHighlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor. It also
avoids emitting tokens if they have a zero or negative length.

This fixes a bug where single-character tokens were not highlighted
properly.
2021-06-05 00:32:28 +04:30
Max Wipfli
932161e581 LibWeb: Be more forgiving when adding source positions in HTMLTokenizer
This patch changes HTMLTokenizer::nth_last_position to not fail if the
requested position is not available. Rather, it will just return (0-0).

While this is not the correct solution, it prevents the tokenizer from
crashing just because it cannot find a source position. This should only
affect SyntaxHighlighter.
2021-06-05 00:32:28 +04:30
Max Wipfli
93d830b5cc LibWeb: Add debugging statements in SyntaxHighlighter
This also changes SyntaxHighlighter.{h,cpp} to use east const style.
2021-06-05 00:32:28 +04:30
Max Wipfli
04897f6842 LibSQL: Fix off-by-one error in SyntaxHighlighter
This changes the SQL SyntaxHighlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.
2021-06-05 00:32:28 +04:30
Max Wipfli
a9378ce5c2 LibSQL: Clean up SyntaxHighlighter code
This changes SyntaxHighlighter.{cpp,h} to use east const style. It also
removes two unused headers and simplifies a loop.
2021-06-05 00:32:28 +04:30
Max Wipfli
261f233060 Shell: Fix off-by-one error in SyntaxHighlighter
This changes the Shell syntax highlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.

This also adds some debug output to make debugging easier.
2021-06-05 00:32:28 +04:30
Max Wipfli
cb5a50d3f7 LibGUI: Fix off-by-one error in Lexer tokens
This changes the INI and GML lexers to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.

The other user of GMLToken::m_end, GMLAutocompleteProvider, has been
modified to take into account that end position columns have been
incremented by one.
2021-06-05 00:32:28 +04:30
Max Wipfli
e7b5dbe1ac LibGUI: Use CharacterTypes.h and constexpr functions in {INI,GML}Lexer 2021-06-05 00:32:28 +04:30
Max Wipfli
e10278402f LibGUI: Use east const style in {INI,GML}Lexer.{cpp,h} 2021-06-05 00:32:28 +04:30
Max Wipfli
106ad6ba09 LibJS: Fix off-by-one error in SyntaxHighlighter
This changes the JS syntax highlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.
2021-06-05 00:32:28 +04:30
Max Wipfli
a819f98956 LibGUI: Fix off-by-one error in rendering of highlighted text
This fixes an off-by-one error in TextEditor's rendering of the syntax
highlighting as generated by Syntax::Highlighter and its subclasses.

Before, a single character span was e.g. (0-3) to (0-3), but this was
considered invalid by GUI::TextRange. Now, a single character span would
be e.g. (0-3) to (0-4).

This fix requires all Syntax::Highlighter subclasses to be adjusted, as
they all relied on the previous implementation. This will then also fix
a bug where single-character HTML tags wouldn't be highlighted.
2021-06-05 00:32:28 +04:30
Gunnar Beutner
8f81d9ad90 AK: Verify that functions aren't modified while they're being invoked
A Function object should not be set to a different functor while the
original functor is currently executing.
2021-06-04 19:32:25 +02:00
Gunnar Beutner
44418cb351 AK: Allow deferring clear() for the Function class
Ideally a Function should not be clear()ed while it's running.
Unfortunately a number of callers do just that and identifying all of
them would require inspecting all call sites for operator() and clear().

Instead this adds support for deferring clear() until after the
function has finished executing.
2021-06-04 19:32:25 +02:00
Gunnar Beutner
fab9b2f068 Hearts: Don't destroy the animation handler while running it 2021-06-04 19:32:25 +02:00
Itamar
fdaec58f59 HackStudio: Add comment about lexicographical insertion to ClassView 2021-06-04 19:29:22 +02:00
Itamar
c1b2003687 HackStudio: Use Node's name when inserting to the ClassView tree
Previously, when traversing the ClassView tree to find the parent of a
new node, we used the name of the node's declaration to find the path
to the parent in the tree.

However, some nodes in the tree do not have a matching declaration,
which caused a VERIFY failure.

To fix this, we now use the node's name when walking the tree.
We can do this because the node's name should be identical to the name
of its declaration.

Closes #7702.
2021-06-04 19:29:22 +02:00
Timothy Flynn
2b762ef940 Solitaire+LibCards: Draw card stacks with rounded corners
Now that the cards have rounded corners, draw the stack box behind the
cards with rounded corners as well. This way, the corner of the stack
box doesn't peek out from behind the cards.

The caveat here is that the "play" card stack now needs to hold a
reference to the "waste" stack beneath it so it knows when not to draw
its background on top of the waste stack. To faciliate that, the array
of card stacks is now a NonnullRefPtrVector so the play stack can store
a smart pointer to the waste stack (instead of a raw pointer or
reference).
2021-06-04 19:11:45 +02:00
Timothy Flynn
4903186cc5 LibGfx: Add helper for painting a rounded rect with equal corner radii 2021-06-04 19:11:45 +02:00
Maciej Zygmanowski
bee1e06055 hostname: Handle 'sethostname' errors 2021-06-04 19:11:27 +02:00
Gunnar Beutner
d840608a51 Taskbar: Make sure LibGUI/Desktop.h is usable in ports
Now that Desktop.h includes Services/Taskbar/TaskbarWindow.h we have
to install Taskbar's header files so that Desktop.h can be used in
ports or when building software in-target.
2021-06-04 19:11:13 +02:00
Jelle Raaijmakers
18a5ac1e66 Ports: Enable PHP XML extensions 2021-06-04 19:10:58 +02:00
Jelle Raaijmakers
93e605e415 Ports: Add libxml2 2021-06-04 19:10:58 +02:00
Gunnar Beutner
60298121d8 Kernel: Make sure we increment the TX counter
This was broken by b436dd1.
2021-06-04 19:06:47 +02:00
Ryan Chandler
c66b281856 LibJS: Fix functions binding this to global object in strict mode
This fixes an issue where this would be bound to the global object
by default when operating in strict mode.

According to the specification, the expected value for |this| when
no binding is provided is undefined.
2021-06-04 13:00:37 +01:00
Ali Mohammad Pur
1b083392fa LibWasm+wasm: Switch to east-const to comply with project style
Against my better judgement, this change is mandated by the project code
style rules, even if it's not actually enforced.
2021-06-04 16:07:42 +04:30
Ali Mohammad Pur
23fd8bfd69 Userland/wasm: Replace manual noop export with an automatic one
Instead of manually specifying the types and names of imports to stub
out, `--export-noop` can be used to export stub functions for any
unresolved function import.
This makes running and debugging random wasm files much easier.
2021-06-04 16:07:42 +04:30
Ali Mohammad Pur
be62e4d1d7 LibWasm: Load and instantiate tables
This commit is a fairly large refactor, mainly because it unified the
two different ways that existed to represent references.
Now Reference values are also a kind of value.
It also implements a printer for values/references instead of copying
the implementation everywhere.
2021-06-04 16:07:42 +04:30
Ali Mohammad Pur
c392a0cf7f LibWasm: Implement the br.table instruction
Unlike its name, this instruction has nothing to do with tables, it's
just a very simple switch-case instruction.
2021-06-04 16:07:42 +04:30
Ali Mohammad Pur
9db418e1fb LibWasm: Read from and write to memory as little-endian
The spec says so, we must do so.
2021-06-04 16:07:42 +04:30
Ali Mohammad Pur
09cf1040ef LibJS/Tests: Catch exceptions in describe() itself
Otherwise exceptions thrown in that state would simply terminate the
test.
2021-06-04 16:07:42 +04:30
Ali Mohammad Pur
d7ba15371b Meta: Don't make wasm tests pass when they cannot read a module
Instead, just let them be treated as failing their respective test.
2021-06-04 16:07:42 +04:30
Jelle Raaijmakers
977addf76d Ports/PHP: Enable SQLite3 and iconv extensions 2021-06-04 13:03:13 +02:00
Liav A
6a9dc5562d Kernel: Use IO ports instad of MMIO with Bochs graphics in VirtualBox
This is needed for VirtualBox, because it doesn't support controlling
the device with MMIO.

Fixes #7558.
2021-06-04 13:02:32 +02:00
Liav A
d18d91dedc Kernel/Graphics: Add a proper method to check if Intel GPU is supported 2021-06-04 13:02:32 +02:00
Ali Mohammad Pur
824a40e95b AK: Inline *String::is_one_of<Ts...>()
Previously this was generating a crazy number of symbols, and it was
also pretty-damn-slow as it was defined recursively, which made the
compiler incapable of inlining it (due to the many many layers of
recursion before it terminated).
This commit replaces the recursion with a pack expansion and marks it
always-inline.
2021-06-04 12:57:14 +02:00