Commit graph

55947 commits

Author SHA1 Message Date
Timothy Flynn f630a5ca71 AK+LibJS: Remove error-prone JsonValue constructor
Consider the following:

    JsonValue value { JsonValue::Type::Object };
    value.as_object().set("foo"sv, "bar"sv);

The JsonValue(Type) constructor does not initialize the underlying union
that stores its value. Thus JsonValue::as_object() will A) refer to an
uninitialized union member, B) deference that member.

This constructor only has 2 users, both of which initialize the type to
Type::Null. Rather than implementing unused functionality here, replace
those uses with the default JsonValue constructor, and remove the faulty
constructor.
2023-11-01 11:15:26 -04:00
david072 53d73b95ce HackStudio: Also ask about unsaved changes when running
HackStudio now also asks about unsaved changes when trying to run,
instead of only on build.
2023-11-01 12:05:57 +00:00
david072 02cc2e0f8f HackStudio: Don't crash when saving is denied on build
When running build while having unsaved changes in HackStudio, it asks
whether you want to save the unsaved files with a separate dialog. When
you click "Yes" to saving the files, but deny the save-file dialog,
HackStudio would crash, since we were expecting there to be a file
to save to. Now, we check whether a file was picked, and if not, we
abort the build.
2023-11-01 12:05:57 +00:00
0GreenClover0 88cc019275 FlappyBug: Unify the way of getting the final score
Previously we would display the score rounded to the nearest integer,
but save the high score by using a static_cast<u32>, which would
always round the score down. This could lead to the final score being
higher than the new high score, when they should be equal.
Now we always round the score to the nearest integer.
2023-11-01 10:43:55 +01:00
Ali Mohammad Pur 7976e1852c AK: Ensure unions with bitfield structs actually have correct sizes
The fun pattern of `union { struct { u32 a : 1; u64 b : 7; }; u8 x; }`
produces complete garbage on windows, this commit fixes the two
instances of those that exist in AK.
This commit also makes sure that the generated unions have the correct
size (whereas FloatExtractor<f32> previously did not!) by adding some
nice static_asserts.
2023-11-01 09:10:38 +03:30
Aliaksandr Kalenik 4676b288a2 LibWeb: Set table width to GRIDMAX if calculated value is max-content
If the width of the table container is specified as max-content, then
it seems sensible to resolve it as the sum of the maximum widths of the
columns.
2023-10-31 18:13:14 +01:00
networkException 387ab57eb1 LibWeb/Tests: Add test for a <script type=module> inside <head> 2023-10-31 18:09:14 +01:00
networkException ff6d7cf3e4 LibJS+LibWeb: Bring script fetching closer to the spec
This patch updates various parts of the script fetching implementation
to match the current specification.

Notably, the implementation of changes to the import assertions /
attributes proposal are not part of this patch(series).
2023-10-31 18:09:14 +01:00
networkException 5b1d0d4d1b LibWeb: Add FetchContext as HostDefined JS::GraphLoadingState field
This patch adds FetchContext as the type to be used in the HostDefined
slot of JS::GraphLoadingState in web script fetching.
2023-10-31 18:09:14 +01:00
networkException c3b02ae65a LibJS: Add GraphLoadingState Record
This patch adds the GraphLoadingState Record with a struct HostDefined
for use in the HostDefined field.
2023-10-31 18:09:14 +01:00
networkException dd90ed11b3 LibWeb: Add helper to create default classic script fetch options 2023-10-31 18:09:14 +01:00
networkException d1c1218d42 LibWeb/Fetch: Implement changes to priority
This patch updates the priority member of fetch requests to be
an enum. The implementation defined struct previously named Priority
has been renamed to InternalPriority in line with the spec.
2023-10-31 18:09:14 +01:00
networkException 5aa7c51956 LibWeb: Pass around JS::HeapFunctions when fetching scripts
This patch replaces the use of JS::SafeFunction for the
OnFetchScriptComplete in various script fetching functions with
JS::HeapFunction. The same applies for callbacks in ModuleMap.

This also removes DescendantFetchingContext, which stashed the
on complete function in fetch_descendants_of_a_module_script
for multiple calls to fetch_internal_module_script_graph
previously.
2023-10-31 18:09:14 +01:00
networkException 33b40eaeed LibJS: Add LoadedModules to Script and CyclicModule 2023-10-31 18:09:14 +01:00
networkException d60e8c9df5 LibJS: Add ModuleWithSpecifier for LoadedModules
This patch adds ModuleWithSpecifier as the record type to be used in
the LoadedModules field of Realm, Script and Cyclic Module Records.
2023-10-31 18:09:14 +01:00
networkException 7c7ca7f230 LibWeb: Add New as a possible enum variant of ModuleStatus 2023-10-31 18:09:14 +01:00
networkException 89ea444967 LibWeb: Use proper helper for appending to scripts to run after parsing
Instead of appending manually to the
scripts_to_execute_when_parsing_has_finished list, lets use the proper,
currently unused function for this.
2023-10-31 18:09:14 +01:00
networkException 4aa5816651 Toolchain: Use gcc13 serenity.nix 2023-10-31 18:09:14 +01:00
networkException 31a17b42d0 Ladybird: Use gcc13 in ladybird.nix 2023-10-31 18:09:14 +01:00
networkException 2cf3c3913a Ladybird: Use pkg-config instead of pkgconfig in ladybird.nix
pkgconfig was renamed to pkg-config in nixpkgs.

See e773b9abe9
2023-10-31 18:09:14 +01:00
Timothy Flynn 92e9145edc CI: Switch export of test262/Wasm test results to libjs-data 2023-10-31 11:33:15 -04:00
Timothy Flynn 99216b2a87 ClockSettings: Use a Vector as the time zone model's container type
The time zones were stored as a static Span until commit 0bc401a1d6, and
are now stored in a Vector. By continuing to tell the ItemListModel that
the container is a Span, we create a temporary Span in its constructor,
which the model tries to hold a constant reference to. Use the default
Vector container type now instead to prevent creating such temporaries.
2023-10-31 15:21:34 +01:00
Tim Ledbetter a6f9ad6012 LibGfx/OpenType: Ensure offsets are strictly less than the file size
Previously, an offset that was equal to the size of the file would
cause a crash.
2023-10-31 14:15:24 +01:00
Andrew Kaster 49d21619d4 CMake: Use a helper file to find GL and EGL in a platform agnostic way
Also add a flag to turn off accelerated graphics entirely.
2023-10-31 02:32:58 -06:00
Ali Mohammad Pur bec1c1fff7 AK: Explicitly instantiate FormatBuilder::put_f32_or_f64<{f32,f64}>
The default visibility of this function's implicit instantiation was
somehow different on macOS, this fixes that and doesn't affect anything
else.
2023-10-31 11:31:17 +03:30
Aliaksandr Kalenik 141f56accc LibWeb: Position abspos items inside grid relative to their grid area
Since grid item's containing block is not grid container but
corresponding grid area, it affect positioning of abspos items.
2023-10-31 08:46:17 +01:00
Aliaksandr Kalenik 44001d2178 LibWeb: Separate grid item's area rect calculation in a function in GFC
We would also have to find grid area rect while abspos items layout so
it makes sense to have this code in a separate function.
2023-10-31 08:46:17 +01:00
Andreas Kling 9f50c2c718 Tests/LibWeb: Update test expectation after float serialization changes 2023-10-31 07:25:56 +01:00
Uku Loskit 98ad5a7141 LibHTTP: Fix issues with HTTP POST request and requests with a body
The previous implementation created invalid HTTP requests in cases
where the request method was POST or when the request contained a
body. There were two bugs for these cases:

1) the 'Content-Type' header was sent twice
2) a stray CRLF was appended to the request
2023-10-31 07:09:26 +01:00
Aliaksandr Kalenik 549dee4db1 LibWeb: Call prepare_for_replaced_layout() on replaced boxes in GFC
We need to call prepare_for_replaced_layout() on grid items to populate
their natural sizes and aspect ration.
2023-10-31 07:08:30 +01:00
stelar7 a559dca816 LibTLS: Fix supported signature algorithms typo
The ED curve is INTRINSIC/ED25519, not INTRINSIC/ECDSA
2023-10-31 07:07:53 +01:00
Simon Wanner fb7b4b9c59 LibJS/JIT: Provide source location information for JIT code
This works by walking a backtrace until the currently executing
native executable is found, and then mapping the native address
to its bytecode instruction.
2023-10-31 07:07:17 +01:00
Simon Wanner 112eadc863 LibJS/JIT: Annotate disassembly with bytecode information 2023-10-31 07:07:17 +01:00
Simon Wanner 9f78e56823 LibJS/JIT: Record machine code location to bytecode location mapping 2023-10-31 07:07:17 +01:00
Timothy Flynn cf93e56833 headless-browser: Use LibWebView to sanitize input URLs
Remove the ad-hoc sanitization in favor of LibWebView. This was missed
after commit 191e20d639.
2023-10-31 07:03:15 +01:00
Tobias Christiansen 3c41ac5ae4 Tests/LibWeb: Add object-{fit,position} test 2023-10-31 07:03:05 +01:00
Tobias Christiansen 3b1083c4cb Tests/LibWeb: Add object-position to the getComputedStyle test
The test was failing because we now support the new and shiny
object-position property.
2023-10-31 07:03:05 +01:00
Tobias Christiansen e60253d64c LibWeb: Respect offsets always when painting with object-position
Previously we didn't always set the bitmap_intersect correctly when
applying an object-position. This lead to images not correctly being
centered when the axis that it should move along was not the specified
axis.
2023-10-31 07:03:05 +01:00
Tobias Christiansen 6f71b8be1b LibWeb: Use local 'offset' variable in ImagePaintable
We created the local and then did not use it everywhere we could.
2023-10-31 07:03:05 +01:00
Tobias Christiansen 3a4d30dddc LibWeb: Avoid truncation of aspect-ratio-computation in ImagePaintable
The value of the aspect ratio of the bitmap got truncated and this
lead to funky rendering problems when using object-fit and
object-position.
2023-10-31 07:03:05 +01:00
Ali Mohammad Pur 78c04cb8b2 AK+LibPDF: Make Format print floats in a roundtrip-safe way by default
Previously we assumed a default precision of 6, which made the printed
values quite odd in some cases.
This commit changes that default to print them with just enough
precision to produce the exact same float when roundtripped.

This commit adds some new tests that assert exact format outputs, which
have to be modified if we decide to change the default behaviour.
2023-10-31 09:12:35 +03:30
Andrew Kaster 26a5d84d91 Meta: Port f1b79e0cd3 to gn build 2023-10-31 00:36:51 +03:30
Andrew Kaster 2148b89d95 Meta: Update CA certificate to 2023-08-22 2023-10-31 00:36:51 +03:30
Andrew Kaster baa26d10a8 LibTLS: Retry sending in TLSv12::flush() on EAGAIN or EINTR
Crashing here is not very helpful.
2023-10-31 00:36:51 +03:30
MacDue c93d367d95 LibWeb: Layout SVG <text> elements during layout (not while painting)
Previously, all SVG <text> elements were zero-sized boxes, that were
only actually positioned and sized during painting. This led to a number
of problems, the most visible of which being that text could not be
scaled based on the viewBox.

Which this patch, <text> elements get a correctly sized layout box,
that can be hit-tested and respects the SVG viewBox.

To share code with SVGGeometryElement's the PathData (from the prior
commit) has been split into a computed path and computed transforms.
The computed path is specific to geometry elements, but the computed
transforms are shared between all SVG graphics elements.
2023-10-30 19:44:54 +01:00
MacDue dc9cb449b1 LibWeb: Store computed SVG path data/transforms in LayoutState
This removes the awkward hack to recompute the layout transform at paint
time, and makes it possible for path sizes to be computed during layout.

For example, it's possible to use relative units in SVG shapes (e.g.
<rect>), which can be resolved during layout, but would be hard to
resolve again during painting.
2023-10-30 19:44:54 +01:00
Timothy Flynn 19313945f2 LibWeb: Implement loading a favicon in absence of a <link> icon element
For example, serenityos.org does not contain a <link rel="icon"> element
to indicate its favicon. Before navigables, we implemented attempting to
load a fallback favicon in a rather ad-hoc manner. This implements the
full spec steps to do so after the HTML document is parsed.
2023-10-30 18:31:15 +01:00
Timothy Flynn b1274a885b LibWeb: Return success when a <link> element decodes a valid favicon 2023-10-30 18:31:15 +01:00
Timothy Flynn 1504469c50 js: Implement the exit builtin without calling the native exit function
If we invoke the exit native function from within the exit builtin, the
native call will then invoke global destructors. This ultimately ends up
deleting the JS::NativeFunction that defines the exit builtin, thus we
try to delete the AK::Function held inside the NativeFunction while that
AK::Function is executing. This is explicitly forbidden by AK::Function.

Instead, simply set a flag to exit the REPL after the builtin executes.
2023-10-30 18:12:17 +01:00
Andrew Kaster f9386737a6 LibTLS: Add certificate verification for ECDSA with SECP256r1 curves 2023-10-30 10:17:39 -06:00