opensanctions / opensanctions/unmhtml

Fonts missing from Chromium MHTML saves (known Chromium bug)

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Problem

When saving pages as MHTML using Chromium (including via Playwright or CDP's Page.captureSnapshot), web fonts are frequently missing from the archive. The @font-face declarations in CSS reference font files by URL path, but the actual font binaries are not included as MIME parts.

Root cause

This is a known, long-standing Chromium bug: chromium issue 40219015

Chromium's FrameSerializer has code to embed fonts (AddFontToResources()), but it checks font.IsLoaded() and font.ResourceBuffer() at save time. If a font was lazily loaded or has been evicted from the resource cache, it is silently skipped. There is no Chrome flag or setting to control this behavior.

Workarounds

  • Ensuring all fonts are fully loaded before saving (e.g., using document.fonts.ready in Playwright) may improve results, but is not guaranteed.
  • SingleFile (browser extension) actively fetches and embeds all resources including fonts, but is not usable in headless/Playwright workflows.

References

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository file, test, or entry point. Start by reviewing Chromium issue 40219015 and reproducing an MHTML save with a web font; done would require a confirmed project-level workaround or an upstream Chromium fix.

Written by the indexing model from the issue text.

Assessment

Domain
web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.