Skip to content

Truly independent web browser

LibWebView: Show the platform features on about:support

Zaggy10243de26a7575a2
diff --git a/Base/res/ladybird/about-pages/about.html b/Base/res/ladybird/about-pages/about.html
index 001ca7380df..3c12306030e 100644
--- a/Base/res/ladybird/about-pages/about.html
+++ b/Base/res/ladybird/about-pages/about.html
@@ -45,6 +45,7 @@
<li><a href="about:bookmarks">about:bookmarks</a></li>
<li><a href="about:crashes">about:crashes</a></li>
<li><a href="about:settings">about:settings</a></li>
+ <li><a href="about:support">about:support</a></li>
<li><a href="about:version">about:version</a></li>
</ul>
</body>
diff --git a/Base/res/ladybird/about-pages/support.html b/Base/res/ladybird/about-pages/support.html
new file mode 100644
index 00000000000..e0c62783ef5
--- /dev/null
+++ b/Base/res/ladybird/about-pages/support.html
@@ -0,0 +1,455 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="color-scheme" content="light dark" />
+ <title>Support</title>
+ <link rel="icon" type="image/png" href="resource://icons/48x48/app-browser.png" />
+ <link rel="stylesheet" type="text/css" href="resource://ladybird/ladybird.css" />
+ <link rel="stylesheet" type="text/css" href="resource://ladybird/about-pages/webui.css" />
+ <style>
+ :root {
+ --indent: 18px;
+ }
+
+ body {
+ max-width: 880px;
+ padding: 48px 24px;
+ }
+
+ /* The features are one grid rather than a table, so that a long name can wrap instead of widening the page.
+ Each row only groups its cells, which line up in the grid's columns. */
+ #feature-grid {
+ display: grid;
+ grid-template-columns: minmax(0, max-content) max-content minmax(14em, 1fr);
+ font-size: 13px;
+ }
+
+ .feature-row {
+ display: contents;
+ }
+
+ .feature-row > * {
+ padding: 8px;
+ border-top: 1px solid var(--border-color);
+ }
+
+ .feature-row.heading > * {
+ padding-top: 0;
+ border-top: none;
+
+ color: var(--secondary-text-color);
+ font-weight: 500;
+ }
+
+ /* What the state alone does not say goes under it. */
+ .status-detail {
+ margin-top: 2px;
+ overflow-wrap: break-word;
+ color: var(--secondary-text-color);
+ }
+
+ .status-feature {
+ font-family: monospace;
+ }
+
+ .feature-name {
+ display: flex;
+ align-items: flex-start;
+ gap: 4px;
+ min-width: 0;
+ }
+
+ /* Long names break after their dots. */
+ .feature-id {
+ min-width: 0;
+ overflow-wrap: break-word;
+ font-family: monospace;
+ }
+
+ .toggle,
+ .toggle-spacer {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ flex: none;
+ width: 18px;
+ height: 18px;
+ padding: 0;
+ }
+
+ .toggle {
+ border: none;
+ background: none;
+ color: var(--secondary-text-color);
+ font-size: 12px;
+ cursor: pointer;
+ }
+
+ .state-enabled {
+ color: var(--success);
+ }
+
+ .state-blocklisted,
+ .state-failed-at-runtime {
+ color: var(--error);
+ }
+
+ .state-unsupported,
+ .state-disabled-by-user,
+ .state-blocked-by-dependency {
+ color: var(--muted);
+ }
+
+ dl {
+ display: grid;
+ grid-template-columns: minmax(140px, 32%) 1fr;
+ gap: 6px 16px;
+
+ margin: 0;
+ font-size: 13px;
+ }
+
+ dt {
+ color: var(--secondary-text-color);
+ }
+
+ dd {
+ margin: 0;
+ overflow-wrap: anywhere;
+ }
+
+ .section-title {
+ margin: 16px 0 8px 0;
+ font-size: 13px;
+ font-weight: 600;
+ }
+
+ .section-title:first-child {
+ margin-top: 0;
+ }
+
+ pre {
+ overflow-x: auto;
+ margin: 8px 0 0 0;
+ font-size: 12px;
+ }
+
+ summary {
+ cursor: pointer;
+ font-size: 13px;
+ }
+
+ @media (max-width: 640px) {
+ :root {
+ --indent: 10px;
+ }
+
+ body {
+ padding: 24px 16px;
+ }
+
+ .process {
+ display: none;
+ }
+
+ /* The status goes under the name. */
+ #feature-grid {
+ display: block;
+ }
+
+ .feature-row {
+ display: block;
+ padding: 8px 0;
+ border-top: 1px solid var(--border-color);
+ }
+
+ .feature-row > * {
+ padding: 0;
+ border-top: none;
+ }
+
+ .feature-row .status {
+ padding-left: calc(var(--depth) * var(--indent) + 22px);
+ }
+
+ .feature-row.heading {
+ display: none;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <h1>Support</h1>
+ </header>
+
+ <div class="card-title">System</div>
+ <div class="card">
+ <div class="card-body" id="system"></div>
+ </div>
+
+ <div class="card-title">Platform features</div>
+ <div class="card">
+ <div class="card-body">
+ <div id="feature-grid">
+ <div class="feature-row heading">
+ <div>Feature</div>
+ <div class="process">Process</div>
+ <div>Status</div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="card">
+ <div class="card-body">
+ <details>
+ <summary>Full report</summary>
+ <pre id="report"></pre>
+ </details>
+ </div>
+ </div>
+
+ <script>
+ const featuresElement = document.querySelector("#feature-grid");
+ const headingRow = featuresElement.querySelector(".heading");
+ const systemElement = document.querySelector("#system");
+ const reportElement = document.querySelector("#report");
+
+ const collapsedStorageKey = "support.collapsedFeatures";
+ let collapsed = new Set();
+ try {
+ collapsed = new Set(JSON.parse(localStorage.getItem(collapsedStorageKey) ?? "[]"));
+ } catch {}
+
+ let report = null;
+
+ function stateClass(state) {
+ return "state-" + state.toLowerCase().replaceAll(" ", "-");
+ }
+
+ // The state names the feature that blocked this one, and anything more it does not say goes under it.
+ function describeStatus(feature) {
+ const status = document.createElement("div");
+ status.className = "status";
+
+ const state = document.createElement("div");
+ state.className = stateClass(feature.state);
+ if (feature.blocked_by) {
+ const blockingFeature = document.createElement("span");
+ blockingFeature.className = "status-feature";
+ blockingFeature.textContent = feature.blocked_by;
+ state.append("Blocked by ", blockingFeature);
+ } else if (feature.forced) {
+ state.textContent = "Enabled (forced)";
+ } else {
+ state.textContent = feature.state;
+ }
+ status.append(state);
+
+ if (feature.reason) {
+ const detail = document.createElement("div");
+ detail.className = "status-detail";
+ detail.textContent = feature.rule ? `${feature.reason} [${feature.rule}]` : feature.reason;
+ status.append(detail);
+ }
+ return status;
+ }
+
+ function renderFeatures() {
+ // The rows are rebuilt, so focus moves to the new toggle of the feature whose toggle had it.
+ const focusedFeatureId = document.activeElement?.dataset.featureId;
+ let toggleToFocus = null;
+ featuresElement.replaceChildren(headingRow);
+
+ const children = new Map();
+ for (const feature of report.features) {
+ const parent = feature.dependency ?? null;
+ if (!children.has(parent)) children.set(parent, []);
+ children.get(parent).push(feature);
+ }
+
+ function appendRows(feature, depth) {
+ const row = document.createElement("div");
+ row.className = "feature-row";
+ row.style.setProperty("--depth", depth);
+ const hasChildren = children.has(feature.id);
+
+ const nameContents = document.createElement("div");
+ nameContents.className = "feature-name";
+ nameContents.style.paddingLeft = `calc(${depth} * var(--indent))`;
+ if (hasChildren) {
+ const toggle = document.createElement("button");
+ toggle.className = "toggle";
+ toggle.dataset.featureId = feature.id;
+ if (feature.id === focusedFeatureId) toggleToFocus = toggle;
+ const isCollapsed = collapsed.has(feature.id);
+ toggle.textContent = isCollapsed ? "▸" : "▾";
+ toggle.title = `${isCollapsed ? "Show" : "Hide"} the features that depend on this one`;
+ toggle.addEventListener("click", () => {
+ if (collapsed.has(feature.id)) collapsed.delete(feature.id);
+ else collapsed.add(feature.id);
+ try {
+ localStorage.setItem(collapsedStorageKey, JSON.stringify([...collapsed]));
+ } catch {}
+ renderFeatures();
+ });
+ nameContents.append(toggle);
+ } else {
+ const spacer = document.createElement("span");
+ spacer.className = "toggle-spacer";
+ nameContents.append(spacer);
+ }
+ // A nested feature is named without the prefix its parent's row already shows.
+ let shownId = feature.id;
+ if (feature.dependency && feature.id.startsWith(`${feature.dependency}.`))
+ shownId = feature.id.slice(feature.dependency.length + 1);
+ const id = document.createElement("span");
+ id.className = "feature-id";
+ id.title = feature.id;
+ shownId.split(".").forEach((part, index) => {
+ if (index > 0) id.append(".", document.createElement("wbr"));
+ id.append(part);
+ });
+ nameContents.append(id);
+
+ const process = document.createElement("div");
+ process.className = "process";
+ process.textContent = feature.process;
+
+ row.append(nameContents, process, describeStatus(feature));
+ featuresElement.append(row);
+
+ if (hasChildren && !collapsed.has(feature.id)) {
+ for (const child of children.get(feature.id)) appendRows(child, depth + 1);
+ }
+ }
+
+ for (const root of children.get(null) ?? []) appendRows(root, 0);
+ toggleToFocus?.focus();
+ }
+
+ function hex(value, digits = 4) {
+ return "0x" + value.toString(16).padStart(digits, "0");
+ }
+
+ function vulkanVersion(value) {
+ return `${(value >>> 22) & 0x7f}.${(value >>> 12) & 0x3ff}.${value & 0xfff}`;
+ }
+
+ // Each driver packs its version its own way. These are VkDriverId's values for the ones that differ.
+ function driverVersion(driverId, value) {
+ const nvidiaProprietary = 4;
+ const intelProprietaryWindows = 5;
+ if (driverId === nvidiaProprietary)
+ return `${value >>> 22}.${(value >>> 14) & 0xff}.${(value >>> 6) & 0xff}.${value & 0x3f}`;
+ if (driverId === intelProprietaryWindows) return `${value >>> 14}.${value & 0x3fff}`;
+ return vulkanVersion(value);
+ }
+
+ function libraryVersion(value) {
+ return `${value >>> 16}.${(value >>> 8) & 0xff}.${value & 0xff}`;
+ }
+
+ function yesNo(value) {
+ return value ? "Yes" : "No";
+ }
+
+ function appendSection(title, entries) {
+ const heading = document.createElement("div");
+ heading.className = "section-title";
+ heading.textContent = title;
+
+ const list = document.createElement("dl");
+ for (const [term, description] of entries) {
+ const termElement = document.createElement("dt");
+ termElement.textContent = term;
+ const descriptionElement = document.createElement("dd");
+ descriptionElement.textContent = description;
+ list.append(termElement, descriptionElement);
+ }
+ systemElement.append(heading, list);
+ }
+
+ // What the GPU reported for decoding a codec through Vulkan, worded after Vulkan's flags, before any feature
+ // decided whether to use it.
+ function describeVulkanVideoDecoding(codec) {
+ if (!codec.supported) return "Not supported";
+ const capabilities = ["Supported"];
+ if (codec.dpb_and_output_coincide) capabilities.push("DPB and output coincide");
+ if (codec.dpb_and_output_distinct) capabilities.push("DPB and output distinct");
+ if (codec.dpb_supports_drm_format_modifiers) capabilities.push("DPB supports DRM format modifiers");
+ return capabilities.join(", ");
+ }
+
+ function describeGpuVideoDecoding(gpu) {
+ if (gpu.cannot_decode_video_because)
+ return [["Vulkan video decoding", gpu.cannot_decode_video_because]];
+ return [
+ ["H.264 through Vulkan", describeVulkanVideoDecoding(gpu.h264)],
+ ["HEVC through Vulkan", describeVulkanVideoDecoding(gpu.h265)],
+ ["VP9 through Vulkan", describeVulkanVideoDecoding(gpu.vp9)],
+ ["AV1 through Vulkan", describeVulkanVideoDecoding(gpu.av1)],
+ ];
+ }
+
+ function describeFFmpeg(ffmpeg) {
+ return [
+ ["libavcodec", libraryVersion(ffmpeg.avcodec_version)],
+ ["libavutil", libraryVersion(ffmpeg.avutil_version)],
+ ["Matches the bundled struct layouts", yesNo(ffmpeg.shares_bundled_struct_layouts)],
+ ];
+ }
+
+ function renderSystem() {
+ systemElement.replaceChildren();
+ const facts = report.facts;
+
+ if (report.probe_failure) appendSection("Probe", [["Failure", report.probe_failure]]);
+
+ const gpu = facts.gpu;
+ if (!report.describes_gpu) {
+ appendSection("GPU", [["Device", "Not described by this build"]]);
+ } else if (gpu) {
+ appendSection("GPU", [
+ ["Device", gpu.device_name],
+ ["Vendor and device ID", `${hex(gpu.vendor_id)}:${hex(gpu.device_id)}`],
+ ["Driver", `${gpu.driver_name} ${gpu.driver_info} (driver ID ${gpu.driver_id})`],
+ [
+ "Driver version",
+ `${driverVersion(gpu.driver_id, gpu.driver_version)} (${hex(gpu.driver_version, 8)})`,
+ ],
+ ["Vulkan", vulkanVersion(gpu.api_version)],
+ ["Identity", gpu.device_identity],
+ ["YCbCr sampling", yesNo(gpu.supports_ycbcr_sampling)],
+ ...describeGpuVideoDecoding(gpu),
+ ]);
+ } else if (!report.probe_failure) {
+ appendSection("GPU", [["Device", "None described"]]);
+ }
+
+ if (report.describes_ffmpeg) {
+ if (facts.bundled_ffmpeg) appendSection("Bundled FFmpeg", describeFFmpeg(facts.bundled_ffmpeg));
+ if (facts.system_ffmpeg) appendSection("System FFmpeg", describeFFmpeg(facts.system_ffmpeg));
+ else appendSection("System FFmpeg", [["Library", "None found"]]);
+ }
+ }
+
+ function render() {
+ renderSystem();
+ renderFeatures();
+ reportElement.textContent = JSON.stringify(report, null, 4);
+ }
+
+ document.addEventListener("WebUIMessage", event => {
+ if (event.detail.name === "loadPlatformFeatures") {
+ report = event.detail.data;
+ render();
+ }
+ });
+
+ document.addEventListener("WebUILoaded", () => ladybird.sendMessage("loadPlatformFeatures"));
+ </script>
+ </body>
+</html>
diff --git a/Libraries/LibWebView/Application.cpp b/Libraries/LibWebView/Application.cpp
index e7332dffb95..284176d4ee2 100644
--- a/Libraries/LibWebView/Application.cpp
+++ b/Libraries/LibWebView/Application.cpp
@@ -81,6 +81,7 @@
#include <LibWebView/WebContentClient.h>
#include <LibWebView/WebDriverBiDi.h>
#include <LibWebView/WebDriverBrowserConnection.h>
+#include <LibWebView/WebUI/SupportUI.h>
#include <LibWebView/WorkerAgentManager.h>
#if !defined(AK_OS_WINDOWS)
@@ -2039,6 +2040,39 @@ void Application::system_facts_arrived(SystemFacts const& facts)
void Application::reevaluate_platform_features()
{
m_platform_feature_decisions = PlatformFeatureDecisions::evaluate(m_system_facts, m_feature_overrides, m_feature_runtime_failures);
+ SupportUI::platform_features_changed();
+}
+
+JsonObject Application::platform_features_report() const
+{
+ JsonArray features;
+ for (auto feature : PlatformFeatures::all_features) {
+ auto const& status = m_platform_feature_decisions->status_of(feature);
+ if (status.state == FeatureStatus::State::NotBuilt)
+ continue;
+ JsonObject object;
+ object.set("id"sv, PlatformFeatures::feature_id(feature));
+ object.set("process"sv, PlatformFeatures::process_name(PlatformFeatures::process_of(feature)));
+ if (auto dependency = PlatformFeatures::dependency_of(feature); dependency.has_value())
+ object.set("dependency"sv, PlatformFeatures::feature_id(*dependency));
+ object.set("state"sv, feature_state_name(status.state));
+ object.set("forced"sv, status.forced);
+ object.set("reason"sv, status.reason);
+ if (!status.rule_id.is_empty())
+ object.set("rule"sv, status.rule_id);
+ if (status.blocking_feature.has_value())
+ object.set("blocked_by"sv, PlatformFeatures::feature_id(*status.blocking_feature));
+ features.must_append(move(object));
+ }
+
+ JsonObject report;
+ report.set("features"sv, move(features));
+ report.set("describes_gpu"sv, PlatformFeatures::this_build.paints_through_vulkan);
+ report.set("describes_ffmpeg"sv, PlatformFeatures::this_build.decodes_video_through_vulkan());
+ report.set("facts"sv, m_system_facts.to_json());
+ if (m_system_facts.probe_failure.has_value())
+ report.set("probe_failure"sv, *m_system_facts.probe_failure);
+ return report;
}
void Application::when_platform_features_are_current(Function<void()> callback)
diff --git a/Libraries/LibWebView/Application.h b/Libraries/LibWebView/Application.h
index 2abd8a813a0..42077631818 100644
--- a/Libraries/LibWebView/Application.h
+++ b/Libraries/LibWebView/Application.h
@@ -398,6 +398,8 @@ public:
// Calls back once the features are decided from this launch's probe rather than from cached facts.
void when_platform_features_are_current(Function<void()>);
PlatformFeatures::ProcessFeatures platform_features_for(FeatureProcess) const;
+ // Every feature's decision and the facts they were made from, for people to read.
+ JsonObject platform_features_report() const;
protected:
explicit Application(Optional<ByteString> ladybird_binary_path = {});
diff --git a/Libraries/LibWebView/CMakeLists.txt b/Libraries/LibWebView/CMakeLists.txt
index 9b113aa27b1..85bbd681f6d 100644
--- a/Libraries/LibWebView/CMakeLists.txt
+++ b/Libraries/LibWebView/CMakeLists.txt
@@ -94,6 +94,7 @@ set(SOURCES
WebUI.cpp
WebUI/ApplicationWebUI.cpp
WebUI/CrashReportsUI.cpp
+ WebUI/SupportUI.cpp
WebUI/SettingsUI.cpp
WebWorkerClient.cpp
WorkerAgentManager.cpp
diff --git a/Libraries/LibWebView/WebUI.cpp b/Libraries/LibWebView/WebUI.cpp
index d504cdfbc34..34f78e871a2 100644
--- a/Libraries/LibWebView/WebUI.cpp
+++ b/Libraries/LibWebView/WebUI.cpp
@@ -13,6 +13,7 @@
#include <LibWebView/WebUI/ApplicationWebUI.h>
#include <LibWebView/WebUI/CrashReportsUI.h>
#include <LibWebView/WebUI/SettingsUI.h>
+#include <LibWebView/WebUI/SupportUI.h>
namespace WebView {
@@ -22,6 +23,7 @@ static constexpr auto s_pages = to_array<WebUI::Page>({
{ "crashes"sv, "Crash Reports"sv, WebUI::PageType::Dynamic },
{ "newtab"sv, "New Tab"sv, WebUI::PageType::Static },
{ "settings"sv, "Settings"sv, WebUI::PageType::Dynamic },
+ { "support"sv, "Support"sv, WebUI::PageType::Dynamic },
{ "welcome"sv, "Welcome"sv, WebUI::PageType::Dynamic },
});
@@ -94,6 +96,8 @@ ErrorOr<RefPtr<WebUI>> WebUI::create(WebContentClient& client, Web::PageId page_
web_ui = TRY(create_web_ui<CrashReportsUI>(client, page_id, move(host)));
else if (page->host.is_one_of("settings"sv, "welcome"sv))
web_ui = TRY(create_web_ui<SettingsUI>(client, page_id, move(host)));
+ else if (page->host == "support"sv)
+ web_ui = TRY(create_web_ui<SupportUI>(client, page_id, move(host)));
VERIFY(web_ui);
web_ui->register_interfaces();
diff --git a/Libraries/LibWebView/WebUI/SupportUI.cpp b/Libraries/LibWebView/WebUI/SupportUI.cpp
new file mode 100644
index 00000000000..5aa19e9464a
--- /dev/null
+++ b/Libraries/LibWebView/WebUI/SupportUI.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/HashTable.h>
+#include <AK/NeverDestroyed.h>
+#include <LibWebView/Application.h>
+#include <LibWebView/WebUI/SupportUI.h>
+
+namespace WebView {
+
+static NeverDestroyed<HashTable<SupportUI*>> s_open_pages;
+
+SupportUI::~SupportUI()
+{
+ s_open_pages->remove(this);
+}
+
+void SupportUI::register_interfaces()
+{
+ s_open_pages->set(this);
+ register_interface("loadPlatformFeatures"sv, [this](auto const&) {
+ load_platform_features();
+ });
+}
+
+void SupportUI::platform_features_changed()
+{
+ for (auto* page : *s_open_pages) {
+ if (page->has_client())
+ page->load_platform_features();
+ }
+}
+
+void SupportUI::load_platform_features()
+{
+ async_send_message("loadPlatformFeatures"sv, Application::the().platform_features_report());
+}
+
+}
diff --git a/Libraries/LibWebView/WebUI/SupportUI.h b/Libraries/LibWebView/WebUI/SupportUI.h
new file mode 100644
index 00000000000..1fb558bc507
--- /dev/null
+++ b/Libraries/LibWebView/WebUI/SupportUI.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWebView/WebUI.h>
+
+namespace WebView {
+
+// about:support, which shows what the system probe found and what each platform feature was decided to be.
+class SupportUI final : public WebUI {
+ WEB_UI(SupportUI);
+
+public:
+ virtual ~SupportUI() override;
+
+ // Tells every open page to show the decisions anew.
+ static void platform_features_changed();
+
+private:
+ virtual void register_interfaces() override;
+
+ void load_platform_features();
+};
+
+}
diff --git a/Tests/LibWebView/TestOmnibox.cpp b/Tests/LibWebView/TestOmnibox.cpp
index 9c95b6fcafa..b0caeac67a9 100644
--- a/Tests/LibWebView/TestOmnibox.cpp
+++ b/Tests/LibWebView/TestOmnibox.cpp
@@ -317,6 +317,7 @@ TEST_CASE(all_web_ui_pages_are_suggested)
"about:crashes"sv,
"about:newtab"sv,
"about:settings"sv,
+ "about:support"sv,
"about:welcome"sv,
};
diff --git a/UI/cmake/ResourceFiles.cmake b/UI/cmake/ResourceFiles.cmake
index 77df25d06ce..a653b1b995f 100644
--- a/UI/cmake/ResourceFiles.cmake
+++ b/UI/cmake/ResourceFiles.cmake
@@ -43,6 +43,7 @@ set(ABOUT_PAGES
history.html
newtab.html
settings.html
+ support.html
version.html
webui.css
welcome.css