Commit graph

5521 commits

Author SHA1 Message Date
Idan Horowitz
dcb55db99b LibJS: Replace boolean without_side_effects parameters with an enum 2021-06-17 16:52:15 +02:00
Idan Horowitz
864beb0bd5 LibJS: Remove the unused IndexedProperties::append_all method 2021-06-17 16:52:15 +02:00
stelar7
22851287b1 Spreadsheet: Pledge 'fattr' to avoid crashing after exporting as csv 2021-06-17 18:49:44 +04:30
Ali Mohammad Pur
2fe9c81b30 Everywhere: Replace the multiple impls of print_buffer() with :hex-dump 2021-06-17 18:44:00 +04:30
sin-ack
10f56166e5 LibJS: Cast to i64 for is_integral_number
This fixes the built-ins/Number/isInteger/integers.js test.
9007199254740991 is still an integer, though not a safe one.
2021-06-17 13:44:01 +01:00
Idan Horowitz
a85a95fe8d LibJS: Stop overwriting existing accessors in Object::define_property 2021-06-17 13:20:18 +01:00
Idan Horowitz
1cf5663e38 LibJS: Add the Object.prototype.__lookup{Getter, Setter}__ methods
These are a part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Idan Horowitz
f98c0ca528 LibJS: Add the Object.prototype.__define{Getter, Setter}__ methods
These are a part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Idan Horowitz
37340aa599 LibJS: Add the Object.prototype.__proto__ native accessor property
This is part of the Annex B extension of the specification.
2021-06-17 13:20:18 +01:00
Linus Groh
d1c109be96 LibJS: Fix .length attributes of various native functions
Namely the Proxy revocation, Promise resolving, Promise then/catch
finally, and Promise GetCapabilitiesExecutor functions.
They were all missing an explicit 'Attribute::Configurable' argument
and therefore incorrectly used the default attributes (writable,
enumerable, configurable).
2021-06-17 13:10:06 +01:00
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Gunnar Beutner
0ca5a393d1 SystemServer: Improve error message when execv() fails
Previously perror() would just tell us that the file specified
for execv() doesn't exist.
2021-06-17 11:03:51 +02:00
Idan Horowitz
70697a5999 LibJS: Throw a syntax error when an identifier is a reserved word
From the specification:
It is a Syntax Error if StringValue of IdentifierName is the same
String value as the StringValue of any ReservedWord except for yield
or await.
It is a Syntax Error if this phrase is contained in strict mode code
and the StringValue of IdentifierName is: "implements", "interface",
"let", "package", "private", "protected", "public", "static", or
"yield".
2021-06-17 10:56:11 +02:00
Idan Horowitz
d6df955305 LibJS: Add missing to_property_key exception check in ClassExpression 2021-06-17 10:56:11 +02:00
Luke
9cbd90fdb6 LibJS: Add BigInt64Array and BigUint64Array
This fixes ~297 test262 test cases :^)
2021-06-17 02:20:03 +01:00
Luke
411c72da27 js: Add print_number method and use it to print out TypedArray values
We can't construct Values with u64 and i64.
I tried adding these constructors, but then it refuses to build in
lagom.
2021-06-17 02:20:03 +01:00
Luke
8d90e137a5 LibJS: Fix check for byteOffset instead of byteLength in byteLength test 2021-06-17 02:20:03 +01:00
Luke
9c2eff8859 LibJS: Make TypedArray use numeric_to_raw_bytes and raw_bytes_to_numeric
It was previously writing directly to the underlying buffer instead of
using these methods. This has a benefit of dealing with BigInt64 and
BigUint64 for us already.
2021-06-17 02:20:03 +01:00
Luke
80edf6f5b6 LibJS: Refactor numeric_to_raw_bytes and raw_bytes_to_numeric
This is to make use of the new Value conversion methods.
This also moves the clamped u8 tag to ArrayBuffer from TypedArray and
the conversion to these methods, as the spec does it here.
2021-06-17 02:20:03 +01:00
Luke
7ff144d533 LibJS: Add a bunch of numeric conversions to Value
Namely:
- BigInt64
- BigUint64
- i16
- u16
- i8
- u8
- Clamped u8

These will be used in ArrayBuffer::numeric_to_raw_bytes later.
2021-06-17 02:20:03 +01:00
sin-ack
aa91284485 Userland: Allow multiple files to be run by js
js only accepted a single script file to run before this.  With this
patch, multiple scripts can be run in the same execution environment,
allowing the user to specify a "preamble script" to be executed before
the main script.
2021-06-17 00:07:04 +02:00
Idan Horowitz
b9d9187feb LibJS: Automatically & lazily coerce PropertyNames into numbers
This commit expands on 5eef07d232 by
automatically trying to coerce Type::String PropertyNames into numbers
when a caller checks if the PropertyName is_number/is_string.
This has several benefits:
 - We no longer have to duplicate the number coercion code to every
   function that accepts a PropertyNumber. (Or more likely, forget to.)
 - This keeps the lazy nature of only doing the coercion when and if
   there is a semantic difference to the different PropertyName types,
   which means this shouldnt cause any performance drop.
 - Since this coercion changes the state of the PropertyName itself the
   result is essentially cached and can speed up any repeat uses of the
   same PropertyName instance.
2021-06-16 22:54:48 +01:00
Idan Horowitz
623eadb44e LibJS: Stop overwriting existing indexed accessors in define_accessor
The previous implementation only checked the shape, ignoring existing
accessors when using number property names.
2021-06-16 22:54:48 +01:00
Idan Horowitz
6352a33ed2 LibJS: Respect Object::get's without_side_effects parameter for numbers 2021-06-16 22:54:48 +01:00
Linus Groh
317b88a8c3 LibJS: Replace Object's create_empty() with create() taking a prototype
This now matches the spec's OrdinaryObjectCreate() across the board:
instead of implicitly setting the created object's prototype to
%Object.prototype% and then in many cases setting it to a nullptr right
away, it now has an 'Object* prototype' parameter with _no default
value_. This makes the code easier to compare with the spec, very clear
in terms of what prototype is being used as well as avoiding unnecessary
shape transitions.

Also fixes a couple of cases were we weren't setting the correct
prototype.

There's no reason to assume that the object would not be empty (as in
having own properties), so let's follow our existing pattern of
Type::create(...) and simply call it 'create'.
2021-06-16 22:49:04 +01:00
Linus Groh
7489189645 LibJS/Tests: Use Object.prototype.toString() for values in test details
Using String() like we did before depends on objects having either
toString, valueOf, or  @@toPrimitive, which is not the case for objects
with no prototype.
2021-06-16 22:49:04 +01:00
Ali Mohammad Pur
66e5e74374 Spreadsheet: Remove the offset used for exception TextRanges
After yet another rewrite of how GUI::TextEditor interprets text ranges
this was broken yet again :P
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
0c9a505ad1 Spreadsheet: Remove 'return (...)' workaround in conditional formatting
Now that LibJS can evaluate expressions correctly, that workaround was
breaking conditional formatting.
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
16b4a78072 Spreadsheet: Do not cancel drag-select when moving over a cell corner
Fixes #4277.
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
a01358f015 Spreadsheet: Correctly resolve nonstandard column names 2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
b11b3c2f1c Spreadsheet: Make the XSV parser start with a preview parse
Instead of parsing the whole document. That's really wasteful and
super slow.
2021-06-17 01:08:27 +04:30
Andreas Kling
88b168ff16 WindowServer: Simplify WindowFrame shadow logic a little bit
Remove the confusingly-named inflate_for_shadow() function and inline
its logic into render_to_cache(). And remove the m_shadow_offset
member variable since it was only needed locally in one place.

Also improve some variable names to make it more understandable what
is going on.
2021-06-16 21:53:10 +02:00
Andreas Kling
20fb30d857 LibGfx: Add a bunch of [[nodiscard]] to Point 2021-06-16 21:53:10 +02:00
Andreas Kling
df0248b096 LibGfx: Convert Point to east-const style 2021-06-16 21:53:10 +02:00
Andreas Kling
243dfb3bdc LibGfx: Add a bunch of [[nodiscard]] to Size 2021-06-16 21:53:10 +02:00
Andreas Kling
bd9096c97d LibGfx: Convert Size to east-const style 2021-06-16 21:53:10 +02:00
Andreas Kling
3f57037ee7 LibGfx: Convert Rect to east-const style 2021-06-16 21:53:10 +02:00
Andreas Kling
316fb6cf31 LibGfx: Add a bunch of [[nodiscard]] to Gfx::Rect 2021-06-16 21:53:10 +02:00
Andreas Kling
d924d93fa2 WindowServer: Fix unnecessary local variable shadowing in WindowFrame 2021-06-16 21:53:10 +02:00
Aatos Majava
a49a15cabf PixelPaint: Set the image title when creating a new image 2021-06-16 21:27:05 +02:00
Idan Horowitz
25a292f534 LibJS: Add the String.prototype.search method
This is only the String.prototype side of search, for full
functionality Symbol.search has to be implemented in our RegExp
built-in object.
2021-06-16 20:05:18 +01:00
Idan Horowitz
bad2108d3c LibJS: Add the String.prototype.matchAll method
This is only the String.prototype side of matchAll, for full
functionality Symbol.matchAll has to be implemented in our RegExp
built-in object.
2021-06-16 20:05:18 +01:00
Idan Horowitz
8e05b49089 LibJS: Add the String.prototype.codePointAt() method
This commit also brings charAt & charCodeAt closer to the specification
2021-06-16 20:05:18 +01:00
Idan Horowitz
9f71e3cab4 LibJS: Handle UTF whitespace characters in String's trim{,Start,End}
This helps a bit, but doesnt handle UTF-16 surrogates in the strings.
2021-06-16 20:05:18 +01:00
Gunnar Beutner
8393e737b7 LibC: Make sure the definition for struct timeval is available
Ideally we'd have a separate header with just struct timeval and include
that (i.e. in a way similar to how macOS, FreeBSD and glibc do this).
2021-06-16 20:08:13 +02:00
Gunnar Beutner
f589acaac9 AudioServer: Put the m_zero_filled_buffer variable into the .bss segment
This way we don't have to allocate this at runtime. I'm intentionally
not using static constexpr here because that would put the variable
into the .rodata segment and would therefore increase the binary by
4kB.

The old code also failed to free() the buffer in the destructor, however
that wasn't much of an issue because the Mixer object exists throughout
the program's entire lifetime.
2021-06-16 20:07:37 +02:00
Timon Kruiper
3e73cfc08c Help: When opening a page, make sure it is selected in the tree view
This has to be called with a `deferred_invoke`, since on startup the
tree view contains no data yet.
2021-06-16 16:30:54 +04:30
Timon Kruiper
a5ecac5494 Help: Make sure the home page is actually shown when opening the app
Previously `open_page` was called multiple times when opening the
application, once for the actual page, but also in
`tree_view.on_selection_change`. At startup there is no valid selection
yet, which caused an empty page to be loaded. Prevent this by early
returning if the `path` is null.
2021-06-16 16:30:54 +04:30
sin-ack
74d76528d6 LibRegex: Display correct position for Compare in REGEX_DEBUG
When REGEX_DEBUG is enabled, LibRegex dumps a table of information
regarding the state of the regex bytecode execution. The Compare opcode
manipulates state.string_position directly, so the string_position value
cannot be used to display where the comparison started; therefore, this
patch introduces a new variable to keep track of where we were before
the comparison happened.
2021-06-16 16:30:12 +04:30
sin-ack
6b2e264093 LibRegex: Fix incorrect case-sensitive comparisons
A tiny typo was introduced in bc8d16ad which caused all case insensitive
comparisons to fail.
2021-06-16 16:30:12 +04:30