GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(browser): show each site's icon in its tab by Hona · Pull Request #65094 · anomalyco/opencode Conversation
|
| Before | After |
|---|---|
![]() |
![]() |
No tab moves when its icon arrives (x and width before → after, in CSS px):
Made-up pages and icons. The four icons are .ico files (32-bit 16/32/48, 16 colours, 256 colours, bitmaps plus a 256 px PNG) taken through the real pipeline in Electron.
packages/gui-plugins/src/browser/icon.ts:55 decoded the fetched file with nativeImage.createFromBuffer, which reads PNG and JPEG only. An .ico file gave an empty image, so the tab reported no icon.| Site | Icon file (plain curl, no cookies) |
Bytes | On dev |
|---|---|---|---|
| Google Flights | PNG, 96/128/192 px, three declared, on gstatic.com |
6,208–14,911 | icon |
| outlook.live.com | .ico, four 32-bit bitmaps, 16–32 px |
9,622 | globe |
| booking.jetstar.com | .ico, one 32-bit bitmap, 16 px |
1,150 | globe |
| booking.com | .ico, three 16-colour bitmaps, behind a redirect |
1,582 | globe |
| expedia.com.au | .ico, 32-bit bitmaps, 16/32/48 px |
15,086 | globe |
| hotels.com | .ico, five bitmaps and a 256 px PNG |
105,491 | globe |
dae4077a96), so it is older than feat(desktop): signed-in browser pane with extensions, previews, prompts and agent safeguards #63002 (cd0d037d68), which did not touch icon.ts. 2701a89260 did not change it: the saved tabs keep whatever main reports.dev: the stored limit (a 180 px PNG ends at 186 characters), the fetch (a PNG behind a redirect and one on another origin both load), Chromium's list (a page with no <link> lists /favicon.ico), and the strip (it draws any icon main reports).flowchart LR
A[page-favicon-updated<br>first 3 addresses] --> B[fetch: no cookies,<br>256 KB, 5 s, image/*]
B --> S{image/svg+xml?}
S -- yes, ≤ 24,576 chars --> F
S -- no --> C{iconImage<br>the bytes decide}
C -- PNG / JPEG --> E
C -- .ico --> D[best image:<br>PNG inside, or bitmap → PNG]
D --> E[nativeImage<br>≤ 32 px PNG]
C -- anything else --> G[next address,<br>else the globe]
E --> F[data URL → img in the strip,<br>saved tabs, history]
icon-image.ts reads an .ico file in main: the 32 px image, else the smallest larger one, else the largest; of two the same size, the one with more colours. A PNG inside is used as it is; a bitmap (1, 4, 8, 24 or 32 bits, with its mask) is rewritten as a PNG. nativeImage then reduces and encodes it as before.dev showed is lost: PNG, JPEG and SVG take the paths they took. An SVG is still reported as it is and drawn only through an <img>, never put in the window as markup.| Format | Tab draws |
|---|---|
.ico (bitmaps of any depth, or PNG inside) |
icon, new |
| PNG, JPEG, SVG up to 24,576 characters as a data URL | icon, as on dev |
| GIF, WebP, AVIF, a bare BMP, a longer SVG with no other icon listed | globe, as on dev |
image/* only, 256 KB and 5 s each (unchanged).dev.<img> drawn to a canvas) would cover GIF, WebP and AVIF too, and the facts allow it: in this Chromium (152) a canvas drawn from a data: SVG is not tainted, with foreignObject too, toDataURL works, and a script or onload inside the SVG does not run.icon-image.test.ts: each bitmap depth gives the pixels drawn, which image of a file is kept, and what is no image.electron-icon.test.ts (real Electron, six made-up sites): what only Electron decides, which is the icons Chromium lists, the fetch and what nativeImage decodes. A bitmap .ico, a 180 px PNG, an SVG-only site, /favicon.ico with no <link>, a JPEG on another origin behind a redirect, and a site with nothing to draw. On dev the two .ico sites report none.browser-pane-restore.spec.ts: a tab draws its icon in the globe's place and no tab's box changes; an SVG with a <script> and an onload is drawn as an img and runs neither. The strip was never the broken part, so this one passes on dev too.curl only; hertz.com.au answers curl with a bot page, so its file is unknown.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I found nothing blocking in the code. I couldn't check the fix end to end: Electron won't start in my sandbox (libnspr4.so is missing), so neither the base nor the real-Electron test could run. To check the new decoder on its own, I ran it on the repository's .ico files (packages/ui/.../favicon.ico, packages/app/public/favicon-v3.ico, packages/desktop/icons/*/icon.ico). The bitmap files came out as valid 32×32 PNGs, and the files that hold PNGs gave back the 32 px PNG inside. icon-image.test.ts passes and tsc -b is clean.
Public API: unchanged. The narrower icon check on PaneEvent is internal to the browser plugin, and only main sends it.
There's one comment on the size of the real-Electron test. Also, as the description says, sites that list only an SVG icon now show the globe where dev drew them, so it may be worth tracking that separately.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // returns, and which files `nativeImage` decodes, which is PNG and JPEG only. Most sites serve an `.ico` file, and | ||
| // those tabs drew the globe. This opens one tab for each kind of site in the pinned Electron, so an upgrade that | ||
| // changes any of the three fails here. | ||
| test( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This test and its fixture come to about 360 lines with icon-samples.ts, covering 20 made-up sites in real Electron. icon-image.test.ts already covers the bitmap depths, which image of a file is kept, and what is rejected. That leaves the Electron test with one job: checking that Electron's icon list, fetch and nativeImage still behave as assumed. Could you cut it to a few core cases, for example one bitmap .ico, one plain PNG, one SVG that gives no icon, and the /favicon.ico fallback? It would also be quicker to start and easier to follow when an Electron upgrade breaks it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cut to six sites that only real Electron can prove (a bitmap .ico, a 180 px PNG, an SVG-only site that shows its SVG, the /favicon.ico fallback, a JPEG on another origin behind a redirect, and one with nothing to draw), in a plain hidden window with no pane page: test and fixture go from 330 to 190 lines. The decoding cases that left (a single small image, a 150 px one, a bitmap beside a larger PNG, a PNG named .ico) are now in icon-image.test.ts beside the depths it already had.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The cut covers what I asked for. At pr/head (1bba4f5d8), the six sites each test something only Electron can prove:
ico: a bitmap .ico file.png: a 180 px PNG reduced to 32 px.svg: a site with only SVG icons.unlisted: a page with no <link>, so Chromium asks for /favicon.ico. It also checks that the longest possible PNG fits the 6,000 characters history and saved tabs keep.moved: a JPEG on another origin behind a redirect.refused: nothing to draw.The decoding cases that left the Electron test are now in icon-image.test.ts: the single small image and the 150 px one at lines 72–73, a PNG inside an .ico from line 83, and PNG/JPEG detection from line 98.
One subtlety, not a problem: the svg site declares b.svg then a.svg, but the test expects the list ["/svg/a.svg", "/svg/b.svg"]. So the "too long, then the next" path (the long a.svg refused, the short b.svg used) only gets tested because Chromium lists a page's icons in the reverse of the order they're declared. If that order ever changes, the listed assertion fails first, which makes the cause clear. A short comment at electron-icon.fixture.ts (links: ["b.svg", "a.svg"]) would save someone from puzzling over it.
What I ran: I tested pr/head in a temporary worktree, which I've since removed.
icon-image.test.ts: all 27 tests pass.electron-icon.test.ts: I couldn't run it here, because Electron 44.9.1 won't start in this container (libnspr4.so is missing). The six-site Electron run is still unverified on my side.Checkout: repo/ is at a detached 67b05671c with a bun.lock change I didn't make. I changed nothing there and left both as they were.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I found nothing new to raise. The latest commit brings back SVG icons as dev handled them: drawn only as an <img>, with PageIcon and the pane event accepting any data:image/ URL again. That removes the regression for SVG-only sites I mentioned last time. My earlier comment on the size of the real-Electron test still stands: it gained a site rather than being cut down. icon-image.test.ts passes and tsc -b is clean. I still can't run Electron in my sandbox (libnspr4.so is missing), so I couldn't check the fix end to end. Public API: unchanged.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
My earlier comment is addressed: the real-Electron test now checks six sites that only Electron can decide, and the format details are left to icon-image.test.ts. The new commits change only tests, and I have nothing further to raise. icon-image.test.ts passes (27/27) and tsc -b is clean. I still can't run Electron in my sandbox (libnspr4.so is missing), so I haven't seen the Electron test or the fix run end to end. Public API: unchanged.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.