Commit graph

3664 commits

Author SHA1 Message Date
Ali Mohammad Pur
2961982277 LibRegex: Use <...> includes in RegexMatch.h 2021-07-18 21:10:55 +04:30
Ali Mohammad Pur
5089fd8b3c LibRegex: Also print a newline after each debug line
Otherwise the new debug line would be printed right after the previous
one without a newline.
2021-07-18 21:10:55 +04:30
Ali Mohammad Pur
052004f92d LibRegex: Partially implement string compare for Utf32View 2021-07-18 21:10:55 +04:30
Ali Mohammad Pur
da1fda73a7 LibRegex: Implement line splitting for Utf32View
Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2021-07-18 21:10:55 +04:30
Tom
2f754013a1 LibGUI: Fix widgets not being occluded
Widget::is_visible_for_timer_purposes needs to also consult with the
base implementation, which ultimately checks the owning Window's
visibility and occlusion state. Widget::is_visible merely determins
whether a widget should be visible or not, regardless of the window's
state.

Fixes #8825
2021-07-18 18:39:20 +02:00
Gunnar Beutner
98f8ecd9d2 Kernel: Split debug symbols into a separate file
This speeds up the boot process considerably when specifying the kernel
image via -initrd.
2021-07-18 17:31:13 +02:00
Timothy
215f383b12 LibFileSystemAccessClient: Use WindowServer window stealing interface 2021-07-18 17:21:28 +02:00
Timothy
38594dde79 FileSystemAccessServer+TextEditor: Implement cross-process modal prompts
This transitions from synchronous IPC calls to asynchronous IPC calls
provided through a synchronous interface in LibFileSystemAccessClient
which allows the parent Application to stay responsive.

It achieves this with Promise which is pumping the Application event
loop while waiting for the Dialog to respond with the user's action.

LibFileSystemAccessClient provides a lazy singleton which also ensures
that FileSystemAccessServer is running in the event of a crash.

This also transitions TextEditor into using LibFileSystemAccessClient.
2021-07-18 17:21:28 +02:00
Gunnar Beutner
ab353fd4e1 LibIPC: Close the socket and die when the peer is closed
This will close the socket when the recv() returns 0 indicating that
the peer has shutdown, and when there are no pending bytes to be
processed.
2021-07-18 17:21:28 +02:00
Gunnar Beutner
e331ef7057 LibIPC: Add Connection::is_open()
This will allow clients to see if the IPC socket is still open.
2021-07-18 17:21:28 +02:00
Timothy
522f6775a7 LibGUI+WindowServer: Expose WindowServer client id to the client
This allows an WindowServer client to identify itself and allow future
cross-client functionality in WindowServer.
2021-07-18 17:21:28 +02:00
Peter Bindels
d4113f6028 LibJS: Correct test to work with our strtod on x86_64 & Clang
Modify constant to be half a ULP lower so our strtod also parses it
correctly. Needs to have issue associated for actually fully fixing
strtod to be correct, rather than correct-enough.
2021-07-18 12:45:10 +01:00
Peter Bindels
0a0089fc11 LibC strtod: Reduce incremental error to nearly nothing
Instead of scaling by 1/10th N times, scale 10^N and then divide by
that. Avoid doing this beyond double-infinity. This decreases the
progressive error for numbers outside of integer range immensely. Not
a full 100% fix; there is still a single ULP difference detected by a
Javascript test
2021-07-18 12:45:10 +01:00
Linus Groh
08a303172d LibJS: Extend class 'extends' RHS expression parsing
Instead of only parsing a primary expression, we should also allow
member expressions, call expressions, and tagged template literals (and
optional chains, which we don't have yet).
In the spec, all of this is covered by `LeftHandSideExpression`
(https://tc39.es/ecma262/#prod-LeftHandSideExpression).
2021-07-18 00:17:57 +01:00
Marcus Nilsson
72a5347f91 LibGUI: Pass path to FileSystemModel when creating FilePicker
This saves a few lstat lookups since otherwise '/' is indexed before
set_path() is called. It also cleans up warnings if '/' is not
unveiled when opening FilePicker, like in WidgetGallery.
2021-07-18 00:55:04 +02:00
Timothy Flynn
a2e734d202 LibJS: Report string length as the code point length, not byte length
For example, U+180E is 3 bytes, but should have a string length of 1.
2021-07-17 16:59:59 +01:00
Timothy Flynn
87848cdf7d AK: Track byte length, rather than code point length, in Utf8View::trim
Utf8View::trim uses Utf8View::substring_view to return its result, which
requires the input to be a byte offset/length rather than code point
length.
2021-07-17 16:59:59 +01:00
Peter Bindels
660a8982e7 LibM: Turn off builtins, fix tests & implementation
While trying to port to Clang we found that the functions as
implemented didn't actually work, and replacing them with a blatantly
broken function also did not break the tests on the GCC build. It
turns out we've been testing GCC's builtins by many tests. This
removes the use of builtins for LibM's tests (so we test the whole
function). It turns off the denormal test for scalbn (which was not
implemented) and comments out the tgamma(0.5) test which is too
inaccurate to be usable (and too complicated for me to fix). The gamma
function was made accurate for all other test cases, and asin received
two more layers of Taylor expansion to bring it within error margin
for the tests.
2021-07-17 17:37:20 +02:00
Max Wipfli
ccae0cae45 LibWeb: Rename HTMLToken::doctype_data() => ensure_doctype_data()
This renames the accessor to better reflect what it does, as this will
allocate a DoctypeData struct if there is none.
2021-07-17 16:24:57 +04:30
Max Wipfli
519a1cdc22 LibWeb: Change HTMLToken storage architecture
This completely changes how HTMLTokens store their data. Previously,
space was allocated for all token types separately. Now, the HTMLToken's
data is stored in just a String, two booleans and a Variant.

This change reduces sizeof(HTMLToken) from 68 to 32. Also, this reduces
raw tokenization time by around 20 to 50 percent, depending on the page.
Full document parsing time (with HTMLDocumentParser, on a local HTML
page without any dependency files) is reduced by between 4 and 20
percent, depending on the page.

Since tokenizing HTML pages can easily generated 50'000 tokens and more,
the storage has been designed in a way that avoids heap allocations
where possible, while trying to reduce the size of the tokens. The only
tokens which need to allocate on the heap are thus DOCTYPE tokens (max.
1 per document), and tag tokens (but only if they have attributes). This
way, only around 5 percent of all tokens generated need to allocate on
the heap (except for StringImpl allocations).
2021-07-17 16:24:57 +04:30
Max Wipfli
8a4c44db8c LibWeb: Make HTMLTokens non-copyable 2021-07-17 16:24:57 +04:30
Max Wipfli
7eb294df0d LibWeb: Move HTMLToken in HTMLDocumentParser
This replaces a copy construction of an HTMLToken with a move(). This
allows HTMLToken to be made non-copyable in a further commit.
2021-07-17 16:24:57 +04:30
Max Wipfli
2532bdfabf LibWeb: Remove friend class declarations from HTMLToken
Since all interaction with the HTMLToken class now happens over getters
and setters, there is no more need for HTMLTokenizer and
HTMLDocumentParser to have direct access to the members.
2021-07-17 16:24:57 +04:30
Max Wipfli
25cba4387b LibWeb: Add HTMLToken(Type) constructor and use it 2021-07-17 16:24:57 +04:30
Max Wipfli
f2e3c770f9 LibWeb: Use setter for HTMLToken::m_{start,end}_position 2021-07-17 16:24:57 +04:30
Max Wipfli
8b31e41692 LibWeb: Change HTMLToken::m_doctype into named DoctypeData struct
This is in preparation for an upcoming storage change of HTMLToken. In
contrast to the other token types, the accessor can hand out a mutable
reference to allow users to change parts of the DoctypeData easily.
2021-07-17 16:24:57 +04:30
Max Wipfli
918bde98b1 LibWeb: Hide implementation details of HTMLToken attribute list
Previously, HTMLToken would expose the Vector<Attribute> directly to
its users. In preparation for a future change, all users now use
implementation-agnostic APIs which do not expose the Vector directly.
2021-07-17 16:24:57 +04:30
Max Wipfli
15d8635afc LibWeb: User getter+setter for HTMLToken tag name and self-closing flag 2021-07-17 16:24:57 +04:30
Max Wipfli
1aeafcc58b LibWeb: Use getter and setter for Character type HTMLTokens
While storing the code point in a UTF-8 encoded String in horrendously
inefficient, this problem will be addressed at a later stage.
2021-07-17 16:24:57 +04:30
Max Wipfli
e8e9426b4f LibWeb: User getter and setter for Comment type HTMLTokens 2021-07-17 16:24:57 +04:30
Max Wipfli
f886aa15b8 LibWeb: Rename HTMLToken::AttributeBuilder struct to Attribute
This does not contain StringBuilders anymore, so it can do with a
simpler name: Attribute.
2021-07-17 16:24:57 +04:30
Max Wipfli
d82f3eb085 LibWeb: Make HTMLToken::{Position,AttributeBuilder} structs public
There was and is no reason for those to be private. Making them public
also allows us to explicitly specify the return type of some getters.
2021-07-17 16:24:57 +04:30
Jean-Baptiste Boric
ad6c385c9e LibC: Fix grp.h includes
That header file uses FILE*, which is defined in bits/FILE.h.

Fixes #8827.
2021-07-17 13:00:33 +02:00
Peter Bindels
a5a62f99c5 LibC: Use 64-bit stack smash value for 64-bit mode
Otherwise it'll use the first 32 bits that happen to come after,
leading to very weird bugs. Fixes #8601
2021-07-17 01:45:20 +02:00
Peter Bindels
85c2ad94d5 LibC: Make scanf always copy its va_list
On x86_64 GCC implements va_list as an array. This makes the syntax
for taking a pointer to it break & crash. The workaround / solution is
to create a copy. Since va_list is a tiny struct referencing the
actual varargs, this is little overhead (especially compared to
va_args itself)
2021-07-17 00:43:34 +02:00
Alexander
459aa44f6b LibWeb: Avoid UAF in query_selector{,_all}()
This fixes a bug that caused the selector to be dumped.
It would relase the RefPtr into a dump function, and then use it.
2021-07-17 01:48:04 +04:30
Linus Groh
86c6e68431 LibJS: Implement Temporal.Duration.prototype.abs() 2021-07-16 21:59:13 +01:00
Linus Groh
7df47bf3fb LibJS: Implement Temporal.Duration.prototype.negated() 2021-07-16 21:59:13 +01:00
Linus Groh
9aa1e4b885 LibJS: Implement Temporal.Duration.prototype.with() 2021-07-16 21:59:13 +01:00
Linus Groh
510f668ae3 LibJS: Add TokenType::{Debugger,With} to Token::is_identifier_name()
Also remove TokenType::Interface, that should be handled elsewhere (as
a 'future reserved word' in strict mode).
2021-07-16 21:59:13 +01:00
Ali Mohammad Pur
52a2518a69 LibWasm: Remove a useless use of ScopeGuard
There are no multiple exit paths in that function, so we can just put
the ending logic right at the end of the function instead.
2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
65cd5526cb LibWasm+Everywhere: Make the instruction count limit configurable
...and enable it for LibWeb and test-wasm.
Note that `wasm` will not be limited by this.
2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
70b94f58b2 LibWasm: Inline some very hot functions
These are mostly pretty small functions too, and they were about ~10%
of runtime.
2021-07-17 01:13:39 +04:30
Ali Mohammad Pur
23b48f8fe1 Revert "LibWasm: Some more performance stuff (#8812)"
This reverts commit 35394dbfaa.
I pushed the wrong button again, hopefully this will be the last of
such incidents.
2021-07-17 01:11:28 +04:30
Ali Mohammad Pur
35394dbfaa
LibWasm: Some more performance stuff (#8812)
* wasm: Don't try to print the function results if it traps

* LibWasm: Inline some very hot functions

These are mostly pretty small functions too, and they were about ~10%
of runtime.

* LibWasm+Everywhere: Make the instruction count limit configurable

...and enable it for LibWeb and test-wasm.
Note that `wasm` will not be limited by this.

* LibWasm: Remove a useless use of ScopeGuard

There are no multiple exit paths in that function, so we can just put
the ending logic right at the end of the function instead.
2021-07-17 01:04:37 +04:30
Timothy Flynn
860417fb4f LibJS: Ensure RegExpStringIterator keeps the RegExp matcher object alive
Fixes a crash found with 'test-js -g' due to this object going out of
scope.
2021-07-16 20:44:48 +02:00
Wesley Moret
1b8f73b6b3 LibPDF: Fix treating not finding the linearized dict as a fatal error
We now try to parse the first indirect value and see 
if it's the `Linearization Parameter Dictionary`. if it's not, we 
fallback to reading the xref table from the end of the document
2021-07-16 20:44:10 +02:00
Wesley Moret
5d4d70355e LibPDF: Fix checking minor_ver instead of major_ver 2021-07-16 20:44:10 +02:00
Idan Horowitz
8d01d43f5e LibJS: Replace the boolean argument of Object::set with an enum class
This is more serenity-esque and also makes pointing out missing
exception checks during reviews much easier.
2021-07-16 17:50:01 +01:00
Idan Horowitz
4b39e718b3 LibJS: Remove unused Object::PutOwnPropertyMode enum class
All usages of this enum class were removed in the Object rewrite, but
this enum was left behind.
2021-07-16 17:50:01 +01:00