Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Mozilla Hacks 12 min read Deep dive mediumAdept

Implementing form filling and accessibility in the Firefox PDF viewer

Firefox's PDF.js viewer gained AcroForm filling, embedded-JavaScript execution, XFA form rendering and tagged-PDF accessibility. Filled AcroForm values are held in an annotationStorage object and turned into PDF appearance streams so saving and printing share one code path. PDF JavaScript runs in a null-principal ComponentUtils.Sandbox in Firefox and in a WebAssembly build of QuickJS on the web, with I/O APIs deliberately left out. XFA required a custom layout engine plus shipped Liberation fonts with rescaled glyph widths, tagged PDFs are exposed to screen readers through ARIA nodes and aria-owns links into the text layer, and regressions are caught with reftests over a crawled corpus of tens of thousands of PDFs.

Assumes: HTML DOM and canvasWeb workersARIA basics

Related posts

  • Experimenting with local alt text generation in Firefox Nightly

    Mozilla Hacks mediumAdept

    Firefox 130 adds experimental on-device alt text generation for images in the built-in PDF editor, using a 182M-parameter ViT image encoder paired with DistilGPT-2, fine-tuned on COCO, quantized to under 200MB and running in a few seconds on a laptop CPU. The inference stack reuses the Firefox Translations architecture: the ONNX runtime compiled to WASM runs in a separate process, Transformers.js is vendored with Node pieces and eval() calls removed, and a custom cache serves models from Mozilla's servers into IndexedDB instead of Hugging Face. Small local models trade some accuracy against GPT-4o for privacy, lower resource use and quick retraining. The longer-term goal is to offer generated alt text during general browsing for screen reader users.

  • WebKit Features in Safari 16.0

    WebKit easyNovice

    Safari 16.0 ships AVIF images on iOS, passkeys built on WebAuthn, CSS Container Queries (size queries and cq* units), Subgrid, Offset Path animation, overscroll-behavior, Shared Workers, and Web Inspector Extensions, plus a new Flexbox Inspector. A re-architected macOS accessibility layer (Isolated Tree Mode) moves work off the main thread, serving twice as many requests in 25% less time on complex pages. Sites adopting passkeys should avoid tying sign-in to the device that saved the key and should enable conditional mediation for AutoFill. The release also includes many form, CSP and Web Inspector fixes.

  • In March, we see Firefox 87

    Mozilla Hacks mediumAdept

    Firefox 87 enables the beforeinput event and InputEvent.getTargetRanges() by default, letting web apps inspect and cancel text edits in inputs and contenteditable elements before the DOM changes, with an example that protects metadata spans inside an editable comment. DevTools gains prefers-color-scheme light/dark emulation and a :target pseudo-class toggle. The default Referrer-Policy becomes strict-origin-when-cross-origin, so paths and query strings are no longer sent cross-origin. SmartBlock substitutes bundled stand-ins for blocked tracking scripts so sites keep working, and VoiceOver screen reader support now ships on macOS.

  • Getting lively with Firefox 90

    Mozilla Hacks mediumAdept

    Firefox 90 enables JavaScript private class fields and methods by default, using a # prefix so properties can only be read or written inside the class body, and adds the relative-indexing at() method to Array, String and TypedArray, which accepts negative indexes to count from the end. The 2D Canvas API gains createConicGradient() for gradients swept around a center point, and Fetch metadata request headers (Sec-Fetch-Site, -Mode, -User, -Dest) are now sent by default so servers can decide whether to allow requests based on their origin context. Windows also gets Background Update, letting Firefox update while not running.

  • Intent to Ship: JPEG XL

    Mozilla Hacks easyNovice

    Firefox intends to ship JPEG XL support, built on jxl-rs, a Rust decoder written by Google Research in place of the earlier 100,000-line multithreaded C++ library to reduce attack surface. Chrome also plans to ship, so the format should work across browsers by year end. Firefox's implementation includes progressive rendering, which Safari's lacks, so the image becomes recognisable after only a few kB arrive. Size comparisons at matched SSIMULACRA 2 scores show AVIF smaller at web quality (116 kB vs 134 kB for a photo) while JPEG XL wins at lossless (1.45 MB vs 1.76 MB; 92 kB vs 164 kB for a screenshot), so developers should test on representative images.

The quest for software engineering knowledge.

Look:
Layout: