Commit graph

48363 commits

Author SHA1 Message Date
Tim Ledbetter
d1a964a43b LibThreading: Resolve BackgroundAction error callback use-after-free
This change ensures that a reference to the BackgroundAction is held
until after the error callback has executed on the event loop.

This fixes an intermittent crash in Assistant :^)
2023-03-23 21:05:12 +01:00
Luke Wilde
ddec4cd7f2 LibWeb: Create the correct error objects in XHR::handle_errors
Aborts and network errors were accidentally creating TimeoutError
exceptions instead of AbortError and NetworkError respectively.
2023-03-23 20:01:38 +01:00
Caoimhe
ac5f4792a8 ImageViewer: Fix crash when opening ImageViewer without an image
Seems like a thing which slipped through the cracks... We shouldn't try
to scale the image to the window's size if the bitmap doesn't exist.
2023-03-23 18:45:51 +00:00
Aliaksandr Kalenik
34224c42ef WebDriver: Unlink server socket before binding to it
Previously, the create_server function would fail with an "Address
already in use" error if a file that used for socket address is
already exists.
2023-03-23 19:38:44 +01:00
Hendiadyoin1
b76d3f287f LibJS: Make yy{/,-}mm{/,-}dd hh:mm test timezone independent
Otherwise this will fail in non UTC timezones.
2023-03-23 13:33:03 -04:00
Timothy Flynn
6d49eab8a6 LibJS+LibTimeZone: Explicitly canonicalize "GMT" to "UTC"
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/50eb413

Note that this canonicalization already occurred. As the above commit
alludes to, we parse the rearguard format of the TZDB, so GMT is already
an alias to Etc/GMT. But it doesn't hurt to be explicit here.
2023-03-23 15:30:21 +00:00
Timothy Flynn
c5c6065611 LibJS: Add missing internal slots to creation of Intl.DateTimeFormat
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/f6c0c41
2023-03-23 15:30:21 +00:00
Timothy Flynn
a13b6a3cb0 LibJS: Remove ! from AO calls that can't throw from Intl.DateTimeFormat
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/8f9080e
2023-03-23 15:30:21 +00:00
Timothy Flynn
b74786d3c3 LibJS: Explicitly provide all GetIterator arguments from Intl.ListFormat
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/13895c8
2023-03-23 15:30:21 +00:00
Luke Wilde
f0d0459c3e LibJS: Support the yy{/,-}mm{/,-}dd hh:mm format for Date
Required by a UK news website for loading a Piano configuration.
This is presumably configuration for piano.io Analytics.
2023-03-23 13:38:08 +01:00
Srikavin Ramkumar
5c8be3b072 LibWeb: Add missing constructors to HTMLElement IDLs 2023-03-23 13:37:40 +01:00
Srikavin Ramkumar
daf421846c LibWeb: Return TypeError for [HTMLConstructor] IDL constructors
This matches the spec since there can be no matching custom element
definition if we don't support custom elements yet.
2023-03-23 13:37:40 +01:00
Srikavin Ramkumar
6bc6ea8e97 LibIDL: Parse extended attributes for constructors 2023-03-23 13:37:40 +01:00
Xexxa
da671a0c16 Snake: Add skin ahaetulla nasuta 2023-03-23 08:43:54 +00:00
Xexxa
fed961e701 Snake: Add skin thamnophis sirtalis tetrataenia 2023-03-23 08:43:54 +00:00
Xexxa
38446607db Snake: Add skin micrurus fulvius 2023-03-23 08:43:54 +00:00
Xexxa
f4c78760d9 Snake: Add skin calliophis bivirgatus 2023-03-23 08:43:54 +00:00
MacDue
4b3c38e111 Base: Add accent-color demo page
Currently this just has checkboxes, though I intend to add support
for more things later :^)
2023-03-23 08:27:51 +00:00
MacDue
cfc9966654 LibWeb: Add scaleable checkboxes (with theme/accent-color support)
This reworks checkboxes to use a tiny 16x16 SDF for the tick icon along
with an antialiased background/border.

The checkbox now works well at any scale, shows the various checkbox
state (enabled, disabled, being pressed), and supports using the colors
from the active system theme and/or the accent-color property.
2023-03-23 08:27:51 +00:00
MacDue
77456d1d0b LibGfx: Implement simple signed distance field rendering
This is mostly a simple grayscale bilinear scale, with an extra step
of computing the distance and alpha with a little smoothing. This
can be used to paint more scalable UI elements/icons from rather
small distance fields. A tiny 16x16 SDF seems to do a decent job
for simple icons.
2023-03-23 08:27:51 +00:00
MacDue
429d7b002b LibGfx: Add a simple GrayscaleBitmap class
This is very similar to the existing CharacterBitmap class but instead
intended for small static grayscale bitmaps (such as signed distance
fields).
2023-03-23 08:27:51 +00:00
MacDue
87b8a36e56 LibWeb: Parse and plumb the accent-color CSS property 2023-03-23 08:27:51 +00:00
Andreas Kling
d005b1ad1b LibWeb: Support loading file:// URLs via fetch (through ResourceLoader)
This builds on the existing ad-hoc ResourceLoader code for HTTP fetches
which works for files as well.

This also includes a test that checks that stylesheets loaded with the
"file" URL scheme actually work.
2023-03-22 23:34:32 +00:00
Andreas Kling
652676fdc1 LibWeb: Make ResourceLoader insert a Content-Type header for file://
We make a guess using the MIME type guessing API in LibCore. This frees
clients of this code from having to do the guessing.
2023-03-22 23:34:32 +00:00
huttongrabiel
6a5c561a41 FileSystemAccessServer: Implement FileTypeFilter to open_file()
This is the same functionality as in FilePicker. It allows the
specification of what file types are allowed.
2023-03-22 22:33:19 +00:00
huttongrabiel
106ad6bb13 LibGUI: Add IPC encode and decode for FileTypeFilter
Allows the use of GUI::FileTypeFilter in IPC.
2023-03-22 22:33:19 +00:00
Luke Wilde
95da08e035 LibWeb: Add workaround to restore cross-origin stylesheet functionality
CORS cross-origin responses in the No CORS request mode provide an
opaque filtered response, which is the original response with certain
attributes removed/changed.

The relevant effect it has is setting the body to `null`, which means
`body_bytes` has `Empty` in the process_response_consume_body callback.
This effectively disables cross-origin linked resources
(e.g. stylesheets).

However, the web actually depends on this, especially for stylesheets
retrieved from a cross-origin CDN. For example, Shopify websites
request stylesheets from `cdn.shopify.com` and Substack websites
request stylesheets from `substackcdn.com`.

This makes this a specification bug, as this code was written from it.

The workaround is to read the actual body from the unfiltered response
and then call `process_linked_resource` from there.

This _should_ be safe to do, as linked resource fetches do not include
credentials (i.e. cookies and the Authorization header), so it cannot
provide personalized responses.
2023-03-22 22:26:16 +00:00
Lucas CHOLLET
17eb77cf55 ImageViewer: Scale image to window on resize 2023-03-22 23:22:58 +01:00
Lucas CHOLLET
d8819c2d0e ImageViewer: Scale image to window on startup
We used to do the opposite, meaning that a huge images make the window
bigger than the screen. We now define a range for the window size and
scale the image if it doesn't fit un the current scope.
2023-03-22 23:22:58 +01:00
Lucas CHOLLET
c574b97246 ImageViewer: Scale image to window size on image change 2023-03-22 23:22:58 +01:00
Lucas CHOLLET
5cceae821d ImageViewer: Don't resize window on image rotation or flip 2023-03-22 23:22:58 +01:00
Lucas CHOLLET
fd0b809d54 Spreadsheet: Port to Core::File 2023-03-22 23:21:20 +01:00
Julian Offenhäuser
0d46c27741 PDFViewer: Create OutlineModel items with the correct pointer
This fixes a bug where we would construct a ModelIndex with a pointer to
NonnullRefPtr<OutlineItem>, instead of a pointer to the underlying
OutlineItem, which caused a crash later on when we would try to
dereference that pointer.
2023-03-22 22:56:24 +01:00
Sam Atkins
fcd4e68959 LibWeb: Use actual token representations when parsing CSS <urange>
nasty_hacks--; // :^)
2023-03-22 19:45:40 +01:00
Sam Atkins
c138845013 LibWeb: Store the original representation of CSS tokens
This is required for the `<urange>` type, and custom properties, to work
correctly, as both need to know exactly what the original text was.
2023-03-22 19:45:40 +01:00
Sam Atkins
b876e97719 AK: Expose the current position of a Utf8CodePointIterator as a pointer 2023-03-22 19:45:40 +01:00
Sam Atkins
a3d6d9db37 LibWeb: Correct logic when consuming a CSS number in scientific notation
Before, we were classifying the number as a "number" type if it had an
"E", even if that was not followed by an exponent.
2023-03-22 19:45:40 +01:00
Cameron Youell
a8cd6c396b LibFileSystem: Fix leak in read_path 2023-03-22 14:04:24 +00:00
Andreas Kling
26a4e4d23d Help: Don't abort opening help:// URLs when error *didn't* occur
Fixes #14158
2023-03-22 13:07:57 +01:00
Andreas Kling
96f8cf2971 LibWeb: Consider inline content (line boxes) when measuring overflow
Fixes #13628
2023-03-22 12:56:44 +01:00
Kyle Lanmon
244ea0fa9c Presenter: Don't give a style value if there are no styles 2023-03-22 10:32:02 +01:00
Kyle Lanmon
fcda397136 Presenter: Support multiple frames per slide 2023-03-22 10:32:02 +01:00
Ali Mohammad Pur
7c312980b0 Shell: Implement arithmetic expansions for POSIX mode
This also adds a 'math' immediate function that can be used in Shell
proper to do arithmetic stuff.
2023-03-22 09:46:16 +01:00
Ali Mohammad Pur
d0112d76e9 Shell: Resolve nonexistent string env variables to the empty string
We did this for lists, but not for strings.
2023-03-22 09:46:16 +01:00
Ali Mohammad Pur
d997b794fa Shell: Load a different rc file when in POSIX mode 2023-03-22 09:46:16 +01:00
Lucas CHOLLET
832478ad0c LibFileSystemAccessClient: Don't make illegal operation on files
`handle_prompt_end` is calling `is_device` and `is_directory` on the
path chosen by the user. However, this path is not necessarily unveiled.
Meaning that it the both functions results in an illegal operation.

This is a regression introduced with the usage of LibFileSystem in
1d24f394. This patch, revert the behavior at its previous state, i.e.
calling both functions with the fd provided by the FSAS.
2023-03-22 09:06:38 +01:00
Julian Offenhäuser
3400779047 LibPDF: Pass the right point width to the font loader in TrueTypeFont 2023-03-22 09:04:00 +01:00
Julian Offenhäuser
fd78875662 LibPDF: Fix navigate_to_before_eof_marker() for PDFs not ending in EOL
The way this was factored before, we would miss the %%EOF marker if it
didn't have a valid end-of-line sequence after it.
2023-03-22 09:04:00 +01:00
Julian Offenhäuser
fca9da4191 LibPDF: Don't consume anything other than EOL in Reader::consume_eol()
This was previously a slightly confusing API. Even when there was no EOL
marker at the current location, we would still consume one byte.
It will now consume either EOL or nothing at all.
2023-03-22 09:04:00 +01:00
Julian Offenhäuser
93062e2b78 LibPDF: Be more cautious of errors when looking for linearization dict
We would previously assume that, following the header, there must be a
valid PDF object that could be a linearization dict.

However, if the file is not linearized, this is not necessarily true.
We now try to detect if there even is an object, and don't treat
parsing errors as fatal.
2023-03-22 09:04:00 +01:00