Commit Graph

23121 Commits

Author SHA1 Message Date
Idan Horowitz
c830de4983 LibWeb: Replace usage of native properties with accessors in Window
This is required by the WebIDL specification.
2021-07-05 14:40:49 +01:00
Idan Horowitz
4fdf4bfbd0 LibWeb: Replace usage of native properties with accessors in Navigator
This is required by the WebIDL specification.
2021-07-05 14:40:49 +01:00
Idan Horowitz
6468a2bf21 LibWeb: Replace usage of native properties with accessors in Location
This is required by the WebIDL specification.
2021-07-05 14:40:49 +01:00
Linus Groh
073071c634 LibJS: Fix Promise constructor reject function argument
If calling the executor function throws an exception, the return value
of `vm.call()` will be an empty value, which we then passed as an
argument to the reject function, which is incorrect - what it actually
needs is the exception value. This stems from a misunderstanding of the
spec I had at the time of implementing this - in their case, the
exception value is part of the completion record returned by Call().

This error was previously masked as we would use a fallback
(`value_or(js_undefined())` for the empty value argument, but that was
removed in 57f7e6e.

Fixes #8447.
2021-07-05 14:14:54 +01:00
Linus Groh
fe9dc47320 LibJS: Make FunctionObject's m_home_object an Object*, not Value
As the name implies (and the spec confirms), this is only ever going to
be an object or "nothing", or "undefined" in the spec. By taking this
literally and updating a check to check for `is_undefined()`, we
introduced a bug - the value was still initialized as an empty value.
Instead, use a pointer to an Object - either we have one, or we don't.

Fixes #8448.
2021-07-05 13:53:30 +01:00
Linus Groh
83f3f396ad LibWeb: Use JS_DECLARE_NATIVE_FUNCTION for WebAssembly accessors 2021-07-05 12:43:24 +01:00
Linus Groh
b5da876817 LibWeb: Make WebAssembly.Memory.prototype.buffer an accessor property 2021-07-05 12:33:29 +01:00
Linus Groh
b73b6fbd4c LibWeb: Make WebAssembly.Instance.prototype.exports an accessor property 2021-07-05 12:33:08 +01:00
Linus Groh
79d8326370 LibWeb: Use "WebAssembly.Foo" in exception error messages
Not just "Foo" or "WebAssemblyFoo". This is how it's accessed from the
outside (JS).
Also fix one case of "not an" => "not a".
2021-07-05 12:32:51 +01:00
Idan Horowitz
d713a84851 LibJS: Stop masking non-RangeError exceptions in TypedArray creation
Non-RangeError exceptions can be thrown by user implementations of
valueOf (which are called by to_index), and the specification
disallows changing the type of the thrown error.
2021-07-05 12:16:24 +01:00
Idan Horowitz
3b81a7420e LibJS: Use the GetMethod AO for creating a TypedArray from an iterable 2021-07-05 12:16:24 +01:00
Idan Horowitz
086b6f11c4 LibJS: Enforce a 2GB "Excessive Length" limit for TypedArrays 2021-07-05 12:16:24 +01:00
Idan Horowitz
56335dab6c LibJS: Use the GetPrototypeFromConstructor AO for TypedArrays creation 2021-07-05 12:16:24 +01:00
Luke
9cae827f07 LibWeb: Implement Node.contains
Used by Web Components Polyfills.
2021-07-05 12:39:46 +02:00
Luke
a826df773e LibWeb: Make WrapperGenerator generate nullable wrapper types
Previously it was not doing so, and some code relied on this not being
the case.

In particular, set_caption, set_t_head and set_t_foot in
HTMLTableElement relied on this. This commit is not here to fix this,
so I added an assertion to make it equivalent to a reference for now.
2021-07-05 12:39:46 +02:00
Luke
62c015dc96 LibWeb: Implement the adoption steps for <template> elements
While I'm here with the cloning steps, let's implement this too.
2021-07-05 12:39:46 +02:00
Luke
a7fa757dd1 LibWeb: Implement the cloning steps for <template> elements 2021-07-05 12:39:46 +02:00
Luke
5897bc5c1f LibWeb: Make adopted_from no longer take a const Document reference
Nodes implementing the adoption steps can modify the passed in
document, for example HTMLTemplateElement does so to adopt it's
contents into the new document.
2021-07-05 12:39:46 +02:00
Luke
f3f2170ac6 LibWeb: Add the cloning steps in clone_node
This will be used in HTMLTemplateElement later to clone template
contents.

This makes the clone functions non-const in the process, as the cloning
steps can have side effects.
2021-07-05 12:39:46 +02:00
Luke
e4ae1cdd1f LibWeb: Use the element factory in clone_node
It was directly creating a new Element object instead of creating the
appropriate element.

For example, document.body.cloneNode(true) would return an Element
instead of an HTMLBodyElement.
2021-07-05 12:39:46 +02:00
Luke
5430bc8963 LibWeb: Make clone_node capable of cloning document fragments
Used by Web Components Polyfills.
2021-07-05 12:39:46 +02:00
Luke
f7ad8c0f94 LibWeb: Add DOMParser
This allows you to invoke the HTML document parser and retrieve a
document as though it was loaded as a web page, minus any scripting
ability.

This does not currently support XML parsing.

This is used by YouTube (or more accurately, Web Components Polyfills)
to polyfill templates.
2021-07-05 12:39:46 +02:00
Luke
0ea50d44bf LibWeb: Check if scripting is disabled before running script
This is not a full check, it's just enough to prevent script execution
in DOMParser.
2021-07-05 12:39:46 +02:00
stelar7
ce314c54bd JsonParser: Bring parser more to spec 2021-07-05 12:36:19 +02:00
Tom
31a2f10927 LibGfx: Fix classic theme frame transparency check
We shouldn't use the title stripe or title shadow colors to determine
whether the frame itself is going to have alpha channels or not. This
caused e.g. the classic theme's window frame to be rendered as
transparency just because the stripe color had an alpha channel of 0.
2021-07-05 12:29:14 +02:00
Gunnar Beutner
8c14488106 Kernel: Get rid of of some of the duplicate kernel base address macros 2021-07-05 12:28:45 +02:00
Gunnar Beutner
040fe0054b Kernel: Merge the x86 and x86_64 boot code into a single file
They're mostly the same apart from some x86_64-specific parts.
2021-07-05 12:28:45 +02:00
ForLoveOfCats
ce6658acc1 KeyboardSettings+Kernel: Setting to enable Num Lock on login 2021-07-05 06:19:59 +02:00
Andreas Kling
7fdeb0ec74 LibJS: Fix logic typo in ArgumentsObject.[[Set]]
Thanks to Linus for spotting this! :^)
2021-07-05 02:53:57 +02:00
Andreas Kling
a0acb6f058 LibJS: Fix accidental west-const in ArgumentsObject 2021-07-05 02:49:55 +02:00
Andreas Kling
77fa33e61a LibJS: Finish implementing mapped arguments exotic objects :^)
Now that the Object rewrite is in place, we have enough tools to
implement the mapped `arguments` propreties according to spec.

The basic mechanism is that the `arguments` object installs a hidden
parameter mapping object that property accesses get filtered through.
This is how accessing numeric properties on `arguments` are proxied
to the named identifier in the function scope.

When `arguments` is instantiated, getters and setters are created
for all the numeric properties on the object that correspond to
function arguments. These getters and setters can be deleted from the
object. This is all pretty intricate, so refer to the spec for details.

Note that the `arguments` object itself is still lazily instantiated
on first access within a function. This is non-conforming, and we'll
have to revisit this once we get around to improving function calls.
2021-07-05 02:38:31 +02:00
Andreas Kling
36cc011ae4 Fire: Make the main widget a GUI::Frame 2021-07-05 02:38:31 +02:00
Timothy Flynn
9f0aef6051 LibJS: Implement most of String.prototype.replaceAll
This also renames ErrorType::StringMatchAllNonGlobalRegExp to
ErrorType::StringNonGlobalRegExp (removes "MatchAll") because this error
is now used in the same way from multiple operations.
2021-07-05 01:10:43 +01:00
Linus Groh
cb20baebae LibJS: Make ObjectPrototype an immutable prototype exotic object
To make this happen, this patch implements the SetImmutablePrototype
abstract operation (as a method on Object) and then overrides
[[SetPrototypeOf]] on ObjectPrototype.
2021-07-05 00:53:57 +01:00
Idan Horowitz
fac8f9a94d LibJS: Add the TypedArray.from() method 2021-07-05 00:27:03 +01:00
Marcus Nilsson
2183d01eb0 PixelPaint: Ask to preserve transparency when exporting
Previously the alpha channel was thrown away when exporting to BMP or
PNG in PixelPaint, instead let the user decide.
2021-07-05 00:43:00 +02:00
Marcus Nilsson
8324ffefe7 LibGfx/BMPWriter: Add support for V3 & V4 DIB headers
This adds very simple support for storing BMP files with
BITMAPV3INFOHEADER and BITMAPV4HEADER. This in turn allows us to
store alpha channels which is nice for our .pp file format. For
the moment no data regarding colorspace is saved, only the bare
minimum to make a valid file.

Some small restructuring of the code is made to hopefully make it
easier to implement more DIB-headers and support for colorspace/gamma
correction in the future.
2021-07-05 00:43:00 +02:00
Linus Groh
9fe363eaad LibJS: Remove now unused IndexedPropertyIterator::value_and_attributes() 2021-07-05 00:03:25 +02:00
Linus Groh
9555ca99a0 LibJS: Remove unnecessary value_or() from get()
Object::get() never returns an empty value anymore, as per the spec, so
having a value_or() fallback is no longer needed.
2021-07-05 00:03:25 +02:00
Linus Groh
57f7e6e775 LibJS: Remove two unnecessary 'vm.argument(0).value_or(js_undefined())'
VM::argument() never returns an empty value.
2021-07-05 00:03:25 +02:00
Tom
fdf701ed96 WindowServer: Improve screen invalidation on window state changes
Because window states and various flags can affect the windows'
rendered areas it's safer to use the last computed occlusion rectangles
to invalidate areas on the screen that may have to be re-rendered due
to e.g. a window size change.

Fixes #6723
2021-07-05 00:03:13 +02:00
Tom
7fdf902e4a Kernel: Implement buffer flipping for VirtIOGPU framebuffers
This solves tearing issues and improves performance when updating the
VirtIOGPU framebuffers.
2021-07-04 23:59:17 +02:00
Tom
6e792553f2 WindowServer: Query driver for framebuffer offset
Depending on the driver, the second buffer may not be located right
after the first, e.g. it may be page aligned. This removes this
assumption and queries the driver for the appropriate offset.
2021-07-04 23:59:17 +02:00
Tom
fdae117600 WindowServer: Implement support for combined buffer flipping + flushing
Some devices may require DMA transfers to flush the updated buffer
areas prior to flipping. For those devices we track the areas that
require flushing prior to the next flip. For devices that do not
support flipping, but require flushing, we'll simply flush after
updating the front buffer.

This also adds a small optimization that skips these steps entirely for
a screen that doesn't have any updates that need to be rendered.
2021-07-04 23:59:17 +02:00
Andreas Kling
45a2bc27d5 Assistant: Don't index the /dev directory 2021-07-04 23:15:17 +02:00
Andreas Kling
085da369ff Assistant: Force the window to have a shadow despite being frameless 2021-07-04 23:15:17 +02:00
Andreas Kling
c2dfa9d54c WindowServer+LibGUI: Add a way to force a window to have a drop shadow 2021-07-04 23:15:17 +02:00
Andreas Kling
3368e54224 Magnifier: Make a custom 16x16 icon for this app + tweak 32x32 version
Stop piggybacking on the generic "find" icon and make a custom one. :^)
2021-07-04 23:15:17 +02:00
Andreas Kling
3e63633e1c Magnifier: Make the main widget a GUI::Frame
This makes the magnifier window look slightly nicer. :^)
2021-07-04 23:15:16 +02:00
Andreas Kling
782a5c88ce WindowServer: Make most remaining WindowServer IPC calls async
The only remaining sync call from client to server is now the call
that switches a window's backing store. That one actually relies on
the synchronization to hand over ownership of the backing stores,
so it has to stay synchronous for now.
2021-07-04 23:15:16 +02:00