Commit Graph

49453 Commits

Author SHA1 Message Date
Timothy Flynn
5089766af6 Browser+Ladybird+LibWeb: Port content filters to String 2023-04-22 12:32:40 +02:00
Timothy Flynn
76ae60da15 Browser+Ladybird+LibWeb: Prevent infinite growth of content filters
We never clear content filters on either end of the Browser-WebContent
IPC connection. So when the filters change, we re-append all filters to
the Vector holding them. This incidentally makes it impossible to remove
a filter.

Change both sides to clear their filter lists when receiving a new set
of filters.
2023-04-22 12:32:40 +02:00
Sam Atkins
b0ffb15e13 copy: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
Sam Atkins
f7375d664c config: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
Sam Atkins
739e657ad0 cksum: Stop using DeprecatedString
This has the side-effect of making the algorithm name case-sensitive,
but there doesn't seem to be an especially good reason to support that.
On the other hand, converting an AK::String to lowercase would require
linking LibUnicode.
2023-04-22 07:17:08 +02:00
Sam Atkins
2db4a2450b chown: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
Sam Atkins
916e7a5a3f asctl: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
Sam Atkins
8377db260f arp: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
Sam Atkins
b3cd91d26d Utilities: Use lround() instead of casting round() to long
And one case where we previously cast to int, since the extra precision
does not matter.
2023-04-22 07:17:08 +02:00
Sam Atkins
f2ae25deee cmp: Replace uses of DeprecatedString 2023-04-22 07:17:08 +02:00
Sam Atkins
684af3d4d0 cmp: Use Core::File::open_file_or_standard_stream() 2023-04-22 07:17:08 +02:00
Sam Atkins
0f95ff64ed Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
Liav A
ee4e9b807a Kernel: Protect internal structures in InodeWatcher with spinlocks
This was the last change that was needed to be able boot with the flag
of LOCK_IN_CRITICAL_DEBUG. That flag is not always enabled because there
are still other issues in which we hold a spinlock and still try to lock
a mutex.

Instead of using one global mutex we can protect internal structures of
the InodeWatcher class with SpinlockProtected wrappers. This in turn
allows the InodeWatcher code to be called from other parts in the kernel
while holding a prior spinlock properly.
2023-04-22 07:16:41 +02:00
Nico Weber
cf3835b29b LibGfx/JPEG: Make non-zero-terminated APPn starts non-fatal
Necessary but not sufficient for #18456.
2023-04-21 22:09:31 -04:00
Sam Atkins
22e0603bf7 LibWeb: Implement integrity-metadata part of fetch algorithm
Specifically, this makes `<link>` elements with an `integrity` attribute
actually work. Previously, we would load their resource, and then drop
it on the floor without actually using it.

The Subresource Integrity code is in `LibWeb/SRI`, since SRI is the name
of the recommendation spec: https://www.w3.org/TR/SRI/

However, the Fetch spec links to the editor's draft, which varies
significantly from the recommendation, and so that is what the code is
based on and what the spec comments link to:
https://w3c.github.io/webappsec-subresource-integrity/

Fixes #18408
2023-04-21 20:44:47 +01:00
Sam Atkins
6d93e03211 LibWeb+Browser+Ladybird: Use JS::SafeFunction for EventLoop callbacks
This automatically protects captured objects from being GC'd before the
callback runs.
2023-04-21 20:44:47 +01:00
Sam Atkins
892470a912 AK: Add Array::contains_slow() and ::first_index_of(), with tests :^) 2023-04-21 20:44:47 +01:00
Sam Atkins
955528055c LibWeb: Add FIXME: for new step 6 of Fetch's "main fetch"
This step was added in this commit:
2d78995db8
2023-04-21 20:44:47 +01:00
Andreas Kling
b7e847e58b AK: Fix crash during teardown of self-owning objects
We now null out smart pointers *before* calling unref on the pointee.
This ensures that the same smart pointer can't be used to acquire a new
reference to the pointee after its destruction has begun.

I ran into this when destroying a non-empty IntrusiveList of RefPtrs,
but the problem was more general so this fixes it for all of RefPtr,
NonnullRefPtr, OwnPtr and NonnullOwnPtr.
2023-04-21 18:15:00 +02:00
Nico Weber
66bd7cdb28 LibGfx: Move two globals into the only functions that use them
No real behavior change. (The two globals are now both initialized
at first use instead of before main(), but that should have no
observable effect. The motivation is readability.)
2023-04-21 15:55:03 +02:00
Tim Schumacher
12ce6ef3d7 Kernel+Userland: Remove the nfds entry from /sys/kernel/processes
`process.fds()` is protected by a Mutex, which causes issues when we try
to acquire it while holding a Spinlock. Since nothing seems to use this
value, let's just remove it entirely for now.
2023-04-21 13:55:23 +02:00
Aliaksandr Kalenik
ce483fb2c9 Tests/LibWeb: Time limit layout tests
This change will prevent CI runners from being stuck trying to run
layout tests on PR that made browser hang.
2023-04-21 11:00:21 +01:00
Aliaksandr Kalenik
8cf0cc4d0a Meta: Add coreutils in macos Azure setup
coreutils include timeout tool that is going to be used in layout
tests script.
2023-04-21 11:00:21 +01:00
Jamie Mansfield
926c16f0ce Spider: Fix crash when completing a deck
This resolves a regression caused by
8a48246ed1.
2023-04-21 10:59:32 +01:00
Luke Wilde
8addcd237c LibWeb: Make WebSocket#send support typed arrays, Blob and DataView
Required by jigsawpuzzles.io, which particularly uses typed arrays.
2023-04-21 07:59:50 +02:00
Luke Wilde
1b6492d0fb LibWeb: Return typed array and ArrayBuffer for BufferSource in IDL union
Previous this ignored typed arrays and ArrayBuffer, hitting the
fallback JS -> C++ conversion case, typically stringifying them.
2023-04-21 07:59:50 +02:00
Luke Wilde
1f863de9aa LibWeb: Add XMLDocument stub
Required by old versions of Pixi.js's XMLFormat bitmap font loader.
db824181dc/packages/text-bitmap/src/formats/XMLFormat.ts (L16)
2023-04-21 07:59:50 +02:00
Timothy Flynn
3d0ac399c4 Ladybird: Add a command line flag to disable launching SQLServer 2023-04-21 07:56:14 +02:00
Timothy Flynn
a01ad58e91 Browser: Add support for CookieJar to run in a transient, in-memory mode
This is to allow running Ladybird without the SQL database for testing.
Primarily, this will let us set 'follow-fork-mode' to 'child' within GDB
to enter the WebContent process, rather than the SQLServer process. But
this is also handy for digging into cookie storage issues.
2023-04-21 07:56:14 +02:00
Timothy Flynn
59a1a3f463 Base: Add options to the video test page to change its attributes
This is to allow testing autoplay, poster images, etc. without having to
stash local changes to the page. This also changes the URLs used on the
page to be relative to the page itself, to allow the page to load both
on Serenity and Lagom.
2023-04-21 07:54:36 +02:00
Timothy Flynn
83bb24991b LibWeb: Implement HTMLVideoElement representation closer to the spec
The representation is used to indicate whether the layout node should
paint a video frame, the video's poster, or a "transparent black" box.
2023-04-21 07:54:36 +02:00
Timothy Flynn
e0ccba9c85 LibWeb: Implement the HTMLVideoElement poster attribute
This will fetch the URL indicated by the poster attribute when it's set,
changed, or removed. The spec doesn't say how to handle animated poster
images, so we just grab the first frame of the image, which seems to
match other implementations.
2023-04-21 07:54:36 +02:00
Timothy Flynn
b384f2009d LibWeb: Implement the HTMLMediaElement show-poster flag
Note that this doesn't do much yet, as the HTMLVideoElement does not
handle its poster attribute as of this commit.
2023-04-21 07:54:36 +02:00
Timothy Flynn
12c15641c1 LibWeb: Implement the HTMLMediaElement "potentially playing" concept 2023-04-21 07:54:36 +02:00
Timothy Flynn
9f71799456 LibWeb: Make HTMLMediaElement's attribute change handlers protected
These will be need to be overridden by HTMLVideoElement. We also need to
be sure to invoke HTMLMediaElement's base class's did_remove_attribute.
2023-04-21 07:54:36 +02:00
Timothy Flynn
42d93005ac LibWeb: Add a getter for HTMLMediaElement's current playback position
This will be needed by the layout node, which may change what is painted
when the position of the frame image is not the same as the element's
current time.
2023-04-21 07:54:36 +02:00
Timothy Flynn
dd188aafb9 LibWeb: Track decoded video frame positions along with the frame image
This will be needed by the layout node, which may change what is painted
when the position of the frame image is not the same as the element's
current time.
2023-04-21 07:54:36 +02:00
Aliaksandr Kalenik
46c98dbf43 LibWeb: Use device pixels to translate NestedBrowsingContextPaintable
Fix translation of iframes when pixel size is not 1.0.
2023-04-20 20:44:02 +02:00
Linus Groh
37c9dbe248 LibWeb/Painting: Move-assign value in set_containing_line_box_fragment
An Optional<Layout::LineBoxFragmentCoordinate> is 24 bytes, which isn't
small enough to pass by value and then copy.
2023-04-20 20:43:30 +02:00
Linus Groh
352da3623b LibWeb/Painting: Remove redundant 'Painting::' namespace prefixes 2023-04-20 20:43:30 +02:00
Linus Groh
36d35c9c82 LibWeb: Rename remaining paint_box variables to paintable_box
These don't match the type name, which is confusing.
2023-04-20 20:43:30 +02:00
Linus Groh
a75915f055 LibWeb/Layout: Rename BlockContainer::paint{_box => able_with_lines}()
It returns a PaintableBox (a PaintableWithLines, to be specific), not a
'PaintBox'. paintable_box() without the cast is already available
through BlockContainer's Box base class, we don't need to shadow it.
2023-04-20 20:43:30 +02:00
Linus Groh
d58b671ff6 LibWeb/DOM: Rename Node::{paint => paintable}_box()
It returns a PaintableBox, not a 'PaintBox'.
2023-04-20 20:43:30 +02:00
Linus Groh
754e458d0a LibWeb/Layout: Rename Box::{paint => paintable}_box()
It returns a PaintableBox, not a 'PaintBox'.
2023-04-20 20:43:30 +02:00
Linus Groh
ec37b55777 LibWeb/Painting: Rename StackingContext::paintable{ => _box}()
It returns a PaintableBox, not any Paintable.
2023-04-20 20:43:30 +02:00
Linus Groh
e6be5c37c0 LibWeb/WebDriver: Handle WindowProxy in internal_json_clone_algorithm()
To test:

```console
curl http://0.0.0.0:8000/session \
  -H 'Content-Type: application/json' \
  -d '{"capabilities": {}}'
curl http://0.0.0.0:8000/session/0/execute/sync \
  -H 'Content-Type: application/json' \
  -d '{"script": "return window;", "args": []}'
```

Which should result in:

```json
{
  "value": {
    "window-fcc6-11e5-b4f8-330a88ab9d7f":
    "86307df6-e2f1-4175-85cb-77295ff90898"
  }
}
```
2023-04-20 14:41:31 -04:00
Karol Kosek
84a231d4e5 TextEditor: Propagate errors from MainWidget::initialize_menubar() 2023-04-20 17:02:23 +01:00
Karol Kosek
83af64f053 SQLStudio: Propagate errors from MainWidget::initialize_menubar() 2023-04-20 17:02:23 +01:00
Karol Kosek
0b110c88ae PDFViewer: Propagate errors from PDFViewerWidget::initialize_menubar() 2023-04-20 17:02:23 +01:00
Karol Kosek
41cf3b741f HexEditor: Propagate errors from HexEditorWidget::initialize_menubar() 2023-04-20 17:02:23 +01:00