Commit graph

9154 commits

Author SHA1 Message Date
Sergey Bugaev
983e541584 Base: Fix a typo 2020-05-05 11:07:06 +02:00
AnotherTest
155853afb2 LibHTTP: Unify and generalise response handling logic 2020-05-05 11:04:06 +02:00
Itamar
3dd0f755d0 HackStudio: Show local variables in the debugger
We now have a Debug Information tab, which displays the variables in
the current scope in a tree view.
2020-05-05 11:01:36 +02:00
Itamar
09ac22b37f HackStudio: Take scrolling into consideration when painting breakpoints
Also, we now scroll to the currently executed line when execution is
paused in the debugger.
2020-05-05 11:01:36 +02:00
Itamar
c5eb20d0cc LibDebug: Parse DWARF information entries
We can now iterate the tree structure of the DIEs, access attribute
values and parse some very basic DWARF expressions.
2020-05-05 11:01:36 +02:00
Itamar
2cafc36d9c LibC: Remove ASSERT_NOT_REACHED in getrusage
The gcc port was hitting that assertion for some reason.

This patch fixes it.
2020-05-05 11:01:36 +02:00
AnotherTest
0a55679de4 LibWeb: Add canvas.quadraticCurveTo()
Also adds a test, and removes debug spam ™️
2020-05-05 09:21:07 +02:00
AnotherTest
9f3f98d4c0 LibGfx: Add Painter::draw_quadratic_bezier_curve()
Also adds a QuadraticBezierCurveTo mode to Gfx::Path
2020-05-05 09:21:07 +02:00
Emanuele Torre
73a7a589c2 js: Customise the behaviour of JS::Console with ReplConsoleClient
This also makes our JavaScript tests not fail.
2020-05-05 09:15:16 +02:00
Emanuele Torre
e91ab0cb02 LibJS: Implement ConsoleClient
Now, you can optionally specify a ConsoleClient, to customise the
behaviour of the LibJS Console.

To customise the console, create a new ConsoleClient class that inherits
from JS::ConsoleClient and override all the abstract methods.

When Console::log() is called, if Console has a ConsoleClient,
ConsoleClient::log() is called instead.

These abstract methods are Value(void) functions: you can return a Value
which will be returned by the JavaScript function which calls that
method, in JavaScript.
2020-05-05 09:15:16 +02:00
Emanuele Torre
bc7ed4524e LibJS: Add some helpers and use them to re-implement Console functions
Also add const overloads for some getters.

Also const-qualify Interpreter::join_arguments().
2020-05-05 09:15:16 +02:00
Emanuele Torre
92815f313a AK: run clang-format on PrintfImplementation.h 2020-05-05 09:15:16 +02:00
Emanuele Torre
8bd9f7e50e LibJS: run clang-format on all the files 2020-05-05 09:15:16 +02:00
Emanuele Torre
30519c22f6 LibJS: Re-implement console functions as wrappers around Console methods
Console methods are now Value(void) functions.

JavaScript functions in the JavaScript ConsoleObject are now implemented
as simple wrappers around Console methods.

This will make it possible for LibJS users to easily override the
default behaviour of JS console functions (even their return value!)
once we add a way to override Console behaviour.
2020-05-05 09:15:16 +02:00
Emanuele Torre
73bead5ae9 LibJS: Move join_args() in Interpreter
It can be useful outside of Runtime/ConsoleObject.cpp.
join_args() => Interpreter::join_arguments()
2020-05-05 09:15:16 +02:00
Emanuele Torre
046f9cf115 LibJS: Remove ConsoleMessage from LibJS
We don't need to store the past messages in LibJS.
We'll implement a way to let LibJS users expand the vanilla Console.
2020-05-05 09:15:16 +02:00
Andreas Kling
7dd49047f3 keymap: Fix crash introduced by 637ecdb
Just because a Vector has some inline capacity doesn't mean we can put
data at offsets < Vector::size().

Fixes #2104.
2020-05-05 00:12:51 +02:00
Linus Groh
454c1e6bbe LibJS: Implement rest parameters 2020-05-04 23:30:52 +02:00
Andreas Kling
9df71afdb3 LibWeb: Respect the <input size> attribute a bit more :^)
We now use the size attribute to determine the width of a text input.
2020-05-04 22:43:00 +02:00
Andreas Kling
0d2beddc74 LibWeb: Plumb the full HtmlView viewport rect down into the engine
Previously we would use the "content rect" as the viewport rect, which
could sometimes be smaller than the actual viewport rect as the content
size was based on the box geometry of the root layout node.

This fixes an issue on google.com where we would not render the main
logo image since it was "outside" the viewport. The root layout size
is currently very wrong on google.com but that's a separate issue. :^)
2020-05-04 22:35:29 +02:00
Andreas Kling
d3de2b7de5 LibWeb: Don't assert when trying to rebuild a single-node layout tree
This merely postpones dealing with partial layout tree rebuilds for a
while longer.
2020-05-04 22:34:14 +02:00
Andreas Kling
6886c6efa6 LibWeb: Don't generate a layout node for <input type="hidden"> 2020-05-04 22:33:49 +02:00
Andreas Kling
8fae4ee931 LibGUI: Add ScrollableWidget::viewport_rect_in_content_coordinates() 2020-05-04 22:33:20 +02:00
Sergey Bugaev
718271c9df Base: Document unveil(2)
Also, escape underscores in chroot_with_mount_flags.
2020-05-04 21:44:50 +02:00
Sergey Bugaev
183fa98214 LibMarkdown: Support multi-line list items
You can now continue one list item across several lines, as long as you indent
it the same as the first line of the item. For example:

* This is the first item,
  which spans multiple lines.
* This is the second item, which also has some
  *emphasis* in it.
2020-05-04 21:44:50 +02:00
Linus Groh
d4bfcea570 LibJS: Add indentation to sections in SwitchCase::dump()
This now matches the output of

Program
  (Variables)
    ...
  (Children)
    ...

or

FunctionDeclaration 'foo'
  (Parameters)
    ...
  (Body)
    ...

etc.

Also don't print each consequent statement index, it doesn't add any
value.
2020-05-04 21:42:47 +02:00
mattco98
adb4accab3 LibJS: Add template literals
Adds fully functioning template literals. Because template literals
contain expressions, most of the work has to be done in the Lexer rather
than the Parser. And because of the complexity of template literals
(expressions, nesting, escapes, etc), the Lexer needs to have some
template-related state.

When entering a new template literal, a TemplateLiteralStart token is
emitted. When inside a literal, all text will be parsed up until a '${'
or '`' (or EOF, but that's a syntax error) is seen, and then a
TemplateLiteralExprStart token is emitted. At this point, the Lexer
proceeds as normal, however it keeps track of the number of opening
and closing curly braces it has seen in order to determine the close
of the expression. Once it finds a matching curly brace for the '${',
a TemplateLiteralExprEnd token is emitted and the state is updated
accordingly.

When the Lexer is inside of a template literal, but not an expression,
and sees a '`', this must be the closing grave: a TemplateLiteralEnd
token is emitted.

The state required to correctly parse template strings consists of a
vector (for nesting) of two pieces of information: whether or not we
are in a template expression (as opposed to a template string); and
the count of the number of unmatched open curly braces we have seen
(only applicable if the Lexer is currently in a template expression).

TODO: Add support for template literal newlines in the JS REPL (this will
cause a syntax error currently):

    > `foo
    > bar`
    'foo
    bar'
2020-05-04 16:46:31 +02:00
Andreas Kling
2fdeb464f7 Meta: Add a basic "issue policy" to CONTRIBUTING.md 2020-05-04 13:49:15 +02:00
Andreas Kling
a75af443d4 LibX86: Simplify "register index to string" functions a bit 2020-05-04 13:49:15 +02:00
Andreas Kling
57b2b96a67 LibX86: Remove accidental camelCase in some names 2020-05-04 13:49:15 +02:00
Ben Wiederhake
b80ad2d791 MouseDemo: Add menu, using the new icon :^) 2020-05-04 09:58:14 +02:00
Ben Wiederhake
fe178b6234 SystemMenu+MouseDemo: Add menu entry and nice icons 2020-05-04 09:58:14 +02:00
Nathan Lanza
f4e6c4c6f0
Kernel: Use Multiboot macros instead of magic constants (#2090)
MUTLIBOOT_FRAMEBUFFER_TYPE_{RGB,EGA_TEXT} are defined in the Multiboot.h
header. Use those definitions instead of hard-coding 1 and 2.
2020-05-04 09:52:04 +02:00
Devashish
f22c973ba3 Meta: Add configuration for setting up project in CLion
This commit adds a CMakeLists.txt file that will be used by CLion to
configure the project and documentation explaining the steps to follow.
Configuring CLion this way enables important features like code
completion and file search. The configuration isn't perfect. There are
source files for which CLion cannot pick up the headers and asks to
manually include them from certain directories. But for the most part,
it works all right.
2020-05-04 09:50:45 +02:00
Ben Wiederhake
f09a8f8a6e sysctl: Permit 'sysctl -a' invocation
The point of '-a' is to list all keys.
It is counter-intuitive to require the user to then
supply a specific key additionally.
2020-05-04 09:41:43 +02:00
Ben Wiederhake
e6547a7e95 sysctl: Fix newlines in error messages 2020-05-04 09:41:43 +02:00
Emanuele Torre
de0ed0e2dc
AK: Rename variables with camelCase names in PrintfImplementation.h (#2095)
zeroPad => zero_pad
leftPad => left_pad
fieldWidth => field_width

These were the only variables with names in camelCase.
We were not consistent with the naming of these variables: some times we
called them zeroPad, leftPad, fieldWidth; other times we called them
zero_pad, left_pad, field_width.

These inconsistencies made the code hard to read, so I changed their
names to snake_case.

Also rename width => field_width in AK::print_hex()
2020-05-04 09:40:17 +02:00
Andrew Kaster
3cae4cee81 Shell: Check for invalid #! in commands 2020-05-04 09:39:05 +02:00
Andrew Kaster
3eb3c2477f AK: Add StringView::find_first/last_of
These methods search from the beginning or end of a string for the
first character in the input StringView and returns the position in
the string of the first match. Note that this is not a substring match.
Each comes with single char overloads for efficiency.
2020-05-04 09:39:05 +02:00
Linus Groh
94c28552c6 LibWeb: Add basic support for redirects 2020-05-04 00:01:31 +02:00
Andreas Kling
e09b83c60c LibTextCodec: Start fleshing out a simple text codec library
We're starting with a very basic decoding API and only ISO-8859-1 and
UTF-8 decoding (and UTF-8 decoding is really a no-op since String is
expected to be UTF-8.)
2020-05-03 23:01:58 +02:00
Andreas Kling
f3676ebef5 LibWeb: Handle iso-8859-1 web content a little bit better
We now look at the HTTP response headers for a Content-Type header and
try to parse it if present to find the text encoding.

If the text encoding is iso-8859-1, we turn all non-ASCII characters
into question marks. This makes Swedish Google load on my machine! :^)
2020-05-03 23:01:58 +02:00
Andreas Kling
eb6e35a1be ProtocolServer: Pass HTTP response headers to the client
We now store the response headers in a download object on the protocol
server side and pass it to the client when finishing up a download.

Response headers are passed as an IPC::Dictionary. :^)
2020-05-03 23:01:58 +02:00
Andreas Kling
a83d74b38c Base: Add browser bookmark for Google :^) 2020-05-03 23:01:58 +02:00
Andreas Kling
78943f031e LibIPC: Add a simple IPC::Dictionary type (String key -> String value) 2020-05-03 23:01:58 +02:00
Ben Wiederhake
dce3faff08 Kernel: Don't crash on invalid fcntl 2020-05-03 22:46:28 +02:00
Ben Wiederhake
b24cfd36ae Kernel: Demonstrate kernel crash on invalid fcntl 2020-05-03 22:46:28 +02:00
Andreas Kling
e6922c0d40 LibCrypto: Manage vector sizing manually in performance-critical places
Use Vector::resize_and_keep_capacity() to resize BigInt vectors to just
the right size without risking deallocation. Then do direct indexed
accesses to the underlying words (or use memset/memcpy.)

This gives a ~40% speed-up on the RSA tests in "test-crypto -t pk" :^)
2020-05-03 19:14:50 +02:00
Andreas Kling
baadde122b AK: Add Vector::resize_and_keep_capacity()
This function is just like resize() except it does not deallocate the
vector buffer when shrinking.
2020-05-03 19:14:50 +02:00
Andreas Kling
e7abbc6655 LibTLS: Put some debug spam behind an #ifdef 2020-05-03 19:14:50 +02:00