Commit graph

14769 commits

Author SHA1 Message Date
Itamar
09ccdc697b Demos: Add "DynamicObjectDemo" to demo the dynamic loader 2020-12-14 23:05:53 +01:00
Itamar
79769ee74e LibELF: Allow elf files with no section header to pass validation 2020-12-14 23:05:53 +01:00
Itamar
07b4957361 Loader: Add dynamic loader program
The dynamic loader exists as /usr/lib/Loader.so and is loaded by the
kernel when ET_DYN programs are executed.

The dynamic loader is responsible for loading the dependencies of the
main program, allocating TLS storage, preparing all loaded objects for
execution and finally jumping to the entry of the main program.
2020-12-14 23:05:53 +01:00
Itamar
781aa424a9 LibC: Add NO_TLS preprocessor flag
When this flag is defined, LibC does not use TLS.
It will be useful for the dynamic loader.
2020-12-14 23:05:53 +01:00
Itamar
65ee2f07b7 LibC: Make it possible to use ASSERTs without initializing stdio 2020-12-14 23:05:53 +01:00
Itamar
b1c1d7661f Toolchain: Configure the path to the dynamic linker 2020-12-14 23:05:53 +01:00
Itamar
9ca1a0731f Kernel: Support TLS allocation from userspace
This adds an allocate_tls syscall through which a userspace process
can request the allocation of a TLS region with a given size.

This will be used by the dynamic loader to allocate TLS for the main
executable & its libraries.
2020-12-14 23:05:53 +01:00
Itamar
5b87904ab5 Kernel: Add ability to load interpreter instead of main program
When the main executable needs an interpreter, we load the requested
interpreter program, and pass to it an open file decsriptor to the main
executable via the auxiliary vector.

Note that we do not allocate a TLS region for the interpreter.
2020-12-14 23:05:53 +01:00
Itamar
711c42e25e Debugger: Add 'examine' command
This command outputs the memory contents of a given address as an
unsigned int.

LibDebug already had support for this, so just a matter of intergating
it in sdb.

Very useful :)
2020-12-14 23:05:53 +01:00
Itamar
a8cfb83d08 Debugger: Fix CLI parsing of breakpoint addresses
Previously, we only accepted addresses that started with digits
'0'-'9', which was not correct because we expect addresses to be in
base 16.
We now expect addresses to be written with '0x' prefix, e.g 0xdeadbeef.
2020-12-14 23:05:53 +01:00
Linus Groh
0974991d05 LibJS: Don't treat '?.' followed by decimal digit as QuestionMarkPeriod
From the spec: https://tc39.es/ecma262/#sec-punctuators

    OptionalChainingPunctuator ::
        ?. [lookahead ∉ DecimalDigit]

We were missing the lookahead and therefore incorrectly treating any
'?.' as TokenType::QuestionMarkPeriod.

Fixes #4409.
2020-12-14 22:25:46 +01:00
Andreas Kling
6e7edd6e77 LibWeb: Convert remaining CSS identifiers to use IdentifierStyleValue 2020-12-14 22:22:35 +01:00
Andreas Kling
96233bfc53 LibGfx: Draw checked buttons with a dithered base background
This looks just so right in the taskbar. :^)
2020-12-14 21:47:07 +01:00
Andreas Kling
396b09a1ec LibGUI: Don't focus BreadcrumbBar segments on click 2020-12-14 21:44:03 +01:00
Andreas Kling
b10255f93f FileManager: Use GUI::BreadcrumbBar :^)
FileManager windows now alternate between the old-style location text
box and a new-style breadcrumb bar. The location bar shows up when you
try to edit the location (with Ctrl+L) and disappears once the textbox
loses focus.

The textbox and breadcrumb bar are mutually exclusive to keep it tidy.
2020-12-14 20:43:42 +01:00
Andreas Kling
818f7777c8 LibGUI: Add a basic BreadcrumbBar widget! :^)
This can be used to implement segmented path bars in FileManager and
wherever else wanted.
2020-12-14 20:43:42 +01:00
Andreas Kling
b00a347ac5 LibGUI: Protect GUI::Button across firing the on_click hook
If a hook triggers the deletion of the GUI::Button, we would be unable
to proceed in a well-defined manner here, so let's protect ourselves.

This probably needs to be done in a whole lot of places, since GUI
widgets are just ref-counted Core::Objects and running arbitrary code
can mean that they get deleted.
2020-12-14 20:43:42 +01:00
Andreas Kling
dd2e8b7dd0 LibWeb: Use IdentifierStyleValue for CSS 'position' 2020-12-14 20:43:25 +01:00
Andreas Kling
3247ea3581 LibWeb: Use CSS::ValueID for 'text-align' values
Let's start moving away from using raw strings for CSS identifiers.
The idea here is to use IdentifierStyleValue with a CSS::ValueID inside
for all CSS identifier values.
2020-12-14 20:43:25 +01:00
Andreas Kling
08517daa5a LibWeb: Improvements to font lookup
Parse out the font-family, font-size and font-weight values from CSS
and use them to perform a kinda-best-effort lookup against the system
font library.

We also now handle standard font names like "sans-serif", "monospace"
and others.
2020-12-14 20:43:25 +01:00
Andreas Kling
861d22838d LibWeb: Virtualize StyleValue equality check
And use this to simplify comparing two IdentifierStyleValues.
2020-12-14 20:43:25 +01:00
Linus Groh
b04e0a7677 jp: Remove trailing comma at end of object/array to make output valid JSON
It's ironic that `jp` currently refuses to parse its own output :^)
2020-12-14 20:25:01 +01:00
Linus Groh
c07176bd53 jp: Only output colors when stdout is a TTY 2020-12-14 20:25:01 +01:00
Linus Groh
e68f4111ea jp: Use new format functions 2020-12-14 20:25:01 +01:00
Andreas Kling
bceb5b60f7 LibWeb: Add a little assertion in Document::detach_from_frame()
Let's just assert that we're detaching from the frame we thought we
were in.. just in case.
2020-12-14 13:47:07 +01:00
Andreas Kling
34d0141da3 LibWeb: Simplify <iframe> content frame construction
Now that documents are attached to their frame *before* parsing, we can
create the content frame of <iframe> elements right away, instead of
waiting for the host frame attachment.

Fixes #4408.
2020-12-14 13:45:57 +01:00
Andreas Kling
b861de0a13 LibWeb: Use final box model metrics for absolute 'right' and 'bottom'
We've already converted these to floats, so no need to do it again.
2020-12-14 12:49:35 +01:00
Andreas Kling
6809be436b LibWeb: Limit style update tree traversal to dirty subtrees
This patch adds a second style dirty bit that tracks whether a DOM node
has one or more children with dirty style. This allows the style update
to skip over entire subtrees where all nodes are clean.
2020-12-14 12:04:30 +01:00
Andreas Kling
d1479aef56 LibWeb: Layout absolutely positioned children *after* computing height
This is required for CSS "bottom" to work correctly on absolutely
positioned elements.
2020-12-14 11:33:11 +01:00
Andreas Kling
8b9f2c41fa LibWeb: Don't replace selection on key press in non-editable content 2020-12-14 10:58:10 +01:00
Andreas Kling
19144b753a LibWeb: Make StyleProperties::length_box() default to auto values
Undefined length values can default to auto in all length boxes and
we'll get the values we need. This saves us from having to deal with
undefined lengths later on in layout.

At some point we should break the style application process into
a few more formal steps, but this at least simplifies some things.
2020-12-14 10:53:40 +01:00
Andreas Kling
3c9dcec442 LibWeb: Merge Document::layout() and Document::update_layout()
There is now only Document::update_layout().
2020-12-14 10:39:57 +01:00
AnotherTest
dbfce38c90 LibTLS: Read subjectAltName from certificates and use it
As quite a few certificates use this extension, reading and using it to
find matching certificates is fairly useful :^)
2020-12-13 20:24:58 +01:00
Andreas Kling
48589db3aa Kernel/Net: Socket connected state change should reevaluate blocks
This fixes an issue where TCP sockets could get into the Established
state too quickly and fail to unblock a subsequent sys$select() call.

This makes websites load *significantly* faster. :^)
2020-12-13 19:15:42 +01:00
Andreas Kling
7b735b55e1 LibWeb: Set the encoding of HTML documents
Now that we attach the document to the frame before parsing, we have
to make sure we set the encoding on the document before parsing, or
things may not turn out well.
2020-12-13 18:21:52 +01:00
Andreas Kling
024059b49b LibTextCodec: Normalize incoming encodings in decoder_for()
Instead of asserting when you call TextCoded::decoder_for() with a
non-standard encoding name, let's be nice and see if we can't find a
decoder for the standardized version of the encoding name.
2020-12-13 18:20:50 +01:00
Andreas Kling
986ce57be9 LibTLS: TLSv12::read_line() should chomp result string
Match the Core::IODevice::read_line() API change and return a chomped
string from here as well.
2020-12-13 18:19:32 +01:00
Andreas Kling
b73d0bb6c8 LibWeb: Update stale #includes for HTML/TagNames.* move 2020-12-13 17:54:40 +01:00
Andreas Kling
1eee6716e0 LibWeb: Attach DOM::Document to its frame before parsing
FrameLoader now begins by constructing a DOM::Document, and then builds
a document tree inside it based on the MIME type. For text/html we pass
control to the HTMLDocumentParser as before.

This gives us access to things like window.alert() during parsing.

Fixes #3973.
2020-12-13 17:40:48 +01:00
Andreas Kling
22c582a887 LibWeb: Make HTMLDocumentParser take an existing document
We shouldn't really be creating the document objects inside the parser,
since that makes it hard to hook up e.g JavaScript bindings early on.
2020-12-13 16:59:22 +01:00
Andreas Kling
4dbecf0b65 LibWeb: Move DOM/TagNames.* => HTML/TagNames.* 2020-12-13 15:57:09 +01:00
Andreas Kling
59afcddcfe LibWeb: Mark element style dirty on style/id attribute change too 2020-12-13 15:22:41 +01:00
Andreas Kling
294ec3b6a5 LibWeb: Mark element style dirty when class attribute changes
Fixes #4403.
2020-12-13 15:22:22 +01:00
Andreas Kling
6af55a234f LibWeb: Make DOM::Node::set_needs_style_update() schedule the update
After you mark a node as needing new style, there's no situation in
which we don't want a style update to happen, so just take care of
scheduling it automatically.
2020-12-13 15:19:42 +01:00
Andreas Kling
b9b7b2b28a LibCore: Make IODevice::read_line() return a String
Almost everyone using this API actually wanted String instead of a
ByteBuffer anyway, and there were a bunch of slightly different ways
clients would convert to String.

Let's just cut out all the confusion and make it return String. :^)
2020-12-13 11:54:11 +01:00
Andreas Kling
4da327d650 DisplaySettings: Allow unsetting the wallpaper
It was previously not possible to unset the wallpaper once set,
since loading an image from the path "" would always fail.
2020-12-13 11:49:18 +01:00
Andreas Kling
545ed01e7d DisplaySettings: Remove a bunch of unnecessary "this->" 2020-12-13 11:49:18 +01:00
Andreas Kling
919d3dc56f DisplaySettings: Improve contrast of screen resolution label
Since we're putting this on top of the wallpaper preview, let's make
it white with a black shadow to ensure that it's always readable.
2020-12-13 11:49:18 +01:00
Andreas Kling
3ee5694e97 LibGUI: Simplify ComboBox/TextEditor relationship a bit
Instead of TextEditor knowing about the ComboBox button on the right
hand side, we now make ComboBox inherit from GUI::Frame, and make the
inner text editor widget frameless.

This allows us to place the button ourselves inside ComboBox without
any frame artifacts, and TextEditor no longer needs to keep track of
the geometry of that button.
2020-12-13 11:49:18 +01:00
Conrad Pankoff
a01d11ac19 AK: Add {encode,decode}_hex similar to {encode,decode}_base64 2020-12-13 11:00:20 +01:00