Commit graph

48274 commits

Author SHA1 Message Date
Mathis Wiehl f7d2392b6c LibWeb: Consider deprecated application/font-woff mime type
Though deprecated by IANA, `application/font-woff` is still in active
use as a MIME type for WOFF fonts by web servers throughout the wild
web.
2023-03-18 13:47:51 +01:00
Mathis Wiehl 3a45bba4e0 LibWeb: Load alternative font urls if others fail
We don't support all parts of the font formats we assume as "supported"
in the CSS parser. For example, if an open type font has a CFF table, we
reject loading it. This meant that until now, when such an
unsupported-supported font url was first in the list of urls, we
couldn't load it at all, even when we would support a later url.

To resolve that, try loading all font urls one after each other, in case
we are not able to load the higher priority one.

This also resolves a FIXME related to spec compliant url prioritization.
Our CSS parser already filters and prioritizes font src urls in
compliance with the spec. However, we still had to resort to brittle
file extension matching, because some websites don't set the `format`
and if the first url in a src list happened to be one we don't support,
the font could not be loaded at all. This now is unnecessary because we
can try and discard the urls instead.
2023-03-18 13:47:51 +01:00
Andreas Kling 1dc074fc18 LibWeb: Treat flex item's cyclic percentage cross size as auto
This fixes an issue where e.g `height: 100%` on a flex item whose
container has indefinite height was being resolved to 0. It now
correctly behaves the same as auto.
2023-03-18 00:26:19 +01:00
Andreas Kling 062b8e5957 LibWeb: Print unimplemented calc() expressions in the debug log 2023-03-18 00:26:19 +01:00
kleines Filmröllchen 9ff01723ba Userland: Use more common WAV MIME type
There is no official IANA MIME type for WAV (see
https://www.iana.org/assignments/media-types/media-types.xhtml#audio),
so this will always be subjective. While
https://www.rfc-editor.org/rfc/rfc2361 suggests audio/vnd.wave, we use
audio/wav since that seems to be most common across the internet.
2023-03-17 22:20:16 +00:00
Daniel Bertalan e3195b060d LibVT: Fix integer overflow when parsing long OSC sequences
We were storing indices into OSC escape sequences as `u8`s, which
overflow at a length of just 256 characters. This caused a crash when
parsing OSC 8 hyperlinks pointing to long filenames.
2023-03-17 16:50:22 +00:00
Timothy Flynn 5d7a85bc37 Meta: Ensure the main thread VM is created before use in the CSS fuzzer 2023-03-17 16:48:43 +00:00
Timothy Flynn 6e1b5b541a LibWeb: Move initialization of the MainThreadVM to WebContent's main()
It is a fallible operation, so this lets us abort early if it fails.
2023-03-17 16:39:08 +00:00
Timothy Flynn 13dfadba79 LibJS: Propagate errors from VM creation 2023-03-17 16:39:08 +00:00
Timothy Flynn eb5aae24f4 LibJS: Move creation of fallible VM objects to its creation factory
No change of behavior in this patch, but this will allow this factory to
propagate any errors from the creation of these objects.
2023-03-17 16:39:08 +00:00
Luke Wilde 782cdaeccf LibWeb: Give generated constructor functions a name
Required by code that brand checks native constructors.

For example, Wistia brand checks XMLHttpRequest by doing:
```
XMLHttpRequest.prototype.constructor.toString()
```

It then checks if it matches either one of:
```
function XMLHttpRequest() { [native code] }
```
```
[object XMLHttpRequestConstructor]
```

If neither matches, it disables HLS playback and prints:
"The XMLHttpRequest constructor has been tampered with. Because this
affects CORS/Range XHR requests, HLS playback has been disabled.
To enable HLS playback and other important features, please remove code
that changes the definition of window.XMLHttpRequest."

We hit this path due to not giving generated constructors a name, as
we would provide `function () { [native code] }`.
2023-03-17 16:37:21 +00:00
gohai d5577002d5 LibGfx/OpenType: Fix bound-check 2023-03-17 15:44:45 +01:00
Kemal Zebari 3918a8492b Browser: Have the bookmark button use the editor dialog
Now when the bookmark button that has not yet bookmarked the current
URL is pressed, it will add the bookmark but also prompt the user
with the BookmarkEditor dialog in case they wish to make final
touches to their bookmark title or URL. If they cancel or escape
the dialog, the bookmark will be removed.
2023-03-17 13:43:11 +00:00
EWouters 5ec727deb4 Ports/cmake: Update CMake to version 3.26.0 2023-03-17 09:59:35 +00:00
EWouters 9841922b6b Toolchain: Update CMake to version 3.26.0 in BuildCMake.sh 2023-03-17 09:59:35 +00:00
Hendiadyoin1 170f732000 LibJS: Fix a bunch of unwind related errors in GenerateCFG
We were missing some unwind related control flow paths, and followed
some in improper ways, leading us to access a dead unwind frame in some
cases, as well as generating a technically wrong CFG.

This reorders the ways EnterUnwindContext works and alleviates those
errors.
2023-03-17 09:57:51 +00:00
Andreas Kling d38a3ca9eb LibGfx/OpenType: Add some initial support for GPOS glyph positioning
This patch parses enough of GPOS tables to be able to support the
kerning information embedded in Inter.

Since that specific font only applies positioning offsets to the first
glyph in each pair, I was able to get away with not changing our API.
Once we start adding support for more sophisticated positioning, we'll
need to be able to communicate more than a simple "kerning offset" to
the clients of this code.
2023-03-17 09:36:20 +01:00
MacDue a2f3b6543b LibWeb: Fix is<HTML::HTMLProgressElement>() check
Previously HTMLProgressElement implemented is_html_input_element() not
is_html_progress_element(), so is_html_progress_element() defaulted to
always returning false. This broke is<HTML::HTMLProgressElement>().
2023-03-17 08:39:37 +01:00
Timothy Flynn 8bba53bdff LibWeb: Remove remaining WebAssemblyObject data to the namespace file 2023-03-16 19:39:17 +00:00
Timothy Flynn 57646c86ef LibWeb: Port the WebAssembly namespace to IDL 2023-03-16 19:39:17 +00:00
Timothy Flynn 2cd7159694 LibWeb: Add a custom extended attribute for namespace-level GC visitors
Currently, the WebAssemblyObject implements a visitor to keep its static
objects alive. This custom attribute will be used to hook the generated
namespace object's visitor to one that we define in non-generated code.
2023-03-16 19:39:17 +00:00
Timothy Flynn aa06dd7f21 LibWeb: More fully implement the LegacyNamespace IDL extended attribute
Interfaces with a LegacyNamespace extended attribute should have their
constructors defined on the namespace identified by the LegacyNamespace
attribute value.
2023-03-16 19:39:17 +00:00
Timothy Flynn a277e645d3 LibWeb: Add LibJS includes to generated IDL namespace files
These will be needed by any namespace having a BufferSource parameter,
such as WebAssembly.

Similar to 49e6cb7c3d.
2023-03-16 19:39:17 +00:00
Timothy Flynn 08fabf7acb LibIDL: Partially implement distinguishing between interface-like types
This is needed for WebAssembly, where we need to distinguish between a
BufferSource and a WebAssembly.Module.
2023-03-16 19:39:17 +00:00
Linus Groh 1657a46ee7 Toolchain: Add grub2 and parted to serenity.nix
This allows building the GRUB disk image from within the nix shell.
2023-03-16 18:47:06 +00:00
Aliaksandr Kalenik bb98ae08b8 WebContent: Allow pop-ups when WebDriver is connected
Currently we have `m_should_block_pop_ups` set to true by default
which means `choose_a_browsing_context` will early return if new
top-level browsing context is requested and write `Pop-up blocked!`
in console. It is good but when WebDriver is connected we want it
to be able to actually open a new window if one is requested.
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 126fa7df14 WebContent+WebDriver: Get window handle from WebContent process
This change makes window handles on WebDriver process side be
consistent with handles returned by /window/new.
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik f287165823 LibWeb+WebContent+WebDriver: Add WebDriver endpoint to open new window 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 7061322606 LibWeb: Create new tab if a new top level BC is requested
With current process architecture where every top level browsing
context lives in a separate WebContent process we need to request
a browser to spawn new WebContent process if new top level BC is
requested.
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 8026c63e10 LibWeb: Introduce RemoteBrowsingContext
Remote browsing context represents top level browsing context that
lives in another WebContent process.
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 40ec976781 LibWeb: Inherit BrowsingContext from AbstractBrowsingContext 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik c4f94b0846 LibWeb: Introduce AbstractBrowsingContext
Introducing class for abstract browsing context is going to make it
possible to have separate implementations for:
1) Local browsing context (Top level BC of current page and iframes)
2) Remote browsing context (BC of a page that lives in another
WebContent process)
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 9d79a9b214 Browser: Implement notify_request_open_new_tab 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 640864b32e Ladybird: Implement notify_request_open_new_tab 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik a9f8d4eada LibWeb+LibWebView+WebContent+Ladybird: Add IPC call that opens new tab 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 4717d645d3 Ladybird: Generate window handle during client creation
Generate handle UUID for top-level context that is going to
run in created WebContent process and sent it over IPC.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 7c90c67a71 LibWebView: Generate window handle during client creation
Generate handle UUID for top-level context that is going to
run in created WebContent process and sent it over IPC.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 6c052c45db LibWebView: Add window handle in ClientState in ViewImplementation
Add field for a handle that is going to be used by WebDriver to
identify top-level browsing contexts.

It is supposed to be populated by WebContent client during creation.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 6d91d2fa50 WebContent: Add IPC call to set window handle from WebContent client 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik 48e0789a17 WebContent: Add IPC call to get window handle from WebContent client 2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik d87a207ca9 LibWeb: Add handle member in BrowsingContext
`handle` is uuid that is going to be used in WebDriver to identify
browsing context.
2023-03-16 13:17:37 -04:00
Aliaksandr Kalenik e8550ed21d LibWeb: Move code that generates uuid into separate function
Make possible to generate uuid without having crypto class instance.
2023-03-16 13:17:37 -04:00
Fabian Dellwing 12cd74495a LibTLS+Base: Rework default system certificate parser
Change the default system certificate parser from our arbitrary
INI format to well-known PEM format.
2023-03-16 18:54:20 +03:30
Fabian Dellwing da6130a6d8 Tests: Rework TLS test to use new cacert.pem 2023-03-16 18:54:20 +03:30
Fabian Dellwing b07654c3c1 Meta: Download cacert.pem at build time 2023-03-16 18:54:20 +03:30
Fabian Dellwing 06340ca674 LibCrypto: Add multiple PEM parser
This adds a function to parse multiple PEMs out of a single input.
This allows us to load certificates from a cacert.pem file without
need for preprocessing.
2023-03-16 18:54:20 +03:30
Timothy Flynn 700ad6bf35 WebContent+LibWebView: Consolidate the way browsers connect to WebDriver
Currently, on Serenity, we connect to WebDriver from the browser-side of
the WebContent connection for both Browser and headless-browser.

On Lagom, we connect from within the WebContent process itself, signaled
by a command line flag.

This patch changes Lagom browsers to connect to WebDriver the same way
that Serenity browsers do. This will ensure we can do other initializers
in the same order across all platforms and browsers.
2023-03-16 15:02:41 +00:00
Nico Weber 3a7257c9fe image: Don't just crash when the input file can't be decoded
If the input file didn't exist at all, the TRY(MappedFile::map())
gives us a (cryptic) error message, but if it existed but wasn't an
image file, we would crash. Now we print a message instead.
2023-03-16 10:18:44 -04:00
Nico Weber 0591aa1d96 image: Add --assign-color-profile= flag
This allows assigning a color profile from a .icc file to the output.
No pixel data conversion is taking place: the output will just contain
this profile, so it better matches the image data already.
2023-03-16 10:18:44 -04:00
Nico Weber e05bb47134 image: Add --strip-color-profile flag
With this flag, no color profile is copied from the source image
to the destination image.
2023-03-16 10:18:44 -04:00