Commit graph

63749 commits

Author SHA1 Message Date
Noah Bright
8725bb12f2 LibWeb: Define PerformanceEventTiming
https://www.w3.org/TR/event-timing/#sec-performance-event-timing

Add idl, header and stubs for PerformanceEventTiming interface.

Two missing `PerformanceEntry` types that have come up in issues
are the `first-input` and the `event` entryTypes. Those are both
this.

Also, because both of those are this same interface, the static
methods from the parent class are difficult to implement because
of instance-specific details. Might either need subclasses or to
edit the parent and also everything that inherits from it :/

(cherry picked from commit d30ae92b82d997bc4db407c563c88f90d8260093)
2024-11-11 19:54:09 -05:00
Tim Ledbetter
c8319c9166 LibWeb: Don't print messages from workers to the console twice
Previously, any message logged to the console within a worker with a
log level greater than trace was printed twice.

(cherry picked from commit d0008ae5e0100984f3188c32a67008a03c05bea8)
2024-11-11 19:54:09 -05:00
Timothy Flynn
85c6ca8417 LibWeb: Remove debug spam from Navigator methods
These are logged ~1000 times on fast.com.

(cherry picked from commit 76152845fdb74d4881c6d8e43790146780fbe7b3)
2024-11-11 19:54:09 -05:00
stelar7
2ba1e4083b LibWeb: Parse mimetype when creating Blob and File
(cherry picked from commit 193c0dcafcb81052694e9d95078f5efba0aacae6)
2024-11-11 19:54:09 -05:00
stelar7
ed7af71508 LibWeb: Iterate over utf8 codepoints when checking validity
(cherry picked from commit 0739f1b1e6ec09250b415e1efa3cdf6a038e2181)
2024-11-11 19:54:09 -05:00
Edwin Hoksberg
94d2315a59 LibWeb: Handle Refresh header
Fixes a bunch of tests in:
- https://staging.wpt.fyi/results/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh

(cherry picked from commit cbe4ba7f8c825d9732346964c8f1f1f8eec00eac)
2024-11-11 19:54:09 -05:00
rmg-x
7f96fb2c1f UI/Qt: Simplify link context menu and update keyboard shortcuts
Removes the unnecessary separator, redundant open action, and changes
shortcuts to match other browsers.

(cherry picked from commit 1f365ba44a2f95006121f689429e2f58db30bc5b)
2024-11-11 19:54:09 -05:00
Kostya Farber
02797c6e8e LibWeb/CSS: Implement delete method for FontFaceSet
(cherry picked from commit 09aec4be7165f27d65caf614b097ec2ff11ad9c0)
2024-11-11 19:30:05 -05:00
Kostya Farber
3b7adbca69 LibWeb/CSS: Implement add for FontFaceSet
There is still some work to do with some of the underying methods
called inside this method (e.g is_css_connected) but this is a start.

(cherry picked from commit 14d62d7f31e49e021332f3e64e6ea4b285dcdd15)
2024-11-11 19:30:05 -05:00
Carwyn Nelson
7a76f8b265 LibWeb: Skip transitions for pseudo elements
Transitions are currently not implemented for pseudo elements which
causes the transition to be applied to the "real"/"parent" element. When
a transition adjusts width/height on a pseudo element this causes the
real elements layout to break.

As a quick fix we just skip doing transitions when they are against
pseudo elements.

(cherry picked from commit 30f59cfe1aec0b385631a40da8b2447eed62ad79)
2024-11-11 17:22:42 -05:00
Shannon Booth
191b686699 LibWeb: Throw exception for invalid URL before creating traversable
Which fixes the following WPT test from failing due to issues stemming
from all of the windows which have been opened.

https://wpt.live/url/failure.html

This will give us 1205 new subtests passing in WPT.

(cherry picked from commit f2134dc1e960cb1d0c743b375509fe165885ddbe)
2024-11-11 17:22:42 -05:00
Shannon Booth
9150241db9 LibWeb: Throw a SyntaxError on invalid URL for Location href setter
Aligning with a spec update, fixing 195 tests for:

https://wpt.live/url/failure.html
(cherry picked from commit ea971792b5da5f10cadb4f88f49c9722d88b32f6)
2024-11-11 17:22:42 -05:00
Andreas Kling
3479bf0470 LibWeb: Make Document::m_intersection_observers a weak mapping
These registrations are not meant to keep the observers alive.
This fixes a handful of world leaks on Speedometer.

(cherry picked from commit b397a0d5350fad04f43e3e5d9bdb9c801a4e712a)
2024-11-11 17:22:05 -05:00
Andreas Kling
5cd1016714 LibJS: Add RawNonnullGCPtr<T>
This is really just a type alias for NonnullGCPtr<T>, but it provides
a way to have non-owning non-visited NonnullGCPtr<T> without getting
yelled at by the Clang plugin for catching GC errors.

(cherry picked from commit 6a6618f5eab6e6a2c7c3fc03f8063cc6b497a0ec)
2024-11-11 17:22:05 -05:00
Andreas Kling
3d36c75eee LibJS: Use correct cell address for HeapFunction captures in GC dumps
We were previously dumping the address of the cell pointer instead of
the address of the cell itself. This was causing mysterious orphans
in GC dumps, and it took me way too long to figure this out.

(cherry picked from commit e240084437ea0bfe03d83dc3533d4ee6214b7206)
2024-11-11 17:22:05 -05:00
Luke Wilde
c7f707afa6 LibJS: Allow division after IdentifierNames in optional chain
The following syntax is valid:
```js
e?.example / 1.2
```

Previously, the `/` would be treated as a unterminated regex literal,
because it was calling the regular `consume` instead of
`consume_and_allow_division`.

This is what is done when parsing IdentifierNames in
parse_secondary_expression when a period is encountered.

Allows us to parse clients-main-[hash].js on https://ubereats.com/

(cherry picked from commit bd4c29322c945647c52ff4d8045c7529f8152b08)
2024-11-11 17:22:05 -05:00
Ángel Carias
245d577235 LibWeb/DOM: Implement Node.lookupPrefix
Adds https://dom.spec.whatwg.org/#dom-node-lookupprefix

(cherry picked from commit 9624e0d2a2dc952b80e1ce1999f816f60c1ad813)
2024-11-11 15:46:34 -05:00
Ninad Sachania
0213ab8c1b Terminal: Unveil /dev/beep to make the "Audible bell" mode work 2024-11-11 10:19:42 -05:00
Jonne Ransijn
201d36665b LibJS: Remember the position into the cached indices
There is no need to do a full linear search from start to end when
we can just remember the position and continue where we left off.

(cherry picked from commit f4e24762846cfb7a98054f700319d940173086bb)
2024-11-11 10:11:22 -05:00
Christoffer Sandberg
e40ddaff92 LibJS: Count code-points instead of bytes for syntax highlight
This fixes issue #1847, a crash on view-source
for https://chalmers.se

(cherry picked from commit 84c881fc66975bdbfc8fa6d139bc38f6ec37005b)
2024-11-11 10:11:22 -05:00
Andreas Kling
e9f9716ef6 LibJS: Parse dates like "Tuesday, October 29, 2024, 18:00 UTC"
This format is used on https://jetbrains.com/

(cherry picked from commit 3180df3337cc319cdc30b33b70a19b3aafa5642b)
2024-11-11 10:11:22 -05:00
samu698
980de1b160 LibJS: Don't generate useless jumps for if statement
If statements without an else clause generated jumps to the next
instruction, this commit fixes the if statement generation so that it
dosen't produce them anymore.

This is an example of JS code that generates the useless jumps
(a => if(a){}) ();

(cherry picked from commit 7865fbfe6d04a79a253a38eaec5c21c2bde110b5)
2024-11-11 10:11:22 -05:00
Andreas Kling
37c9b1ce7b LibJS: Store RegExp flags as a bitmask
This avoids having to do O(n) contains() in the various flag accessors.

Yields a ~20% speed-up on the following microbenchmark:

    const re = /foo/dgimsvy;
    for (let i = 0; i < 1_000_000; ++i)
        re.flags;

(cherry picked from commit 257ebea3645ab709be4a984100cc6478b289d0e6)
2024-11-11 10:11:22 -05:00
Jonne Ransijn
c1acf77d6b LibJS: Add HashMap for finding Bindings by name
`find_binding_and_index` was doing a linear search, and while most
environments are small, websites using JavaScript bundlers can have
functions with very large environments, like youtube.com, which has
environments with over 13K bindings, causing environment lookups to
take a noticeable amount of time, showing up high while profiling.

Adding a HashMap significantly increases performance on such websites.

(cherry picked from commit 78ecde9923e954e8ae9bb8d7a8ceefc08a8130ae)
2024-11-11 10:11:22 -05:00
Timothy Flynn
68940f0d37 LibJS: Update spec numbers for the Iterator Helpers proposal
This proposal has reached stage 4 and was merged into the ECMA-262 spec.
See: https://github.com/tc39/ecma262/commit/961f269

(cherry picked from commit 84ad36de0692b8890a2aa7ab66ed4d679cf630c8;
amended to replace one ASSERT() with VERIFY())
2024-11-11 10:11:22 -05:00
Timothy Flynn
391797ca52 LibJS: Close iterator records inside the Iterator{Next,Step} AOs
This is an editorial change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/c4c55b6

(cherry picked from commit 896c2e2f0f08d20770e63055225b627cd4969241)
2024-11-11 10:11:22 -05:00
Timothy Flynn
c2d206a9e0 LibJS: Update spec numbers for the Promise.try proposal
This proposal has reached stage 4 and was merged into the ECMA-262 spec.
See: https://github.com/tc39/ecma262/commit/d72630f

(cherry picked from commit 3aca12d2fadca1628a4dd2f800050b4e54194d65)
2024-11-11 10:11:22 -05:00
Andreas Kling
fcc40ca35f LibWeb: Stub out SVGGraphicsElement.getScreenCTM()
This allows us to run Speedometer 3.0 to completion. :^)

(cherry picked from commit 72320be1240039822693aa1659c4adbb24cde87f)
2024-11-11 09:17:08 -05:00
Shannon Booth
7816e173fa LibJS: Update comments for WrappedFunction [[Call]] implementation
(cherry picked from commit 01c2ecf355868f7c8d3d757488e7d20b039fcc61)
2024-11-11 09:14:29 -05:00
Shannon Booth
4696edae82 LibJS: Return void from SetDefaultGlobalBindings
Aligning with spec change:

https://github.com/tc39/ecma262/commit/052def
(cherry picked from commit b5536db915623908f2f7488ab32793ba8f4e2b31)
2024-11-11 09:14:29 -05:00
Shannon Booth
70bc70acb0 LibJS: Inline somes AO's into InitializeHostDefinedRealm
Aligning with the editorial change in the spec of:

https://github.com/tc39/ecma262/commit/977a6c
(cherry picked from commit 0a1c9e4038dddbe0078e7c0ef82d8374b928bde1)
2024-11-11 09:14:29 -05:00
Shannon Booth
e1e4b50a9c LibWeb: Put setting object's promise's in WindowOrWorkerGlobalScope
This aligns with an update to the HTML specification which instead
stores these promises on the global object instead of the settings
object.

It also makes progress towards implementing the ShadowRealm proposal
as these promises are not present in the 'synthetic' realm for that
proposal.

(cherry picked from commit 1096b6493668724ff9776929339e40b33213f410)
2024-11-11 09:14:29 -05:00
Shannon Booth
ab6418f5a0 LibJS: Allow host to create ShadowRealm global object
This implements the proposed update to the ShadowRealm proposal for
integrating the ShadowRealm specification into the web platform.

(cherry picked from commit d1fc76bffdafe5a057c0da5855d9d643608bd726)
2024-11-11 09:14:29 -05:00
Shannon Booth
108ffa8eee LibJS: Initialize ShadowRealm internal slots through setters
This allows us to align our implementation in the same order as the
specification.

No functional change with the current implementation of this AO.

However, this change is required in order to correctly implement a
proposed update of the shadow realm proposal for integration with
the HTML spec host bindings in order to give the ShadowRealm
object the correct 'intrinsic' realm.

This is due to that proposed change adding a step which manipulates the
currently executing Javascript execution context, making the ordering
important.

(cherry picked from commit 0ec8af5b70702e9ee2edc7269c103fa49e6987c1)
2024-11-11 09:14:29 -05:00
Sönke Holz
03a59014b9 Meta: Add the PrekernelPEImageGenerator tool
This tool will be used to convert the Prekernel into an EFI PE32+ image.
2024-11-11 09:06:40 -05:00
Sönke Holz
eaa729c58a Meta: Make LibELF available to Lagom tools
This will be required for the PrekernelPEImageGenerator lagom tool.
2024-11-11 09:06:40 -05:00
Sönke Holz
56881cf37c LibELF: Add accessors for some header fields to ELF::Image 2024-11-11 09:06:40 -05:00
Sönke Holz
03c74dcb11 LibELF: Remove the unused Image::Section::relocations function
This function assumes that all sections have a relocation section
associated with them. This is not the case in most executables.
It also assumes that the section is called ".rel<section name>". This is
also not something we should rely on. And RELA sections usually start
with ".rela", not ".rel".
2024-11-11 09:06:40 -05:00
Sönke Holz
82e902526c LibELF: Add RELA support to ELF::Image
Only DynamicObject supported RELA previously.
2024-11-11 09:06:40 -05:00
samu698
a37e4092bc LibWeb/HTML: Implement inner text set according to spec
Replaced the ad-hoc implementation with a spec compliant one.
This change fixes 36 WPT tests.

(cherry picked from commit 50f642613de54c73473c216fdc4d7e607e712679)
2024-11-10 21:48:40 -05:00
Bastian Müller
da3b916ba3 LibWeb/XHR: Pass API URL character encoding
(cherry picked from commit 748e3c2e6c680fa78b24d7a2643fe79b234943d6)
2024-11-10 21:48:40 -05:00
Bastian Müller
62894c9d3f LibWeb/XHR: Parse URL to resolve blob
(cherry picked from commit 3be93ac49fc93b905b5466896605c3375835c97c)
2024-11-10 21:48:40 -05:00
Shannon Booth
b901a8753d LibWeb: Allow splitting surrogate pairs in CharacterData.substringData()
(cherry picked from commit b999f925dcfb0417c534e1a21aa74626a06b466b)
2024-11-10 21:48:40 -05:00
rmg-x
f30aed2e08 LibWeb/HTML: Check if evaluationStatus has a value before dereferencing
Previously, we would crash if scripting was disabled and a javascript
URL was evaluated.

(cherry picked from commit 57f82c029c1f66c516650d96c176ba0f47da0f78)
2024-11-10 21:48:40 -05:00
Andreas Kling
880b6b1375 LibWeb: Stop traversal early when marking nodes for child style update
These flags always propagate to the root, so once we encounter an
ancestor with the flag set, we can stop traversal since everything above
it will already be set as well.

(cherry picked from commit f106aa9e8a8f3a98b498e0f9324123963fad6ca2)
2024-11-10 21:48:40 -05:00
Andreas Kling
72227066c6 LibWeb: Avoid a weird reparse of style attributes for pseudo elements
For pseudo elements that represent a browser-generated shadow tree
element, such as ::placeholder, we were reparsing their style attribute
in StyleComputer for some reason.

Instead of doing this, just access the already-parsed version via
Element::inline_style().

(cherry picked from commit d21c5631aa5d3bebcf828e893f0d7da031481894)
2024-11-10 21:48:40 -05:00
sideshowbarker
7e9c2bd36f Meta: Add script for checking WebIDL files
This adds a new script for linting WebIDL files, and adds it to the set
of scripts Meta/lint-ci.sh runs. Initially, this script does just one
thing: normalizes IDL definition lines so they start with four spaces.

(cherry picked from commit a7578164d4ea2aa6e7831d83e9a55b1ff39e37f7;
minorly amended to resolve conflict in lint-ci.sh due to serenity still
having check-emoji.py and check-markdown.sh)
2024-11-10 21:19:33 -05:00
sideshowbarker
8c9acd4a76 LibWeb: Normalize all WebIDL definition lines to four leading spaces
This change takes all existing WebIDL files in the repo that had
definition lines without four leading spaces, and fixes them so they
have four leading spaces.

(cherry picked from commit 51528ec6779202747cc3b99d3b77772a124a0b47)
2024-11-10 21:19:33 -05:00
Andreas Kling
c2d89a02c7 LibWeb: Check for active document in descendant_navigables()
This is not in the spec, but I did see a null pointer dereference here
while browsing the web, and it seems completely harmless for this
function to skip over navigables without an active document.

(cherry picked from commit 56e1c0e7eec813c311c41696063a3a31b4b14f0d)
2024-11-10 20:06:23 -05:00
Andreas Kling
0897967771 LibWeb: Recompute targetStep during "apply the history step"
This is an ad-hoc change to account for the fact that we may run
arbitrary code while waiting for the tasks in this function to complete.

I don't have a way to reproduce it, but I've seen trouble caused by
navigables disappearing, which causes the history step numbers to be
disturbed.

(cherry picked from commit ac48222ed7b497b13343ec79a234ba432ffd29e2)
2024-11-10 20:06:23 -05:00