Commit graph

21756 commits

Author SHA1 Message Date
Idan Horowitz
59034554a4 LibJS: Account for differences in month representations (0-11 vs 1-12)
Since DateTime stores months as 1 to 12, while JS accepts months as
0 to 11, we have to account for the difference (by subtracting or
adding 1) where appropriate.
2021-06-06 19:14:11 +01:00
Idan Horowitz
b893963651 LibJS: Add Date.prototype.setDate() 2021-06-06 19:14:11 +01:00
Idan Horowitz
3eb05d9413 LibJS: Stub out Date.prototype.getTimezoneOffset()
We only support UTC currently, so this always returns 0 as long as the
date is not invalid.
2021-06-06 19:14:11 +01:00
Idan Horowitz
44926b3f80 LibJS: Ignore arguments in Date's constructor when called as a function
Since theres no way to drop the arguments before the call to the
constructor (or to signal to the constructor that it was not called
directly), we simply reuse the code for the no arguments provided
special case. (And to prevent code duplication, the code was extracted
into the separate static function Date::now(GlobalObject&).
2021-06-06 19:14:11 +01:00
Linus Groh
ba9d3bc38c LibJS: Create 1970-01-01 00:00:00 local time Date for invalid ctor call
When using Core::DateTime::from_timestamp(0) the resulting Date is
1970-01-01 00:00:00 in UTC, which might be something different in local
time - this is incorrect and relevant as invalid Dates can be made valid
later on.
2021-06-06 19:34:43 +02:00
Linus Groh
ff5aa3ca70 LibJS: Make it so that Date.prototype.toGMTString === .toUTCString 2021-06-06 19:34:43 +02:00
Linus Groh
60aace8400 LibJS: Remove unused includes from SymbolPrototype.cpp 2021-06-06 19:34:43 +02:00
Linus Groh
b661363dfe LibJS: Implement String.prototype[@@toPrimitive]() 2021-06-06 19:34:43 +02:00
Linus Groh
e9a0759b16 LibJS: Add String.prototype.valueOf()
It should have its own and not inherit from the Object prototype.
2021-06-06 19:34:43 +02:00
Linus Groh
8d7ec28924 LibJS: Remove String.prototype.length
A string's length property is supposed to be a regular non-writable,
non-enumerable, non-configurable property on the StringObject instead.
2021-06-06 19:34:43 +02:00
Linus Groh
fc2673d111 LibJS: Replace SymbolPrototype's typed_this() with this_symbol_value()
This brings the code close to the spec with no trade-offs, which is
always valuable.

No functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
6f96f01171 LibJS: Replace StringPrototype's typed_this() with this_string_value()
This brings the code close to the spec with no trade-offs, which is
always valuable.

No functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
68d669443f LibJS: Replace bigint_object_from() with this_bigint_value()
This brings the code close to the spec with no trade-offs, which is
always valuable.

No functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
d255e6892b LibJS: Update NumberPrototype's this_number_value() to take a Value
This is now about as close to the spec as it gets - instead of querying
the |this| value inside of the function, we now pass it in from the
outside.
Also get rid of the oddly specific error messages, they're nice but
pretty inconsistent with most others. Let's prefer consistency and
simplicity for now.

Other than that, no functionality change.
2021-06-06 19:34:43 +02:00
Linus Groh
3cfd9f51f7 LibJS: Replace some is_nullish() checks with require_object_coercible() 2021-06-06 19:34:43 +02:00
Linus Groh
cd12b2aa57 LibJS: Implement the RequireObjectCoercible abstract operation
Throws an exception if the given value is nullish, returns it otherwise.
We can now gradually replace such manual checks with this function where
applicable.

This also has the advantage that the somewhat useless "ToObject on null
or undefined" will be replaced with "null cannot be converted to an
object" or "undefined cannot be converted to an object". :^)
2021-06-06 19:34:43 +02:00
Kenneth Myhra
4ca4c43cbd Ports/freeciv: Add missing dependencies SDL2_gfx and curl (libcurl) 2021-06-06 18:22:56 +02:00
Andreas Kling
b968d44375 Base: Make anon's helper services run with 600 socket permissions
Some of these were using 660 permissions which meant that other users
in the "users" group could connect to anon's service processes.

Let's tighten things up by not allowing that. :^)
2021-06-06 18:03:57 +02:00
Andreas Kling
4c47b3951d Clipboard: Tighten pledge promises a bit earlier :^) 2021-06-06 17:56:34 +02:00
Andreas Kling
8f1d9c949d Clipboard: Remove unnecessary UID separation
This process is already sandboxed to the point where the UID doesn't
matter, so let's just stop having the separate "clipboard" user.
2021-06-06 17:56:34 +02:00
Andreas Kling
3dc1787306 NotificationServer: Remove unnecessary UID separation
This process is already sandboxed to the point where the UID doesn't
matter, so let's just stop having the separate "notify" user.
2021-06-06 17:56:34 +02:00
Andreas Kling
39c12f6f44 Base: Tidy up /etc/shadow
Prune removed user accounts and sort by UID, same as /etc/passwd
2021-06-06 17:56:34 +02:00
FalseHonesty
db20f7b6d8 Userland: Add matroska program to test parsing Matroska container files 2021-06-06 17:47:00 +02:00
FalseHonesty
403bb07443 LibVideo: Scaffold LibVideo and implement simplistic Matroska parser
This commit initializes the LibVideo library and implements parsing
basic Matroska container files. Currently, it will only parse audio
and video tracks.
2021-06-06 17:47:00 +02:00
Edwin Hoksberg
6a15bd06cb Ports: Fix zlib include directory for libzip 2021-06-06 17:45:15 +02:00
Max Wipfli
30cdebfa9e LibProtocol: Use URL class in RequestClient::start_request argument
This changes the RequestClient::start_request() method to take a URL
object instead of a URL string as argument. All callers of the method
already had a URL object anyway, and start_request() in turn parses the
URL string back into a URL object. This removes this unnecessary
conversion.
2021-06-06 16:00:11 +02:00
Max Wipfli
5b5f7bc360 LibProtocol: Change RequestClient.{cpp,h} to use east const style 2021-06-06 16:00:11 +02:00
Gunnar Beutner
3c2a6a25da Kernel: Don't finalize a thread while it still has code running
After marking a thread for death we might end up finalizing the thread
while it still has code to run, e.g. via:

Thread::block -> Thread::dispatch_one_pending_signal
-> Thread::dispatch_signal -> Process::terminate_due_to_signal
-> Process::die -> Process::kill_all_threads -> Thread::set_should_die

This marks the thread for death. It isn't destroyed at this point
though.

The scheduler then gets invoked via:

Thread::block -> Thread::relock_process

At that point we still have a registered blocker on the stack frame
which belongs to Thread::block. Thread::relock_process drops the
critical section which allows the scheduler to run.

When the thread is then scheduled out the scheduler sets the thread
state to Thread::Dying which allows the finalizer to destroy the Thread
object and its associated resources including the kernel stack.

This probably also affects objects other than blockers which rely
on their destructor to be run, however the problem was most noticible
because blockers are allocated on the stack of the dying thread and
cause an access violation when another thread touches the blocker
which belonged to the now-dead thread.

Fixes #7823.
2021-06-06 15:58:48 +02:00
Eugene Barnett
cab2ee5ea2 Magnifier: Add desktop display scale awareness
Continues to magnify correctly at the most current
desktop scale.
2021-06-06 15:56:43 +02:00
Eugene Barnett
4ef85de9dc WindowServer: Add a GetDesktopDisplayScale IPC request
Tells you which scale factor is configured in window manager.
2021-06-06 15:56:43 +02:00
Tobias Christiansen
19b22fbb4a Browser: Add various test pages to welcome
This adds test pages for border-radius, CSS custom properties and
flexboxes to the default page in the Browser.
I used those files to develop said features and they can be of use
when debugging in the future or just to showcase those features.
2021-06-06 11:33:18 +01:00
Andreas Kling
f290048662 LibJS: Pass unwinding target labels a bit more efficiently
Use const reference or move semantics when passing these labels.
2021-06-06 11:45:52 +02:00
dylanbobb
e24f1dfbe1 LibGUI: Don't delete within a line if the line is empty 2021-06-06 11:25:59 +02:00
Tom
2c8309c841 WindowServer: Simplify determining transparent/opaque occlusions
By moving the logic to determine what window areas (shadow, frame,
content) into WindowFrame::opaque/transparent_render_rects we can
simplify the occlusion calculation and properly handle more
arbitrary opaque/transparent areas.

This also solves the problem where we would render the entire
window frame as transparency only because the frame had a window
shadow.
2021-06-06 09:37:27 +01:00
Linus Groh
939da41fa1 LibRegex: Fix compilation errors on my host machine
I have no idea *why*, but this stopped working suddenly:

    return { { .code_point = '-', .is_character_class = false } };

Fails with:

    error: could not convert ‘{{'-', false}}’ from
    ‘<brace-enclosed initializer list>’ to
    ‘AK::Optional<regex::CharClassRangeElement>

Might be related to 66f15c2 somehow, going one past that commit makes
the build work again, however reverting the commit doesn't. Not sure
what's up with that.

Consider this patch a band-aid until we can find the reason and an
actual fix...

Compiler version:
gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)
2021-06-06 09:26:07 +01:00
Linus Groh
0a7e91329f Revert "Revert "AK: Always inline FlyString::view()""
This reverts commit f09216ac42.
This was supposed to be a local test only, didn't mean to push it. :^)
2021-06-06 08:05:49 +01:00
Linus Groh
887852f36d LibJS: Make Number.prototype.toString() radix coercion spec compliant
This should use the ToIntegerOrInfinity() abstract operation.
2021-06-06 07:03:12 +01:00
Linus Groh
adc3de4480 LibJS: Implement Number.prototype.valueOf() 2021-06-06 06:56:08 +01:00
Linus Groh
f09216ac42 Revert "AK: Always inline FlyString::view()"
This reverts commit 66f15c2e0c.
2021-06-06 01:58:09 +01:00
Idan Horowitz
0bf597e99d LibJS: Uncomment and add parseInt tests
Added another test that checks radices > 16, as well as uncommented
several "FIXME" tests that are now working.
2021-06-06 01:34:22 +01:00
Idan Horowitz
aa5b144f90 LibJS: Correct modulo behaviour in to_i32 to match the specification 2021-06-06 01:34:22 +01:00
Idan Horowitz
bbf75d0bea LibJS: Trim initial whitespace in parseFloat 2021-06-06 01:34:22 +01:00
Idan Horowitz
bda32e9440 LibJS: Parse digits with parse_ascii_base36_digit in parseInt
This was accidentally replaced with parse_ascii_hex_digit in
bc8d16ad28 which caused radices above
16 (hex) to fail.
2021-06-06 01:34:22 +01:00
Idan Horowitz
2011fcff24 AK: Add the parse_ascii_base36_digit method
This is similar to parse_ascii_hex_digit but can parse the whole A-Z
range (also known as base36).
2021-06-06 01:34:22 +01:00
Idan Horowitz
26a0dbdd9e LibJS: Set the length property of parseInt to 2
The method takes 2 arguments
2021-06-06 01:34:22 +01:00
NonStdModel
0e4dc5f7a1 LibKeyboard: Use correct filename in debug message 2021-06-06 00:21:12 +01:00
NonStdModel
484ec94624 KeyboardMapper: Add GUI alert in case load from file fails
Previously there was no visual clue letting the user know that loading
from file failed.
2021-06-06 00:21:12 +01:00
kemzeb
b9980ffd07 Documentation: Remove redundancy in CodingStyle.md
This is a fairly small change; removed the statement "Pointer and
reference types in C++ code" as it does not provide any additional
knowledge that contributors are or will be aware of after further
reading into the "Pointers and References" section. It seems
unnecessary and redundant given the sentence adjacent to it.
2021-06-06 00:18:02 +01:00
Timothy
65d4ac1c14 Ports: Add sam 2021-06-06 00:17:37 +01:00
Tobias Christiansen
b253b63bb4 LibWeb: Resolve flex: shorthand correctly
This patch removes some FIXMEs from the StyleResolver, specifically
adding the proper float-parsing to the flex: shorthand. The
functionality was already there it just didn't get plumbed in before.
2021-06-06 00:16:27 +01:00