Commit graph

18831 commits

Author SHA1 Message Date
Andreas Kling 942a5afd23 LibCore: Don't needlessly use StringView in Core::Object APIs
Taking a StringView parameter that gets immediately converted to
a String anyway is silly. Just take a String directly instead.

This pattern is the main reason we have the "StringView internal
StringImpl pointer" optimization, and I suspect that we can throw
that whole thing out if we make a couple more patches like this.
2021-04-17 01:27:29 +02:00
Andreas Kling 73aa59ccf1 Network.Applet: Avoid JsonObject copy and use StringBuilder::appendff() 2021-04-17 01:27:29 +02:00
Andreas Kling d33fdc925b LibGUI: Make GUI::Widget::set_tooltip() take a String
There was no reason for this to take a StringView.
2021-04-17 01:27:29 +02:00
Nicholas-Baron 4454735bf8 Kernel: Add -Wnull-dereference flag
`-Wnull-dereference` has found a lot of "possible null dereferences" in userland.
However, in the kernel, no warnings occurred. To keep it that way,
preemptivly add the flag here and remove it once it is enabled system
wide.

This flag makes the compiler check statically for a null deref. It does
not take into account any human-imposed invariants and as such, may need a
`VERIFY(ptr);`, `if(ptr)`, or `if(!ptr)` before using a pointer.
However, as long as a pointer is not reassigned,
the verify will be valid, meaning that adding `VERIFY` can be done sparingly.
2021-04-17 01:07:36 +02:00
Idan Horowitz 586f10b6e1 LibJS: Accept symbol property in the in operator
This is used by discord.com and allowed by the specification:
https://tc39.es/ecma262/#sec-relational-operators-runtime-semantics-evaluation
2021-04-17 00:59:36 +02:00
Tobias Christiansen 7744048d0f LibWeb: Fix misplaced bullet points on list items
The bullet point should not be centered in the height of the list item,
but rather stay in front of the first line.
So, instead of giving the marker the full height of the ListItemBox,
it gets the height of a single line.

This closes #6384
2021-04-17 00:28:55 +02:00
Idan Horowitz e3c634fdd0 LibJS: Implement initializing a TypedArray from an iterable object
Based on these specifications (which required IterableToList as well):
https://tc39.es/ecma262/#sec-typedarray
https://tc39.es/ecma262/#sec-initializetypedarrayfromlist
2021-04-17 00:24:09 +02:00
Idan Horowitz 06a2173586 LibJS: Implement initializing a TypedArray from an array-like object
Used by twitch.tv and based on the following specification:
https://tc39.es/ecma262/#sec-initializetypedarrayfromarraylike
2021-04-17 00:24:09 +02:00
James Triantafylos c9196995be LibGUI: Allow arbitrary font size in FontPicker
This commit adds a SpinBox to the FontPicker dialog to allow users to
set arbitrary font sizes (1 to 255 inclusive) for TTF fonts.
The SpinBox is only visible when the user is selecting a TTF font.
2021-04-16 23:54:03 +02:00
AnotherTest e4412f1f59 AK+Kernel: Make IntrusiveList capable of holding non-raw pointers
This should allow creating intrusive lists that have smart pointers,
while remaining free (compared to the impl before this commit) when
holding raw pointers :^)
As a sidenote, this also adds a `RawPtr<T>` type, which is just
equivalent to `T*`.
Note that this does not actually use such functionality, but is only
expected to pave the way for #6369, to replace NonnullRefPtrVector<T>
with intrusive lists.

As it is with zero-cost things, this makes the interface a bit less nice
by requiring the type name of what an `IntrusiveListNode` holds (and
optionally its container, if not RawPtr), and also requiring the type of
the container (normally `RawPtr`) on the `IntrusiveList` instance.
2021-04-16 22:26:52 +02:00
AnotherTest fb814ee720 AK: Avoid the unnecessarily confusing bunch of casts in IntrusiveList
And use bit_cast instead.
Also explain what it does, because it's not at all trivial
to understand :^)
2021-04-16 22:26:52 +02:00
Brendan Coles cfad6606f0 Ports: SDL2: Use correct CMAKE_TOOLCHAIN_FILE in configopts 2021-04-16 21:49:51 +02:00
AnotherTest 00e5af02be CI: Use clang-12 instead of clang-10 when building fuzzers
oss-fuzz uses clang-12 anyway, so this patch shouldn't be breaking
anything, just letting us use more modern C++ without the CI being
sad.
2021-04-16 21:48:00 +02:00
Linus Groh ba3bc6fef2 LibGUI+WindowServer: Fix some misaligned CMakeLists.txt SOURCES entries 2021-04-16 21:30:53 +02:00
Brendan Coles bb6bb7bc5e Meta: lint-ports: Check package files for required properties 2021-04-16 21:14:00 +02:00
Brendan Coles a206ab2211 Ports: Add auth_type verification to all package.sh files 2021-04-16 21:14:00 +02:00
Hendiadyoin1 6c618eb072 HexEditor: Use debgln_if 2021-04-16 20:03:35 +02:00
Hendiadyoin1 b8d381690c UserspaceEmulator: use outln_if 2021-04-16 20:03:35 +02:00
Hendiadyoin1 2e11b2d35a AK: Add outln_if and warnln_if
This uses the same gating mechanism as dbgln_if and should be equivalent
to #define flag etc
2021-04-16 20:03:35 +02:00
Jagger De Leo 2976311536 PixelPaint: Add keyboard zoom shortcuts
You can now use Ctrl+= and Ctrl+- to zoom in and out.
2021-04-16 19:57:28 +02:00
Jagger De Leo b48b8c372e PixelPaint: Add Zoom Reset button to new View Menubar.
If you lose your image while panning and zooming around, it is handy to
have a reset function to get back home. :^)
2021-04-16 19:57:28 +02:00
Idan Horowitz 223472c57f LibJS: Dont try to serialize symbol-keyed properties
As per the specification: "All Symbol-keyed properties will be
completely ignored, even when using the replacer function."
2021-04-16 19:22:29 +02:00
Idan Horowitz fff7aceb9d LibJS: Accept symbol property in ObjectPrototype::hasOwnProperty
This is used by discord.com and allowed by the specification
(https://tc39.es/ecma262/#sec-topropertykey)
2021-04-16 19:22:29 +02:00
Timothy Flynn 2381b19719 Browser+LibWeb+WebContent: Parse cookies in the OOP tab
To protect the main Browser process against nefarious cookies, parse the
cookies out-of-process and then send the parsed result over IPC to the
main process. This way, if the cookie parser blows up, only that tab
will be affected.
2021-04-16 19:19:31 +02:00
Timothy Flynn 6e10c2cdb7 LibCore+LibIPC: Add IPC coder for Core::DateTime
Since LibCore cannot depend on LibIPC, the coders are defined in LibIPC
just like they are for Core::AnonymousBuffer.
2021-04-16 19:19:31 +02:00
Timothy Flynn 99e1d8a359 AK: Add type alias for AK::Optional 2021-04-16 19:19:31 +02:00
Timothy Flynn 67884f6747 LibWeb: Impose a sane max cookie size
Drop cookies larger than 4KiB. This value is the RFC's recommendation:
https://tools.ietf.org/html/rfc6265#section-6.1
2021-04-16 19:19:31 +02:00
Gunnar Beutner da92c0e1ca Ports: Build shared libraries for a few more ports
This manually builds shared libraries for a bunch of ports. Using
libtool would be preferable but that's currently broken so I'm
linking the shared libraries manually.
2021-04-16 19:04:24 +02:00
Gunnar Beutner c9d5358685 Ports: Make sure ports are installed into /usr/local 2021-04-16 19:04:24 +02:00
Gunnar Beutner 960079b020 LibELF: Add support for loading libraries from /usr/local 2021-04-16 19:04:24 +02:00
Gunnar Beutner 594d480391 Toolchain+Ports: Move the CMake toolchain file into a subdirectory 2021-04-16 19:04:24 +02:00
Gunnar Beutner c6c1e2037b Toolchain: Add platform definition for CMake
This also ensures that pkg-config finds packages in /usr/local
and changes the install prefix to /usr/local.
2021-04-16 19:04:24 +02:00
Nicholas-Baron 73dd293ec4 Everywhere: Add -Wdouble-promotion warning
This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
2021-04-16 19:01:54 +02:00
AnotherTest 6606d70826 LibDebug/Dwarf: Use dbgln_if() instead of '#if DWARF_DEBUG' 2021-04-16 19:00:30 +02:00
Gunnar Beutner 03d705d531 UserspaceEmulator: Print stacktrace for unhandled exceptions 2021-04-16 19:00:30 +02:00
Gunnar Beutner b731db6691 LibDebug: Add support for StandardOpcodes::FixAdvancePc 2021-04-16 19:00:30 +02:00
Gunnar Beutner 4f6914a0c0 LibDebug: Add array bounds check for m_source_files 2021-04-16 19:00:30 +02:00
Linus Groh a5d4ef462c LibJS: Remove #if !defined(KERNEL)
AK::JsonValue::{is,as}_double() is not available in the kernel, but that
doesn't affect LibJS.
2021-04-16 18:57:58 +02:00
sin-ack 091d352526 Kernel: Add some missing socket ioctls
This patch adds a few missing ioctls which were required by Wine.
SIOCGIFNETMASK, SIOCGIFBRDADDR and SIOCGIFMTU are fully implemented,
while SIOCGIFFLAGS and SIOCGIFCONF are stubs.
2021-04-16 18:57:35 +02:00
sin-ack afb04cf544 man: Update SystemServer(5) documentation with new Socket style
This patch adds new information about the usage of multiple sockets with
eager services and the new socket takeover mechanism exposed by
SystemServer.
2021-04-16 18:22:10 +02:00
Gunnar Beutner 1aa34d9d6a Ports: Update the gcc port to 10.3.0 2021-04-16 17:57:22 +02:00
Gunnar Beutner 3d8311ac7b Ports: Remove obsolete patch for mrsh 2021-04-16 17:56:12 +02:00
Gunnar Beutner 92749d9a76 LibC: Don't call initializers in crt0
The dynamic linker is already taking care of this for us. Now
that crt0 is statically linked into each executable and shared
library this breaks things because initializers are invoked twice.

Before this PR this didn't crash because crt0 and its _start()
function was contained in LibC and thus only LibC's initializers were
invoked several times which wasn't as much of a problem because
these initializers didn't have any side effects (such as malloc/free).

However, user programs are more likely to have constructors with side
effects, e.g.:

    std::string g_test("hello!");

This would allocate memory when the constructor is invoked. When it is
invoked again the original allocation would be leaked and another copy
of the string would get allocated. Worse still, when the destructors are
invoked twice the memory would get free'd twice which would likely
crash the program.
2021-04-16 17:56:12 +02:00
Gunnar Beutner 50e4cad4a0 Toolchain+LibC: Don't link LibC against crt0
Instead GCC should be used to automatically link against crt0
and crt0_shared depending on the type of object file that is being
built.

Unfortunately this requires a rebuild of the toolchain as well
as everything that has been built with the old GCC.
2021-04-16 17:56:12 +02:00
Gunnar Beutner 67516fa555 LibC: Shared libraries shouldn't have an entry point
The _start() function attempts to call main() which is a
problem when trying to build a shared library with --no-undefined:

  $ echo > t.c
  $ gcc -shared -Wl,--no-undefined -o t.so t.c
  /usr/local/lib/gcc/i686-pc-serenity/10.2.0/../../../../i686-pc-serenity/bin/ld:
  /usr/lib/crt0_shared.o: in function `_start':
  ./Build/i686/../../Userland/Libraries/LibC/crt0_shared.cpp:56: undefined reference to `main'
  collect2: error: ld returned 1 exit status

Also, unless explicitly requested by the user shared libraries
should not have an entry point (e.g. _start) at all.
2021-04-16 17:56:12 +02:00
Matthew Olsson d719e745fb AK: Fix incorrect formatter signing of numbers between -1.0 and 0.0
Floating point numbers are casted to i64 and passed to the integer
formatting logic, and the floating point portion of the number is
handled separately. However, casting to i64 when the number is between
-1.0 and 0.0 produces 0, so the sign would be lost. This commit fixes
that by using put_u64 instead, which allows us to manually provide the
is_negative flag.
2021-04-16 17:42:42 +02:00
João Moreno bf8223926a
Documentation: Fix the path to the disk image on WSL 2021-04-16 17:41:21 +02:00
FalseHonesty a5b4d4434e LibDebug: Fix typo in handle_special_opcode method name
handle_sepcial_opcode -> handle_special_opcode :)
2021-04-16 17:40:24 +02:00
Federico Guerinoni e9837bed33
Ports: Bump git to 2.31.1 2021-04-16 17:38:54 +02:00
Linus Groh e632186c17 WindowServer: Recalculate window rect when toggling menubar
This is important when the window is maximized or tiled (which
recalculate_rect() will both check), as we otherwise create a gap above
the window frame (when hiding the menubar) or push the frame off the
screen (when showing the menubar).
2021-04-16 17:28:05 +02:00