Commit Graph

28282 Commits

Author SHA1 Message Date
Andreas Kling
0a90d466a0 LibWeb: Expose CSSStyleDeclaration on the window object 2021-09-28 23:28:44 +02:00
Andreas Kling
651f30dfbe WebContent: Coalesce paint invalidations to avoid spamming client
Some content cause a lot of paint invalidations (e.g someone drawing to
a <canvas> repeatedly) and we don't need to spam the client about this.
Instead, accumulate a dirty rect, and send it once per event loop step.
2021-09-28 22:53:59 +02:00
Andreas Kling
82af69376b LibJS: Avoid unnecessary HashMap copy in FunctionEnvironment 2021-09-28 22:32:40 +02:00
Andreas Kling
d294a3f54a LibJS: Avoid unnecessary HashMap growth in Interpreter::enter_scope()
Don't bother pre-allocating a hash map if we're not gonna put anything
into it anyway.
2021-09-28 22:32:40 +02:00
Andreas Kling
5855b19ff3 LibJS: Avoid unnecessary HashMap copy in ECMAScriptFunctionObject 2021-09-28 22:32:40 +02:00
Ali Mohammad Pur
3d24850db5 LibTLS: Mark the connection as finished and disconnected on TLS error 2021-09-28 22:32:31 +02:00
Ali Mohammad Pur
f0e2c517fc LibWeb: Implement the dns-prefetch and preconnect link relationships 2021-09-28 22:32:31 +02:00
Ali Mohammad Pur
e9b9f89e70 LibWeb: Use Document::parse_url() for preload links 2021-09-28 22:32:31 +02:00
Ali Mohammad Pur
3ec39fc62e RequestServer+LibProtocol: Add an 'EnsureConnection' IPC endpoint
This will allow LibWeb (and other components) to request a connection to
be premade and cached, to make subsequent loads faster.
2021-09-28 22:32:31 +02:00
Andreas Kling
6b2e4f896b LibDebug: Add missing break in AddressRanges::for_each_range() 2021-09-28 18:05:42 +02:00
Rodrigo Tobar
a8fae3d2c8 LibPthread: Add first test cases for RWlock 2021-09-28 18:36:20 +03:30
Rodrigo Tobar
69b64a6b04 AK: Accept StringView in LexicalPath::join
The first argument for LexicalPath::join was a String const&, which
resulted in an unnecessary memory copy when invoked with a StringView.
Changing the type of the parameter to StringView avoids the extra cost.

This was noticed while working on #10230.
2021-09-28 18:06:06 +03:00
Andreas Kling
0af0ee4293 LibWeb: Fire "keyup" events as well :^)
This was easy, now that we have KeyboardEvent.
2021-09-28 16:56:24 +02:00
Andreas Kling
554c344ffe LibWeb: Add a basic KeyboardEvent and fire "keydown" events :^) 2021-09-28 16:56:24 +02:00
Itamar
09153b8997 LibDebug: Use DW_AT_ranges to get address ranges of DIEs
Previously, we only supported DIEs with a contiguous address ranges and
ignored ones with a non-contiguous set of ranges.

We now check if a DIE has the DW_AT_ranges attribute, and if it does we
parse its range list.

This improves the quality of our backtraces - we previously missed many
inlined function calls because their DIEs had non-contigues address
ranges.
2021-09-28 16:54:39 +02:00
Itamar
26a96d315d LibDebug: Support parsing non-contiguous DWARF address ranges
This adds support for parsing DWARF "range lists", which are identified
by the DW_AT_ranges form.

They contain code addresses for DIEs whose location is not contiguous.
2021-09-28 16:54:39 +02:00
Itamar
2b04a86d4d LibDebug: Add Dwarf::CompilationUnit::base_address()
The base address of the compilation unit is used in some range lists
entry types.
2021-09-28 16:54:39 +02:00
Idan Horowitz
01417c82c5 LibWeb: Make URLSearchParams iterable
This uses the new support for the iterable IDL property.
2021-09-28 16:51:27 +02:00
Idan Horowitz
14e99b9b68 LibJS: Change create_iterator_result_object's return type to Object*
This always returns an Object, so there's no reason to return a less
explicit Value.
2021-09-28 16:51:27 +02:00
Idan Horowitz
cdde3ba5c5 LibWeb: Add partial support for IDL Iterable declarations
This currently only supports pair iterables (i.e. iterable<key, value>)
support for value iterables (i.e. iterable<value>) is left as TODO().

Since currently our cmake setup calls the WrapperGenerator separately
and unconditionally for each (hard-coded) output file iterable wrappers
have to be explicitly marked so in the CMakeLists.txt declaration, we
could likely improve this in the future by querying WrapperGenerator
for the outputs based on the IDL.
2021-09-28 16:51:27 +02:00
Idan Horowitz
2fab43ba5d LibWeb: Add support for wrapping arbitrary values to WrapperGenerator
This patch essentially just splits the non return-specific logic from
generate_return_statement (i.e. the wrapping of the cpp value into
a javascript one) into a separate function generate_wrap_statement that
can be used to wrap any cpp value during wrapper generation.
2021-09-28 16:51:27 +02:00
Idan Horowitz
a11f7868a4 LibWeb: Only consume [a-zA-Z0-9_] characters for IDL types 2021-09-28 16:51:27 +02:00
Ali Mohammad Pur
72a45a472a LibPthread: Correct nonsensical loop exit condition in RWLock unlock
The loop should terminate after the exchange happens, we shouldn't
repeat the operation until the count hits zero.
Fixes #10241.
2021-09-28 12:34:51 +03:30
Ali Mohammad Pur
b63ea3bad1 LibPthread: Calculate the correct lock value in RWLock {rd,un}lock
The previous version was putting the old count in the control bits,
which is all kinds of wrong.
2021-09-28 12:32:46 +03:30
Brian Gianforcaro
ca7bb812f6 Meta: Explicitly disable caching in the Sonar Cloud workflow
Sonar Cloud raises a warning if this is not Explicitly enabled or
disabled, so lets mark it disabled to avoid that.
2021-09-28 10:58:09 +02:00
Brian Gianforcaro
ea2d68d14b Assistant: Zero initialize fuzzy match array
SonarCloud flagged the read of the matches array as a potential garbage
read. I don't believe the case it flagged was possible to reach due to
how the code is structured, however we should really just be zero
initializing these stack arrays.
2021-09-28 10:58:09 +02:00
Brian Gianforcaro
998234f9e9 LibCpp: Remove redundant comparison to Token::Type::PipePipe
SonarCloud flagged this 'Identical sub-expressions on both sides of
operator "||"'. When looking at the git history it looks like it was
just a copy / paste mistake that happened when Token::Type::Arrow
support was added.
2021-09-28 10:58:09 +02:00
Brian Gianforcaro
69bc04d870 LibDSP: Remove unused Effects::Delay::m_old_delay_size member
SonarCloud flagged this as m_delay_buffer is technically uninitialized
at the point at which the POD types are initialized in a constructor.

I don't check to see if this was actually a real issue, as the member
is ultimately unused. So lets just get rid of it.
2021-09-28 10:58:09 +02:00
Brian Gianforcaro
8fcdc255ff man: Add "-z seperate-code" to man7/Mitigations.md
Update the mitigations documentation with the lateest mitigation.
2021-09-28 10:57:00 +02:00
Brian Gianforcaro
afb09e84db Documentation: Add AK::SourceLocation pattern to Patterns.md
Document the emergent pattern of using `SourceLocation` for capture
file, line, function name information when calling an API.
2021-09-28 10:57:00 +02:00
Brian Gianforcaro
f71f1d66d6 Documentation: Add operator"" sv pattern to Patterns.md 2021-09-28 10:57:00 +02:00
Rodrigo Tobar
ad33efbc8c SystemMonitor: Unveil /usr/local/lib
This is necessary to symbolicate libraries installed under
/usr/local/lib.
2021-09-28 10:55:14 +02:00
Rodrigo Tobar
12e18e44ae LibSymbolication: Look for libraries under /usr/local/lib
While trying to investigate a problem with the ssl module in the python
port I found that the SystemMonitor Stack tab for a process wouldn't
show the symbols for the libssl and libcrypto shared libraries that are
installed under /usr/local/lib. The main reason for this is that
LibSymbolication didn't look for libraries under /usr/local/lib.

This commit adds support for looking for libraries under /usr/local/lib.
Absolute paths are still respected, and lookup gives precedence to
/usr/lib, just like dynamic linker does.
2021-09-28 10:55:14 +02:00
Rodrigo Tobar
f4ebcf4867 LibSymbolication: Return empty value on error
This was probably the intended behavior, but a return statement was
missing.
2021-09-28 10:55:14 +02:00
Hendiadyoin1
683bf558e4 AK: Add missing AK/Types.h include to VirtIO/Protocol.h
How did this even work?
2021-09-28 03:13:54 +03:00
Idan Horowitz
b56b0ba689 AK: Eliminate avoidable strlen call in String::matches
We already know the length of these substrings, so there's no need to
check their lengths using strlen in the StringView(char*) constructor.

This patch also removes an accidental 1-byte OOB read that was left over
from when this method received null-terminated char pointers instead of
string views, as well removes the unnecessary lambda call (two of the
checks were impossible, and this was only called in one place, so we can
just inline it)
2021-09-28 00:31:45 +02:00
Luke Wilde
f7ac3545cc LibWeb: Add initial support for CustomEvent
This is used surprisingly often. For example, it is used by a core
YouTube library called Structured Page Fragments.

It allows you to manually dispatch an event with arbitrary data
attached to it.

The only thing missing from this implementation is the constructor.
This is because WrapperGenerator is currently missing dictionary
capabilities.
2021-09-27 18:45:45 +02:00
Luke Wilde
b04fafee74 LibWeb: Add some missing events in EventWrapperFactory
I noticed some events we being wrapped into a generic Event while
working on CustomEvent. This also adds PageTransitionEvent's
constructor to the WindowObject.

I'm not sure if this is all of them.
2021-09-27 18:45:45 +02:00
Luke Wilde
067d839615 LibWeb: Add support for the any type in returning and parameters
Required for CustomEvent.
2021-09-27 18:45:45 +02:00
Luke Wilde
d30ec4d790 LibWeb: Add [CustomVisit] IDL interface extended attribute
This custom attribute will be used for objects that hold onto arbitrary
JS::Value's. This is needed as JS::Handle can only be constructed for
objects that implement JS::Cell, which JS::Value doesn't.

This works by overriding the `visit_edges` function in the wrapper.
This overridden function calls the base `visit_edges` and then forwards
it to the underlying implementation.

This will be used for CustomEvent, which must hold onto an arbitrary
JS::Value for it's entire lifespan.
2021-09-27 18:45:45 +02:00
Andreas Kling
8da21583db LibWeb: Make SVG <path> tolerate relative first path coordinates
If the first element of an SVG path spec uses relative coordinates,
we'll now treat them as absolute. This is achieved by defaulting to
(0,0) as the initial "last point" in the path.
2021-09-27 18:29:10 +02:00
Andreas Kling
975a71de45 LibWeb: Implement the Document.activeElement attribute
We were already tracking the active element in DOM::Document, so all we
had to do here was add the attribute to Document.idl :^)
2021-09-27 16:52:22 +02:00
Andreas Kling
7410736b0f LibWeb: Support window.devicePixelRatio
This always returns 1 for now. I've added a FIXME about returning 2 in
HiDPI mode.
2021-09-27 16:52:22 +02:00
Andreas Kling
e26e85a3d2 LibWeb: Support Document.hidden and Document.visibilityState
These just act as if the document is always visible for now.
2021-09-27 16:52:22 +02:00
Karol Kosek
484f6a7cfa LibCore: Buffer small byte reads
Prior this change, if you had a program which frequently reads small
amount of bytes, then it would constantly fire up syscalls.

This patch sets that the minimum size that is passed to the read syscall
is 1024 and then it saves these additional bytes in a buffer for next
reads, which greatly improves the cpu usage on such cases.

In other words: reading flacs is now very efficient.
2021-09-27 16:31:28 +02:00
Karol Kosek
48a925b1d2 LibCore: Add optional custom read size argument in populate_read_buffer
This is a small preparation so IODevice::read() can use it in the next
commit.
2021-09-27 16:31:28 +02:00
Edward Palmer
2f01d34b99 Documentation: Add build file copy instruction 2021-09-27 16:30:38 +02:00
FrHun
34844dd547 LibGUI: Refine AbstractButton pressing behaviour
Previously the code couldn't handle leaving the AbstractButton through
tab, while having it pressed through space or enter.
2021-09-27 16:29:50 +02:00
Liav A
acd44bdcad Kernel/Graphics: Modernize somewhat the code of BochsGraphicsAdapter
Reduce the amount of macros in favor to enum classes.
2021-09-27 16:15:04 +02:00
Liav A
38bddca378 Kernel/Graphics: Ensure we set BGR format of bochs-display if supported
Instead of blindly forcing BGR format on the bochs-display device, let's
ensure we do that only on QEMU bochs-display and not on VirtualBox
graphics adapter too.
2021-09-27 16:15:04 +02:00