Commit Graph

7655 Commits

Author SHA1 Message Date
Ali Mohammad Pur
4bef63fa6a Profiler: Show the symbol address in object file 2021-08-10 05:13:44 +04:30
Ali Mohammad Pur
64ccf2196c UserspaceEmulator+LibC: Add support for Region-of-Interest profiling 2021-08-10 05:13:44 +04:30
Daniel Bertalan
18b2484985 LibELF: Remove (FlatPtr)something.as_ptr() idiom
This is equivalent to `something.get()`, but more verbose.
2021-08-09 23:15:48 +02:00
Daniel Bertalan
e0e3198d51 LibELF: Fix 'applying offset produced null pointer' UBSAN failure
These integer => pointer => integer conversions were technically prone
to UB, since they were used as offsets (which are perfectly fine to be
zero), but we calculated them with pointer arithmetic. This made Clang
insert pointer overflow UBSAN checks, which trigger in case of a zero
result.
2021-08-09 23:15:48 +02:00
Tetsui Ohkubo
1479ee3f3e LaunchServer: Do not provide file handlers for special files
With this change, LaunchServer will always return an empty list of file
handlers for special files e.g. sockets and devices. Before this change,
TextEditor was always returned as a default handler for these files.
2021-08-09 22:50:09 +02:00
Tobias Christiansen
2a77abf85e Everywhere: Use tobyase@serenityos.org for my copyright headers 2021-08-09 21:43:05 +02:00
davidot
e1573991a3 LibJS: Fix this values in arrow functions
Also added a large this value test (and strict variant) to ensure this
values have no regressions.
2021-08-09 17:33:14 +01:00
davidot
151447bdf7 LibJS: Move Object::invoke to Value::invoke and fix it for primitives
This is a tiny difference and only changes anything for primitives in
strict mode. However this is tested in test262 and can be noticed by
overriding toString of primitive values.

This does now require one to wrap an object in a Value to call invoke
but all code using invoke has been migrated.
2021-08-09 17:33:14 +01:00
Mandar Kulkarni
b0ff91ff09 Spreadsheet: Make convert_from_string() return Optional<size_t>
Earlier, we were using 0 value for characters not found in "map".

We should return failure for invalid inputs.
So, I have changed the return type of function to Optional<size_t>.

Also changed caller to handle Optional return.
2021-08-09 14:14:07 +04:30
Mandar Kulkarni
2c44f2dc3c Spreadsheet: Fix column index string to number conversion
Fixed convert_from_string() function to return correct output.
The value of a number is equal to sum of each digit multiplied by it's
positional weight.
2021-08-09 14:14:07 +04:30
Marcus Nilsson
b1b6a6d6e8 PixelPaint: Let Tools have different cursors
This adds support for the Tools in PixelPaint to use different cursors
within ImageEditor. For now most of them get the crosshair cursor since
it's the most fitting, but in the future we will want to add custom
cursors.
2021-08-09 00:57:44 +02:00
Linus Groh
312946059b LibJS+Spreadsheet: Use js_string(VM&, ...) overload more 2021-08-08 21:32:58 +01:00
Linus Groh
97010d4903 LibJS: Implement Intl[@@toStringTag] 2021-08-08 20:14:59 +01:00
Linus Groh
44a8b55c50 LibJS: Add preparation for Intl constructors and prototypes
Add a JS_ENUMERATE_INTL_OBJECTS macro and use it to generate:

- Forward declarations
- CommonPropertyNames class name members
- Constructor and prototype GlobalObject members, getters, visitors,
  and initialize_constructor() calls
2021-08-08 20:14:59 +01:00
Linus Groh
a37dcf8ca7 LibJS: Add the Intl namespace object :^)
This is the start of implementing ECMA-402 in LibJS, better known as the
ECMAScript Internationalization API.

Much like Temporal this gets its own subdirectory (Runtime/Intl/) as
well as a new C++ namespace (JS::Intl) so we don't have to prefix all
the files and classes with "Intl".

https://tc39.es/ecma402/
2021-08-08 20:14:59 +01:00
Linus Groh
7d8c182359 LibJS: Implement Temporal.PlainYearMonth.prototype.getISOFields() 2021-08-08 17:45:06 +01:00
Linus Groh
5a260fcad1 LibJS: Implement Temporal.PlainYearMonth.prototype.valueOf() 2021-08-08 17:45:06 +01:00
Linus Groh
d9ed0f1f47 LibJS: Implement Temporal.PlainYearMonth.prototype.inLeapYear 2021-08-08 17:45:06 +01:00
Linus Groh
3592a748b6 LibJS: Implement Temporal.PlainYearMonth.prototype.monthsInYear 2021-08-08 17:45:06 +01:00
Linus Groh
703eb1f7b4 LibJS: Implement Temporal.PlainYearMonth.prototype.daysInMonth 2021-08-08 17:45:06 +01:00
Linus Groh
1f1d7144bf LibJS: Implement Temporal.PlainYearMonth.prototype.daysInYear 2021-08-08 17:45:06 +01:00
Linus Groh
5ec70792fd LibJS: Implement Temporal.PlainYearMonth.prototype.monthCode 2021-08-08 17:45:06 +01:00
Linus Groh
0edec6578b LibJS: Implement Temporal.PlainYearMonth.prototype.month 2021-08-08 17:45:06 +01:00
Linus Groh
c947ba9ed9 LibJS: Implement Temporal.PlainYearMonth.prototype.year 2021-08-08 17:45:06 +01:00
Linus Groh
71eca69d7c LibJS: Implement Temporal.PlainYearMonth.prototype.calendar 2021-08-08 17:45:06 +01:00
Linus Groh
d8e835d22f LibJS: Implement Temporal.PlainYearMonth.prototype[@@toStringTag] 2021-08-08 17:45:06 +01:00
Linus Groh
4d3af45efb LibJS: Handle PlainYearMonth in the Calendar.prototype getters 2021-08-08 17:45:06 +01:00
Linus Groh
e2f016dc81 LibJS: Handle PlainYearMonth in ISO{Year,Month,MonthCode,Day} 2021-08-08 17:45:06 +01:00
Linus Groh
4ba5df7145 LibJS: Handle PlainYearMonth in GetTemporalCalendarWithISODefault 2021-08-08 17:45:06 +01:00
Linus Groh
2aec6653c4 LibJS: Handle PlainYearMonth in ToTemporalCalendar 2021-08-08 17:45:06 +01:00
Linus Groh
0a8edd5ce7 LibJS: Start implementing Temporal.PlainYearMonth
This commit adds the PlainYearMonth object itself, its constructor and
prototype (currently empty), and the CreateTemporalYearMonth and
ISOYearMonthWithinLimits abstract operations.
2021-08-08 17:45:06 +01:00
Linus Groh
5b12542d39 LibJS: Fix Vector<Value> => MarkedValueList in calendar_fields()
We need to ensure the temporary PrimitiveString cells don't get GC'd.
2021-08-08 17:45:06 +01:00
Linus Groh
53c44bea00 LibJS: Mark getters of more Temporal objects [[nodiscard]]
PlainDate, PlainTime, and PlainDateTime already do this. All the others
should as well.
2021-08-08 17:45:06 +01:00
Gunnar Beutner
aabbfa78e2 DynamicLoader: Make sure we don't link against libgcc_s
This bug was reintroduced by the removal of -fbuilding-gcc.
2021-08-08 16:41:51 +02:00
sin-ack
07f5e12568 WidgetGallery: Change model update() functions to invalidate()
These functions reload the whole model contents and thus can be moved to
invalidate(), which saves us from the need to manually call update() on
them.
2021-08-08 14:45:23 +02:00
Andreas Kling
2c1788e2e4 FileOperation: Don't follow symlinks
Deleting a symlink via "FileOperation Delete" should not recursively
delete whatever the symlink is pointing to. Same basic idea applies to
the Copy and Move operations.
2021-08-08 14:24:54 +02:00
sin-ack
8c9c2f46c7 LibGUI: Implement granular updates for FileSystemModel
FileSystemModel will now react to specific events from Core::FileWatcher
in order to granularly update its data based on addition or removal of
files from the tree. Metadata changes are currently not handled, but in
the future they can be used to re-stat() a file to get its updated
statistics.
2021-08-08 14:13:37 +02:00
sin-ack
e377b508b7 LibGUI: Prefix some private FileSystemModel::Node members with m_
This commit has no functional changes.
2021-08-08 14:13:37 +02:00
sin-ack
265e2832ef LibGUI: Resize the mapping rows during sort
SortingProxyModel always expected the source model to have the same
number of rows as long as it has not been invalidated. Now that we have
granular updates, this assumption is no longer true, and we need to
resize the source/proxy_rows vectors to the new size. This is safe since
the values in the vector are overwritten right afterwards.
2021-08-08 14:13:37 +02:00
sin-ack
7ba321c91b LibGUI: Implement granular operations for Model subclasses
These can be used by Model subclasses to signal the exact operations
that happened to a model, so that persistent model indices in that
area are not invalidated.
2021-08-08 14:13:37 +02:00
sin-ack
d73116e5d5 LibGUI: Implement persistent indices for models
This patch adds persistent indices to models.  A PersistentModelIndex is
a ModelIndex that will survive most model updates (provided that the
data the PersistentModelIndex points to has not been removed by the
model's data store).  PersistentModelIndex objects can be safely held
by objects outside the model they originated from.
2021-08-08 14:13:37 +02:00
sin-ack
1408aa1295 LibGUI: Do not allow tree column to shrink beyond indent and icon
We always display the tree indent and the icon, so we shouldn't allow
the tree column to shrink beyond that size.
2021-08-08 14:12:45 +02:00
sin-ack
ab2719fd53 LibGUI: Let the table view tell HeaderView about the min. section size
Previously HeaderView would just assume that each column or row could
have a minimum size of 2. This makes it so that AbstractTableView
subclasses can provide a new minimum value for a specific column.
2021-08-08 14:12:45 +02:00
Marcus Nilsson
854e16797e PixelPaint: Tighten update rects for Tools
This tightens the update rects for EraseTool, BrushTool And the marching
ants update in Selection. Inflate Selection update rect by 10x10 to
avoid misalignment when zoomed out.
2021-08-08 13:55:39 +02:00
Marcus Nilsson
8c81d195c7 PixelPaint: Inflate update rect for PenTool
Previously using PenTool while zoomed in could cause rendering glitches
since the update rect was misaligned with the image, most likely because
of rounding errors.
Loosening the rect with 1 pixel on either side takes care of this.
2021-08-08 13:55:39 +02:00
sin-ack
99dfab08c9 LibGUI: Correctly call update() in ProcessChooser
After the update -> invalidate change a couple places broke when
update() was supposed to be manually called. This instance was not
marked virtual or override, which made it hard to detect. This commit
makes sure that update() on the original model is called when the
RunningProcessesModel needs an update.
2021-08-08 13:46:27 +02:00
Linus Groh
16c38788c3 LibJS: Add missing spec links 2021-08-08 11:04:30 +01:00
Daniel Bertalan
0e21bf0f23 LibJS: Don't overflow size_t in Value::to_length()
Although this is not spec-compliant, we don't have a way to represent
objects larger than `NumericLimits<size_t>::max()`. Since this abstract
operation is only used when dealing with object size, we don't lose any
functionality by taking that limit into account too.

This fixes a UBSAN error when compiling with Clang.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
78e7ff008b LibC: Fix negation overflow UB in sys/mman.cpp
When the system calls return `NumericLimits<ptrdiff_t>::min()`, negating
the return code would produce `NumericLimits<ptrdiff_t>::max() + 1`
since we are on a two's complement architecture. Because this value
cannot be stored, signed overflow occurs which is UB. This can be fixed
by applying the negation to `EMAXERRNO` since that's known to contain a
relatively small value.

Found when running tests with Clang.
2021-08-08 10:55:36 +02:00
Daniel Bertalan
12dc2c2079 LibJS: Fix wraparound UB in Value::to_u{8,16}
If we call these two functions on a negative value, undefined behavior
occurs due to casting a negative double to an unsigned integer. These
functions are defined to perform modular arithmetic, so negative values
can be fixed up by adding 2^8/2^16.

The reason why this step is not mentioned in ECMA-262 is that it defines
modular arithmetic so that `x mod m` had the same sign as `m`, while
LibM's `fmod(x, m)` copies `x`'s sign.

This issue was found by UBSAN with the Clang toolchain.
2021-08-08 10:55:36 +02:00