Commit graph

21521 commits

Author SHA1 Message Date
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
Idan Horowitz 2a8f4f097c LibJS: Throw TypeError on write to non-writable property in strict mode 2021-06-05 23:54:08 +01:00
Tobias Christiansen 31534055e4 LibWeb: Implement FlexBox Layout Algorithm 2021-06-06 01:46:06 +04:30
Tobias Christiansen c51dbb4372 LibWeb: Expose size calculation of BlockFormattingContext
This is a hack for the FlexFormattingContext
2021-06-06 01:46:06 +04:30
Tobias Christiansen ce7c8e215f LibWeb: Parse and resolve flex: shorthand 2021-06-06 01:46:06 +04:30
Tobias Christiansen ae61e9ded2 LibWeb: Add flex-grow and flex-shrink
They get parsed and are available to the programmer of Layouts :^)
2021-06-06 01:46:06 +04:30
Tobias Christiansen af4d80af4d LibWeb: Add parsing for NumericStyleValue
This StyleValue can hold an arbitrary float value.
2021-06-06 01:46:06 +04:30
Tobias Christiansen ae3e6510d6 LibWeb: Parse flex-basis
Flex-basis accepts either 'content' or a Length.
2021-06-06 01:46:06 +04:30
Tobias Christiansen 27704f5f9e LibWeb: Add support for 'definite size' determination
This is pretty naive and there are more nuances in the spec but should
be enough for now.
2021-06-06 01:46:06 +04:30
Tobias Christiansen ead864acf3 LibWeb: Parse and resolve flex-flow property 2021-06-06 01:46:06 +04:30
Tobias Christiansen e6545d5259 LibWeb: Add parsing for flex-wrap property 2021-06-06 01:46:06 +04:30
Tobias Christiansen 72d5394b8c LibWeb: Flex-items aren't affected by float nor clear
There are a few other things to notice, but they don't seem to be
implemented yet.
2021-06-06 01:46:06 +04:30
Tobias Christiansen 7f81c8fba2 LibWeb: LayoutNodes know whether they are flex-items
This is useful for debugging when dumping the layout tree.
2021-06-06 01:46:06 +04:30
dylanbobb 2205239d9a LibWeb: Change BlockBox to not want mouse events 2021-06-05 22:35:22 +02:00
Tim Schumacher 1618cffb75 LibVT: Don't return a history size if alternate buffer is used
The line history is unavailable if the alternate screen buffer is
currently enabled. However, since TerminalWidget uses the history size
to offset its line numbers when rendering, it will try to render
inaccessible lines once the history is not empty anymore.
2021-06-05 22:12:18 +02:00
Gunnar Beutner 0625342382 Kernel: Return EPIPE when trying to write to an unconnected socket
When attempting to write to a socket that is not connected or - for
connection-less protocols - doesn't have a peer address set we should
return EPIPE instead of blocking the thread.
2021-06-05 22:11:49 +02:00
Ali Mohammad Pur 51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Maciej Zygmanowski 104dc93220 ifconfig: Use shorter argument names
The previous argument names were so long that they won't fit
into the terminal, making help message unreadable.
2021-06-05 23:51:08 +04:30
Timothy Flynn f8f36effc9 LibSQL: Limit the allowed depth of an expression tree
According to the definition at https://sqlite.org/lang_expr.html, SQL
expressions could be infinitely deep. For practicality, SQLite enforces
a maxiumum expression tree depth of 1000. Apply the same limit in
LibSQL to avoid stack overflow in the expression parser.

Fixes https://crbug.com/oss-fuzz/34859.
2021-06-05 23:48:18 +04:30
Linus Groh 3d9bcb860e CI: Run libjs-test262 and update results on every push to master 2021-06-05 19:27:55 +01:00
Idan Horowitz 442ef63008 LibJS: Add the global escape() & unescape() methods 2021-06-05 18:55:08 +01:00
Idan Horowitz e2fb7943f7 LibJS: Correctly handle NaN and negative infinity in Math.atan2
The current implementation was missing an early return on a NaN
argument and mixed up a couple of the positive/negative infinity early
returns.
2021-06-05 14:56:58 +01:00
Idan Horowitz 57a52094d1 LibJS: Rewrite Math.hypot to handle exceptions, NaNs, Infinity properly
The specification requires that we immediately return Infinity during
the iteration over the arguments if positive or negative infinity is
encountered, and return a NaN if it is encountered and no Infinity was
found. The specification also requires all arguments to be coerced into
numbers before the operation starts, or else a number conversion
exception could be missed due to the Infinity/NaN early return.
2021-06-05 14:56:58 +01:00
Idan Horowitz 03255c1c53 LibJS: Handle NaN/Infinity/Zero edge cases in Math.pow()
This commit replaces the current simple call to LibM's pow with the
full implementation of 6.1.6.1.3 Number::exponentiate:
https://tc39.es/ecma262/#sec-numeric-types-number-exponentiate
2021-06-05 14:56:58 +01:00
Idan Horowitz 7507999230 LibJS: Rewrite Math.{max, min} to handle exceptions and NaNs properly
The specification requires that we immediately return a NaN during the
iteration over the arguments if one is encountered. It also requires
all arguments to be coerced into numbers before the operation starts,
or else a number conversion exception could be missed due to the NaN
early return.
2021-06-05 14:56:58 +01:00
Idan Horowitz 24ffe91b16 LibJS: Handle negative zero and negative infinity in Math.abs()
As required by the specification:
3. If n is -0, return +0.
4. If n is -∞, return +∞.
2021-06-05 14:56:58 +01:00
Idan Horowitz 9d2e90d569 LibJS: Add Math.imul() 2021-06-05 14:56:58 +01:00
Idan Horowitz de10f0dc6c LibJS: Support symbol keys in Object.prototype.propertyIsEnumerable 2021-06-05 14:15:28 +01:00
Idan Horowitz eb0b1c432a LibJS: Replace StringOrSymbol::from_value with Value::to_property_key
This is a more specification compliant implementation of the
abstract operation 7.1.19 ToPropertyKey which should handle boxed
symbols correctly.
2021-06-05 14:15:28 +01:00
Jelle Raaijmakers e72e621d89 Ports/PHP: Enable OpenSSL extension 2021-06-05 13:02:13 +02:00
Jelle Raaijmakers fccba571a2 Ports/PHP: Disable PCRE JIT
The PCRE JIT creates memory that needs to be readable, writable and
executable at the same time. Serenity does not like this, so disable
it. This JIT is of limited use for the current applications of PHP
within Serenity anyway :-)
2021-06-05 13:02:13 +02:00
Jelle Raaijmakers 012a5b145b Ports/PHP: Enable Zlib extension 2021-06-05 13:02:13 +02:00
Jelle Raaijmakers 64e2e2cff3 Ports/PHP: Enable Phar extension 2021-06-05 13:02:13 +02:00
Daniel Bertalan 169e93f0a7 Kernel: Perform output processing on echo
Previously, we would echo characters back just as they were passed to
us, even in canonical mode. This caused newlines to not work correctly
in some programs.

Fixes #7802
2021-06-05 13:01:39 +02:00
Andreas Kling 42fcc2219d LibJS: Use PropertyName::as_string() in Object::get()
After we've already checked is_string(), we can use as_string() to
avoid a temporary String.
2021-06-05 13:00:34 +02:00
Andreas Kling 66f15c2e0c AK: Always inline FlyString::view() 2021-06-05 12:36:14 +02:00