Commit graph

10289 commits

Author SHA1 Message Date
Matthew Olsson
d5ae73a63b LibJS: Add Object.{isExtensible,preventExtensions}() 2020-06-02 08:50:26 +02:00
Keith
daa3f59a55
Base: Fix misspelling in getopt(3) (#2473) 2020-06-02 07:40:26 +02:00
Andreas Kling
9170edf541 LibWeb: Protect ourselves during ResourceClient iteration
Notifying a Resource's clients may lead to arbitrary JS execution,
so we can't rely on the ResourceClient pointers remaining valid.
Use WeakPtr to avoid this problem.
2020-06-01 22:09:38 +02:00
Andreas Kling
e5ddb76a67 LibWeb: Support "td" and "th" start tags during "in table body"
This makes it possible to load Google Image Search results. You can't
see the images yet, but it's still something. :^)
2020-06-01 22:09:09 +02:00
Andreas Kling
7af337764e LibWeb: Add a naive Resource cache
This patch introduces a caching mechanism in ResourceLoader. It's keyed
on a LoadRequest object which is what you provide to load_resource()
when you want to load a resource.

We currently never prune the cache, so resources will stay in there
forever. This is obviously not gonna stay that way, but we're just
getting started here. :^)

This should drastically reduce the number of requests when loading
some sites (like Twitter) that reuse the same images over and over.
2020-06-01 21:58:29 +02:00
Andreas Kling
f249f07699 AK: Add operator== and hash traits for URL 2020-06-01 21:50:07 +02:00
Andreas Kling
5ed66cb8d9 LibWeb: Start building a new Resource class to share more resources
A Resource represents a resource that we're loading, have loaded or
will soon load. Basically, it's a downloadable resource that can be
shared by multiple clients.

A typical usecase is multiple <img> elements with the same src.
In a future patch, we will try to make sure that those <img> elements
get the same Resource if possible. This will reduce network usage,
memory usage, and CPU usage. :^)

For now, this first patch simply introduces the mechanism.

You get a Resource by calling ResourceLoader::load_resource().
To get notified about changes to a Resource's load status, you inherit
from ResourceClient and implement the callbacks you're interested in.

This patch turns HTMLImageElement into a ResourceClient.
2020-06-01 21:36:43 +02:00
Andreas Kling
7be9cf8d36 LibGfx: Add ImageDecoder factory overload for ByteBuffers 2020-06-01 21:32:54 +02:00
Andreas Kling
6ed11f1d1c LibWeb: Move ResourceLoader into a new Loader/ directory 2020-06-01 20:42:50 +02:00
Andreas Kling
77a3710e9d LibWeb: Tokenize "anything else" in CommentLessThanSignBangDashDash 2020-06-01 20:14:23 +02:00
Andreas Kling
b2a7137f57 LibTLS: Put a little more debug spam behind TLS_DEBUG 2020-06-01 20:13:53 +02:00
Andreas Kling
e58e315e0f LibWeb: Make input widget (buttons, text boxes, etc) scroll with page
We now relayout all LayoutWidgets when the view is scrolled. This will
cause them to follow along with the rest of the page content.
2020-06-01 19:52:38 +02:00
AnotherTest
889a8e7d0f LibLine: Handle interrupts again
This commit makes LibLine handle interrupts (as reported via
interrupted() and resized()) again.
There is a little catch with the shell:
```
$     ls |
pipe> <C-c> (prompt stays here until a key is pressed)
```
2020-06-01 19:52:20 +02:00
Andreas Kling
29029568ee WindowServer: Remove keyboard shortcut for toggling the system menu
100% of the time I activated this shortcut, I did not want to activate
this shortcut.
2020-06-01 19:24:10 +02:00
Andreas Kling
8766e49a7c LibWeb+Browser: Use the new HTML parser by default
You can still run the old parser with "br -O", but the new one is good
enough to be the default parser now. We'll fix issues as we go and
eventually remove the old one completely. :^)
2020-06-01 19:08:31 +02:00
Andreas Kling
517cf65c99 LibGUI: Tweak AboutDialog a bit, remove big Buggie from system variant
One Buggie is enough, it looks a lot less confused without the big one.
Also make the dialog a bit shorter since there was a lot of dead space.
2020-06-01 18:50:28 +02:00
Andreas Kling
db93db8100 LibWeb: Put whining about tokenizer errors behind an #ifdef
Real web content has *tons* of tokenizer errors and we don't need to
complain every time as that makes the debug log unbearable.
2020-06-01 18:46:11 +02:00
Andreas Kling
5944abf31c LibWeb: More parser cases in the "in body" and "after after body" modes 2020-06-01 18:46:11 +02:00
Andreas Kling
a775c2c717 LibWeb: Handle more cases in the SelfClosingStartTag tokenizer state 2020-06-01 18:46:11 +02:00
Andreas Kling
8429551368 LibWeb: Implement more of the "after head" insertion mode 2020-06-01 18:46:11 +02:00
Sergey Bugaev
600fcd2d46 LibJS: Replace some parser assertions by syntax errors
When parsing JavaScript, we can get pretty much any sequnce of tokens,
and we shouldn't crash if it's not something that we normally expect.
Instead, emit syntax errors.
2020-06-01 17:37:44 +02:00
Sergey Bugaev
2fbc37befc LibJS: Fix undefined behavior in HeapBlock
In C++, it's invalid to cast a block of memory to a complex type without
invoking its constructor. It's even more invalid to simply cast a pointer to a
block of memory to a pointer to *an abstract type*.

To fix this, make sure FreelistEntry is a concrete type, and call its
constructor whenever appropriate.
2020-06-01 17:37:44 +02:00
Sergey Bugaev
53a94b8bbd LibJS: Fix casting a value to ScriptFunction without checking it's one 2020-06-01 17:37:44 +02:00
Sergey Bugaev
1274c244d5 LibJS: Fix out-of-bounds read when parsing escape sequences
We cannot look at i+1'th character until we verify it's there.
2020-06-01 17:37:44 +02:00
Sergey Bugaev
80f671e16c Lagom: Fix target name 2020-06-01 17:37:44 +02:00
Tom
b5f827d560 HPET: Fix accessing HPET registers
This resolves a bochs panic during bootup:

[Kernel]: HPET @ P0x07ff0fc0
00691951632p[HPET  ] >>PANIC<< Unsupported HPET read at address 0x0000fed00100

These changes however don't fully resolve #2162
2020-06-01 17:35:51 +02:00
Matthew Olsson
ab576e610c LibJS: Rewrite Parser.parse_object_expression()
This rewrite drastically increases the accuracy of object literals.
Additionally, an "assertIsSyntaxError" function has been added to
test-common.js to assist in testing syntax errors.
2020-06-01 13:11:21 +02:00
Sergey Bugaev
05b7fec517 Kernel: Tighten up some promise checks
Since we're not keeping compatibility with OpenBSD about what promises are
required for which syscalls, tighten things up so that they make more sense.
2020-05-31 21:38:50 +02:00
Sergey Bugaev
a77405665f Kernel: Fix overflow in Process::validate_{read,write}_typed()
Userspace could pass us a large count to overflow the check. I'm not enough of a
haxx0r to write an actual exploit though.
2020-05-31 21:38:50 +02:00
Sergey Bugaev
c3db694d9b AK: Always inline some Checked methods
Once again, we need to hint the compiler that it should inline the function, and
then it is able to eliminate the assertion.
2020-05-31 21:38:50 +02:00
FalseHonesty
75e42648e1 HackStudio: Allow changing variable values in debugger
This patch adds a context menu to variables in the debugger variable
tree view that has an option to set the value of a variable. An input
box will pop up asking for the new value of the variable, which
is then parsed and used to set the actual variable.
2020-05-31 10:52:25 +02:00
Andreas Kling
ab40cc60d1 Kernel: Fix glitched audio output in SB16 driver
We were not setting the DMA transfer mode correctly. I have absolutely
no clue how this could ever have worked, but it did work for months
until it suddenly didn't.

Anyways, this fixes that. The sound is still a little bit glitchy and
that could probably be fixed by using the SB16's auto-initialized mode.
2020-05-31 03:40:58 +02:00
Linus Groh
e33820b557 LibJS: Add String.fromCharCode() 2020-05-31 02:19:52 +02:00
AnotherTest
8c05e78b6c Shell: Treat ^D as builtin_exit when not in a continuation 2020-05-30 23:01:36 +02:00
Andreas Kling
f3b09ddd8e LibWeb: Implement more of the ScriptDataEndTagName tokenizer state
Some of this is extremely repetitive. We'll need to rethink how we
do queue/emit to improve this.
2020-05-30 23:00:35 +02:00
Andreas Kling
d058addd74 LibWeb: Handle "dd" and "dt" end tags during "in body" 2020-05-30 23:00:35 +02:00
Andreas Kling
1a15ca2de4 Browser: Show download progress in the taskbar if available 2020-05-30 23:00:35 +02:00
Andreas Kling
853d900ee8 pro: Show download progress in the terminal window if available :^) 2020-05-30 23:00:35 +02:00
Andreas Kling
29ab518003 LibJS: Show run-tests progress in the taskbar
Use the window progress escape sequence to indicate how far along in
the test collection we are while running tests. :^)
2020-05-30 23:00:35 +02:00
Andreas Kling
165f69023b LibVT: Allow updating the window progress via an escape sequence
You can now request an update of the terminal's window progress by
sending this escape sequence:

<esc>]9;<value>;<max_value>;<escape><backslash>

I'm sure we can find many interesting uses for this! :^)
2020-05-30 23:00:35 +02:00
Andreas Kling
e263dc8427 Taskbar: Show window progress as a progress bar behind the window title
If a window in the taskbar has progress, we'll now draw that progress
in the form of a progress bar behind the window title on the taskbar
button for the window.
2020-05-30 23:00:35 +02:00
Andreas Kling
1d6ec51bee WindowServer+LibGUI: Add per-window progress
Each window now has an associated progress integer that can be updated
via the SetWindowProgress IPC call.

This can be used by clients to indicate the progress of ongoing tasks.
Any number in the range 0 through 100 indicate a progress percentage.
Any other number means "no progress"
2020-05-30 23:00:35 +02:00
Sergey Bugaev
8449f0a15b LibIPC: Fix server crashes on client disconnects
The server should always survive client communication errors.
2020-05-30 22:31:08 +02:00
AnotherTest
4aa3d08e21 Userland/js: Prompt for more input on labels and object keys
Closes #2452
2020-05-30 20:35:48 +02:00
Andreas Kling
ca6fbefbc9 LibWeb: Support parsing "select" elements (outside of tables) 2020-05-30 19:58:52 +02:00
Andreas Kling
60352c7b9b LibWeb: Hack the parser to dodge <template> elements in <head> for now 2020-05-30 19:23:04 +02:00
Andreas Kling
1212485348 LibWeb: Fix typo in StackOfOpenElements::topmost_special_node_below()
Backwards iteration works better if we actually go backwards! :^)
2020-05-30 18:49:48 +02:00
Andreas Kling
ca23db10ef LibWeb: Don't crash when encountering <svg> or <math> elements
Just treat them like unknown elements for now. :^)
2020-05-30 18:46:39 +02:00
Andreas Kling
756829555a LibWeb: Parse "textarea" tags during the "in body" insertion mode
Had to handle some more cases in the tokenizer to support this.
2020-05-30 18:40:23 +02:00
Andreas Kling
f4778d1ba0 LibWeb: Add missing special tag case in the "in body" insertion mode 2020-05-30 18:26:44 +02:00