Commit graph

14676 commits

Author SHA1 Message Date
AnotherTest ec4980e875 AK: Ensure dual_pivot_quick_sort does not copy the pivots
Also add a test that would fail to compile if quick_sort tries to copy
anything :P
2020-12-10 11:02:02 +01:00
asynts 5b104eedaf AK: Fix offset calculation error in DuplexMemoryStream::write. 2020-12-09 21:17:24 +01:00
asynts ce15c9a04c AK: Fix unsigned integer underflow in DuplexMemoryStream::write. 2020-12-09 21:17:24 +01:00
Andreas Kling a34e023a33 LibC: Make getdelim() fail with EINVAL on null input pointers
This matches some other libc's.
2020-12-09 21:12:40 +01:00
asynts 2981f10a5e LibWeb: Apply suggested fixes. 2020-12-09 21:05:06 +01:00
asynts 1c7a834278 LibWeb: Expose DOM::Range to JavaScript. 2020-12-09 21:05:06 +01:00
asynts 10f9c85090 LibWeb: Make DOM::Range more suitable for JS. 2020-12-09 21:05:06 +01:00
asynts 4df0eeaa3d LibWeb: Join start and end after deleting selection. 2020-12-09 21:05:06 +01:00
asynts a94a1d9f9e LibWeb: Implement deletion of more complex selections. 2020-12-09 21:05:06 +01:00
asynts b3d7c5bfbc LibWeb: Fix many bugs with the editing. 2020-12-09 21:05:06 +01:00
asynts 78558c9f30 LibWeb: Add support for cursor movement and delete. 2020-12-09 21:05:06 +01:00
asynts e96faea1a2 LibWeb: Support range delection accross nodes with shared parent. 2020-12-09 21:05:06 +01:00
asynts 43dc47a494 LibWeb: Add support for range deletion. 2020-12-09 21:05:06 +01:00
asynts bbcc5a9332 LibWeb: Move editing stuff into EditEventHandler. 2020-12-09 21:05:06 +01:00
asynts 82aac98bea IDL: Produce better error messages when parsing IDL files. 2020-12-09 21:05:06 +01:00
asynts 78eff163ea AK: Add String::substring_view(size_t). 2020-12-09 21:05:06 +01:00
Linus Groh ac2358ff0d Meta: Add .pre-commit-config.yaml
This pre-commit config is quite simple: all it does for now is running
the already existing Meta/lint-ci.sh script to ensure no changes that
won't pass the CI linting step are committed.
Consequently pass_filenames is set to false, as these scripts will
determine which files to check themselves - should this ever become a
performance bottleneck, we can update them to accept an optional list of
filenames.

It should be noted that using pre-commit for Serenity development is by
no means a requirement, but doing so may decrease the number of CI
builds failing due to forgotten license headers etc. - especially if
you're pushing to `master` directly, rather than going through pull
requests *hint hint*.

For info how to install & use pre-commit, see https://pre-commit.com/.

Fixes #2365.
2020-12-09 21:04:07 +01:00
Sahan Fernando 9453032bf6
Userland: Fix overly-eager loop detection in cp (#4368)
The bug is that if you try to cp DIR_A to DIR_B where DIR_A and DIR_B
have the same parent directory and DIR_A's name is a prefix of DIR_B
(e.g. foo -> foo2, bar -> barbar), it thinks that it's a subdirectory
(since it checks if DIR_A's realpath is a prefix of DIR_B's realpath).

The easiest solution is to put a path delimiter at the end before the
comparison, since you can't have a / in the middle of a directory name.

For example if DIR_A is /home/anon/foo and DIR_B is /home/anon/foo2,
then DIR_A's realpath is a prefix of DIR_B's realpath even though DIR_B
is not inside DIR_A.
2020-12-09 20:56:50 +01:00
Sahan Fernando a3bcff0db8 Userland: Fix segfault in sort 2020-12-09 20:55:06 +01:00
Sahan Fernando 8e1bda0e9d LibGUI: Show action shortcut in ToolBarButton tooltip 2020-12-09 15:00:34 +01:00
Linus Groh 50b76e4cc7 LibWeb: Don't allocate XMLHttpRequestConstructor twice
add_constructor() will already allocate an XMLHttpRequestConstructor and
update m_xhr_constructor accordingly, we don't have to do it ourselves.
This is now in line with how all the LibJS constructors work. Also make
the XHR constructor responsible for setting its "prototype" property
itself, for consistency and fail-proofing.
Previously we would only set it on the constructor we allocated manually
but which was then thrown away, leading to the property never being set
properly.
2020-12-09 12:49:30 +01:00
Linus Groh 5e9f6f2e2c LibWeb: Disallow construction of XMLHttpRequest without 'new'
The XMLHttpRequest interface only has a constructor and isn't supposed
to be callable as a function.
https://xhr.spec.whatwg.org/#constructors
2020-12-09 12:47:13 +01:00
Linus Groh bdb924522f DisplaySettings: Ensure wallpaper mode is always initialized
If loading the WindowServer config fails or we get a value other than
"simple", "center", "tile", or "scaled", DisplaySettings would crash
when changing the wallpaper image.

Fixes #4360.
2020-12-09 12:46:59 +01:00
Andreas Kling 5b7fb92ede LibWeb: Build the DumpLayoutTree subdirectory 2020-12-08 23:41:56 +01:00
Andreas Kling 35ad102595 LibWeb: Add missing license header to DumpLayoutTree 2020-12-08 23:41:45 +01:00
Andreas Kling baf4c7d3f2 LibWeb: Remove an empty line from OOPWV 2020-12-08 23:40:45 +01:00
Andreas Kling f52ce49a36 LibWeb: Add a simple DumpLayoutTree program
This loads a page and, dumps the layout tree to stdout, and exits.
2020-12-08 23:36:19 +01:00
Andreas Kling cf646badfa LibWeb: Allow dumping layout tree into a StringBuilder 2020-12-08 23:36:19 +01:00
Andreas Kling eda9fb13cc LibWeb+WebContent: Add on_load_finish hook to web views
This isn't entirely symmetrical with on_load_start as it will also fire
on reloads and back/forward navigations. However, it's good enough for
some basic use cases, and we can do more sophisticated notifications
later on when we need them.
2020-12-08 23:36:19 +01:00
Andreas Kling 52dbdf4245 Browser: Don't focus the bookmarks bar overflow button on click 2020-12-08 23:36:19 +01:00
Andreas Kling e99cfd517c LibJS: Add test for Math.asin() 2020-12-08 23:36:19 +01:00
AnotherTest 17e1e1f114 Shell: Actually make shebangs work
Also check for executable permissions before actually trying to run, and
print a helpful message if not executable.
Fixes #4358
2020-12-08 23:34:38 +01:00
AnotherTest 0141f7e7fd Shell: Avoid recreating the event loop before exec()
This stops the local socket creation spam.
2020-12-08 23:34:38 +01:00
AnotherTest 3c41487db7 AK: Fix reading across chunks in DuplexMemoryStream 2020-12-08 23:34:38 +01:00
AnotherTest cd8268e6fb Shell: Put background jobs into new process groups too
Fixes #4345.
This was done in 54b453b in the name of "fixing event loop processing in
subshells", but I do not see how a new PGID is supposed to affect the event
loop.
This seems to have been done by mistake, let's see if any tests fail
because of this.
2020-12-08 23:34:38 +01:00
AnotherTest 59b46a1f51 Shell: Show termination signal if job did not exit cleanly 2020-12-08 23:34:38 +01:00
AnotherTest 48a1f7e55c Shell: Silence TCSETPGRP errors when not interactive 2020-12-08 23:34:38 +01:00
AnotherTest 57728ef29f Shell: Replace all dbg()'s with dbgln() 2020-12-08 23:34:38 +01:00
AnotherTest 602d2ff856 AK: Implement DuplexMemoryStream::offset_of() in terms of memmem()
This fixes the FIXME about missing matches that go across chunk
boundaries.
2020-12-08 23:34:38 +01:00
AnotherTest 036b39cdfd AK: Implement memmem() for iterator haystacks
This uses the KMP algorithm to implement the search.
Also replaces the slow route of the normal memmem() with KMP, which
should be fairly faster (O(n + m) as opposed to O(n * m)) :^)
2020-12-08 23:34:38 +01:00
AnotherTest f12c98b29f LibRegex: Add a basic Regex<...>::replace() 2020-12-08 23:34:38 +01:00
AnotherTest c85eaadb48 AK: Forward declare Nonnull{Own,Ref}PtrVector 2020-12-08 23:34:38 +01:00
AnotherTest 5325d6871d Shell: Make <return> go to a new line when the command is incomplete
"incomplete" meaning that it has a syntax error that can be recovered
from by continuing the input.
2020-12-08 23:34:38 +01:00
Andreas Kling 48d2545572 LibJS: Get rid of Argument and ArgumentVector
This was used for a feature where you could pass a vector of arguments
to enter_scope(). Since that way of passing arguments was not GC-aware
(as vectors use C++ heap storage), let's avoid using it and make sure
everything that needs to stay alive is either on the stack or in traced
storage instead.
2020-12-08 18:28:18 +01:00
Andreas Kling 38268f1c53 LibJS: Create lexical scope for "catch" on the spot when throwing 2020-12-08 18:22:47 +01:00
Andreas Kling fc9e43728b LibJS: Stop creating a redundant lexical scope on function call
We were scoping the arguments twice, first in execute_function_body(),
and then again in enter_scope().
2020-12-08 18:04:54 +01:00
Zac eb810d14c3
FileManager: Fix TreeView collapsing on file system changes (#4348)
TreeViews using FileSystemModels collapse whenever the file system is
changed in anyway. This includes creating, dragging, deleting or
pasting any files/folders. This commit updates the refresh_tree_view()
lambda, which seems to have stopped working at some point, and calls it
whenever any of the actions mentioned above are activated.
2020-12-08 17:51:53 +01:00
Andreas Kling 6496895b16 LibWeb: <iframe src> same-origin check should be based on host document
We were basing the src attribute's cross-origin check on whatever was
currently loaded in the iframe, instead of the surrounding document.

Fixes #4236.
2020-12-08 17:49:02 +01:00
Andreas Kling df2a6cb4ab LibJS: Add Math.acos() and Math.asin() 2020-12-08 17:49:02 +01:00
Andreas Kling 231171364d LibJS: Remove some unnecessary null checks
It's okay to add nullptr to the conservative roots set. We'll just
ignore it later on anyway.
2020-12-08 17:49:02 +01:00