Commit Graph

16093 Commits

Author SHA1 Message Date
Andreas Kling
9e45594dc8 LibWeb: Stub out the PerformanceTiming object from Navigation Timing
Just have all the timing functions return 0 for now.

We can now run the Shynet JS on https://linus.dev/ although the XHR
is rejected by our same-origin policy.
2021-01-18 15:11:20 +01:00
Andreas Kling
c99e35485a LibWeb: Add support for XMLHttpRequest request headers
Implement XMLHttpRequest.setRequestHeader() and include the headers in
the outgoing HTTP request.
2021-01-18 14:02:58 +01:00
Andreas Kling
0639e77898 LibWeb: Make the Window object "inherit" from EventTarget :^)
Since Web::Bindings::WindowObject inherits from JS::GlobalObject, it
cannot also inherit from Web::Bindings::EventTargetWrapper.

However, that's not actually necessary. Instead, we simply set the
Window object's prototype to the EventTargetPrototype, and add a little
extra branch in the impl_from() function that turns the JS "this" value
into a DOM::EventTarget*.

With this, you can now call window.addEventListener()! Very cool :^)

Fixes #4758.
2021-01-18 12:18:29 +01:00
Andreas Kling
fd83918476 LibWeb: Move IDL attributes and functions to the prototype
Instead of each IDL interface wrapper having its own set of all the
attributes and functions, they are moved to the prototype. This matches
what we already do in LibJS.

Also, this should be spec compliant with the web as well, though there
may be *some* content out there that expects some things to be directly
on the wrapper since that's how things used to work in major browsers
a long time ago. But let's just not worry about that for now.

More work towards #4789
2021-01-18 12:18:29 +01:00
Andreas Kling
630cbc947a LibWeb: Construct the IDL interface prototype chains automatically
Have each IDL prototype trigger the construction of its own prototype.
2021-01-18 12:18:29 +01:00
Andreas Kling
ee7fa49b88 LibWeb: Actually instantiate all the web constructors/prototypes
We now instantiate all the generated web API constructors and expose
them on the window object. We also set the generated prototypes on
instantiated wrappers.

Also, we should obviously find a way to generate this code. :^)
2021-01-18 12:18:29 +01:00
Andreas Kling
252a98042d LibWeb: Generate constructor and prototype classes for IDL interfaces
This patch adds a FooPrototype and FooConstructor class for each IDL
interface we generate JS bindings for.

These classes are very primitive and don't do everything they should
yet, but we have to start somewhere. :^)

Work towards #4789
2021-01-18 12:18:29 +01:00
Andreas Kling
81839ea1bd LibJS: Add JS::NativeFunction to the forwarding header 2021-01-18 12:18:29 +01:00
Andreas Kling
0db6835e73 LibWeb: Move HTML::SubmitEvent functions out of line 2021-01-18 12:18:29 +01:00
AnotherTest
10c3168fa0 Base: Remove irrelevant example from Shell's loop manpage section
Seems like it was copied one too many times.
2021-01-18 08:56:34 +01:00
AnotherTest
ffd74a2c5a Base: Mention that the if condition is a command
Sorta closes #4991.
2021-01-18 08:56:34 +01:00
AnotherTest
5b79d0d1a3 Shell: Allow newlines between else and if's closing brace
This is more flexible and intuitive. Fixes #4992.
2021-01-18 08:56:34 +01:00
Andreas Kling
a6917465d7 Kernel: Assert on attempt to mark inode metadata dirty on read-only FS 2021-01-17 21:32:59 +01:00
Andreas Kling
121594ace2 Kernel: Remove /proc/PID/vmobjects
This file was useful for debugging a long time ago, but has bitrotted
at this point. Instead of updating it, let's just remove it since
nothing is using it.
2021-01-17 21:16:13 +01:00
Andreas Kling
cfe54f86bd Kernel: Remove unused /proc/mm file
This was a file I used very early on to dump information about kernel
VM objects. It's long since superseded by other JSON-based files.
2021-01-17 21:14:20 +01:00
Andreas Kling
57a2394cb4 Kernel: Unbreak /proc/PID/root symlink
The generator callback for this file was mistakenly returning false
on success, which caused the kernel to fail sys$readlink() with ENOENT.
2021-01-17 21:11:21 +01:00
Tom
1d621ab172 Kernel: Some futex improvements
This adds support for FUTEX_WAKE_OP, FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET,
FUTEX_REQUEUE, and FUTEX_CMP_REQUEUE, as well well as global and private
futex and absolute/relative timeouts against the appropriate clock. This
also changes the implementation so that kernel resources are only used when
a thread is blocked on a futex.

Global futexes are implemented as offsets in VMObjects, so that different
processes can share a futex against the same VMObject despite potentially
being mapped at different virtual addresses.
2021-01-17 20:30:31 +01:00
Tom
7581b64705 AK: Add Vector::remove overload for removing entire ranges 2021-01-17 20:30:31 +01:00
Tom
b17a889320 Kernel: Add safe atomic functions
This allows us to perform atomic operations on potentially unsafe
user space pointers.
2021-01-17 20:30:31 +01:00
Andreas Kling
992f513ad2 Kernel: Limit exec arguments and environment to 1/8th of stack each
This sort-of matches what some other systems do and seems like a
generally sane thing to do instead of allowing programs to spawn a
child with a nearly full stack.
2021-01-17 18:29:56 +01:00
Andreas Kling
6613cef2f8 Ext2FS: Update block group directory count after directory removal
When freeing an inode, we were checking if it's a directory *after*
wiping the inode metadata. This caused us to forget updating the block
group descriptor with the new directory count.
2021-01-17 16:56:07 +01:00
Nico Weber
1382bbfc57 LibGfx: Make Painter take the scale factor as constructor argument
I want to give Bitmap an intrinsic scale factor and this is a step
in that direction.

No behavior change.
2021-01-17 16:10:21 +01:00
Andreas Kling
7a0bc2fdb8 LibGfx: Convert all the dbg() in BMPLoader to dbgln()
Also get rid of the awkward IF_BMP_DEBUG macro while we're here.
2021-01-17 15:42:10 +01:00
Andreas Kling
1730c23775 Kernel: Remove a bunch of no-longer-necessary SmapDisablers
We forgot to remove the automatic SMAP disablers after fixing up all
this code to not access userspace memory directly. Let's lock things
down at last. :^)
2021-01-17 15:03:07 +01:00
Andreas Kling
fd441b954d LibWeb: Add fast_is<T>() for some DOM and layout node subclasses
The generic is<T>() uses dynamic_cast which is fine in the majority
of cases, but when one of them shows up in profiles, we can make it
faster by answering the is-a question manually.
2021-01-17 14:42:50 +01:00
Andreas Kling
65fa0c2774 AK: Make is<T>(input) use input.fast_is<T>() if available
This allows classes to provide an optimized is<T> via the fast_is<T>()
member function.
2021-01-17 14:42:23 +01:00
Andreas Kling
4da913bfab LibJS: Replace ASTNode::class_name() with RTTI
This is only used for debugging anyway, so performance doesn't matter
too much.
2021-01-17 14:36:53 +01:00
Andreas Kling
647cfcb641 Kernel: Prune uninteresting kernel frames from profiling samples
Start capturing the sample stacks at the EIP/EBP of the pre-empted
thread instead of capturing EBP in the sampling function itself.
2021-01-17 14:36:53 +01:00
Andreas Kling
bf0719092f Kernel+Userland: Remove shared buffers (shbufs)
All users of this mechanism have been switched to anonymous files and
passing file descriptors with sendfd()/recvfd().

Shbufs got us where we are today, but it's time we say good-bye to them
and welcome a much more idiomatic replacement. :^)
2021-01-17 09:07:32 +01:00
Andreas Kling
2cd16778b5 AudioServer+LibAudio: Pass audio buffers as Core::AnonymousBuffer
This was the last remaining user of shbufs! :^)
2021-01-17 09:07:32 +01:00
Andreas Kling
cc8b3c92ba Everywhere: Remove a bunch of now-unnecessary shared_buffer pledges 2021-01-17 09:07:32 +01:00
Linus Groh
b42f0b9650 LibC: Change a couple of ASSERT_NOT_REACHED() to TODO()
Just for semantic correctness and better visibility of those
unimplemented stub functions.
2021-01-17 08:43:46 +01:00
Linus Groh
d64d2ff07b SpaceAnalyzer: Change tabs to spaces in GML file
This is a four-spaces-for-indentation project! :^)
2021-01-17 08:43:46 +01:00
Linus Groh
2bc9726e3c Ports: Rename a few .diff files to .patch
Let's keep things consistent, .diff is the name we use pretty much
everywhere. Also tweak the glob in .port_includes.sh to be
'patches/*.patch' rather than just 'patches/*'.
2021-01-17 08:43:46 +01:00
Linus Groh
95988b44a0 LibGfx: Let PNGLoader handle failed chunk decoding gracefully
decode_png_chunks() is not handling "critical" chunks, unlike
decode_png_size() for example. When we encounter a chunk decoding
failure, e.g. because not enough bytes were left to read, just continue
with decoding the bitmap - which will fail on its own, if we're missing
some required chunk(s).

Fixes #4984.
2021-01-17 08:09:20 +01:00
Andrew Thurman
6d20b54b09
Documentation: Add patch to fedora build deps (#4968) 2021-01-17 08:08:11 +01:00
Nico Weber
ca264030a2 WindowServer: Put default ScaleFactor in ini file
No behavior change. Matches Width and Height which also explicitly
have their default value in the ini file.
2021-01-17 08:06:12 +01:00
Nico Weber
d7a3128c1d DisplaySettings: Add more resolution choices
These are 2x the smallest 4 resolutions. When picking one of these
in 1x and then half the size in 2x, the window server adjust the
ui scale factor, but the actual framebuffer size doesn't change.

2560x1440 also happens to be 5k resolution and monitors with that
resolution do exist -- so that seems like a good upper limit :)
2021-01-17 08:06:12 +01:00
Nico Weber
f37f281f89 DisplaySettings: Add UI for switching the scale factor
For now, only support 1x and 2x scale.

I tried doing something "smarter" first where the UI would try
to keep the physical resolution constant when toggling between
1x and 2x, but many of the smaller 1x resolutions map to 2x
logical resolutions that Compositor rejects (e.g. 1024x768 becomes
512x384, which is less than the minimum 640x480 that Compositor
wants) and it felt complicated and overly magical.

So this instead just gives you a 1x/2x toggle and a dropdown
with logical (!) resolutions. That is, 800x600 @ 2x gives you
a physical resolution of 1600x1200.

If we don't like this after trying it for a while, we can change
the UI then.
2021-01-17 08:06:12 +01:00
Andreas Kling
05dbfe9ab6 Kernel: Remove sys$shbuf_seal() and userland wrappers
There are no remaining users of this syscall so let it go. :^)
2021-01-17 00:18:01 +01:00
Andreas Kling
5522e8f59d Clipboard+LibGUI: Move clipboard service to anonymous files 2021-01-17 00:14:37 +01:00
Andreas Kling
1cb44ec5ee Everywhere: Remove more <AK/SharedBuffer.h> includes 2021-01-17 00:04:42 +01:00
Andreas Kling
fe96418a70 LibGfx: Remove remaining SharedBuffer support in Gfx::Bitmap 2021-01-17 00:03:33 +01:00
Andreas Kling
447e6da52c ImageDecoder: Use Core::AnonymousBuffer and Gfx::ShareableBitmap
...instead of sending shbufs back and forth. :^)
2021-01-16 23:58:57 +01:00
Andreas Kling
8a61aba1e5 LibGfx+LibGUI: Make Gfx::ShareableBitmap transmit indexed palettes 2021-01-16 23:58:47 +01:00
Andreas Kling
b5d98c0945 LibWeb+WebContent: Use anonymous files for OOPWV backing stores
To support this, the GUI process and the WebContent service will now
coordinate their backing store bitmaps. Each backing store can be
referred to by a serial ID, and we don't need to keep resending it
as a file descriptor.

We should probably do something similar in WindowServer. :^)
2021-01-16 23:21:52 +01:00
Andreas Kling
04b2aeef33 LibGfx: Make Gfx::Bitmap::create_shareable() use an anonymous file
Note that this is only used by OOPWV in LibWeb at the moment.
2021-01-16 23:21:52 +01:00
Andreas Kling
c16e36be48 LibVT: Convert dbgprintf() => dbgln() and remove some debug code 2021-01-16 23:21:52 +01:00
Marco Cutecchia
14f075b26d SoundPlayer: Added 'shared_buffer' to pledge
This fixes a crash that occured when opening a file due to not pledging 'shared_buffer'
2021-01-16 22:54:21 +01:00
Andreas Kling
0571125dfe Kernel: Remove some unused code in the SharedBuffer class 2021-01-16 22:43:03 +01:00