Installing a PWA fails if an SVG asset has sizes="any"

#40925759 Filed 2023-08-05 P3 / S5 Android · WebAPKs / WebAppInstalls

Install the reproducer

Open this on an Android device and install it (Chrome menu → "Install app" / "Add to Home screen"). The app's only icon is an SVG declared with sizes:"any" and no intrinsic width/height.

▶ Open test PWA manifest.webmanifest icon.svg

Expected vs actual

Expected

The WebAPK installs and lands on the home screen with the SVG rasterized as its icon.

Actual (Chrome 115, when filed)

Install failed and fell back to a bookmark shortcut. DevTools console showed failed to install webapk for: [manifest url]. Removing sizes:"any" made it installable again.

Root cause

An icon with sizes:"any" is a scalable SVG that usually has no intrinsic width/height (only a viewBox). On install the WebAPK flow re-downloads and rasterizes icons via WebContents::DownloadImage()blink::WebImage::DecodeSVG(data, desired_size). When desired_size was empty, a sizeless SVG rasterized to a 0×0 empty bitmap, so the icon had no data and the WebAPK request failed.

sizeless SVG + empty desired size   -> empty 0x0 bitmap   (install fails)
sizeless SVG + concrete size 48x48  -> valid 48x48 bitmap  (install works)

Status

Fixed

The Android WebAPK path now derives a concrete preferred size from each icon's usage (primary / splash / shortcut) before downloading, so SVG icons decode to a real bitmap.

Android fix: "Reland: Fix installing WebAPK with SVG icon" (crrev.com/c/4544539). Desktop equivalent (crbug/40911689): "[dPWA] Preprocess icon downloads to support SVGs" (crrev.com/c/5234019).

Links

Issue 40925759 Desktop dup 40911689