Skip to content

[pull] master from mozilla:master#260

Merged
pull[bot] merged 6 commits intocode:masterfrom
mozilla:master
Mar 12, 2026
Merged

[pull] master from mozilla:master#260
pull[bot] merged 6 commits intocode:masterfrom
mozilla:master

Conversation

@pull
Copy link

@pull pull bot commented Mar 12, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

Snuffleupagus and others added 6 commits March 11, 2026 12:28
The `PagesMapper` class currently makes up one third of the `src/display/display_utils.js` file size, and since its introduction it's grown (a fair bit) in size.
Note that the intention with files such as `src/display/display_utils.js` was to have somewhere to place functionality too small/simple to deserve its own file.
…-up)

In PR 20016 the actual uses of the `enableHWA` option was removed from the viewer, but for some reason it's still being provided when initializing `PDFViewer` and `PDFThumbnailViewer` despite the fact that it's now dead code.
…data as intended (PR 20197 follow-up)

The purpose of PR 11844 was to reduce memory usage once fonts have been attached to the DOM, since the font-data can be quite large in many cases.

Unfortunately the new `clearData` method added in PR 20197 doesn't actually remove *anything*, it just replaces the font-data with zeros which doesn't help when the underlying `ArrayBuffer` itself isn't modified.
The method does include a commented-out `resize` call[1], but uncommenting that just breaks rendering completely.

To address this regression, without having to make large or possibly complex changes, this patch simply changes the `clearData` method to replace the internal buffer/view with its contents *before* the font-data.
While this does lead to a data copy, the size of this data is usually orders of magnitude smaller than the font-data that we're removing.

---

[1] Slightly off-topic, but I don't think that patches should include commented-out code since there's a very real risk that those things never get found/fixed.
At the very least such cases should be clearly marked with `// TODO: ...` comments, and should possibly also have an issue filed about fixing the TODO.
Move the `PagesMapper` class into its own file
Fix the `FontInfo.prototype.clearData` method to actually remove the data as intended (PR 20197 follow-up)
Remove the `enableHWA` option from viewer components (PR 20016 follow-up)
@pull pull bot locked and limited conversation to collaborators Mar 12, 2026
@pull pull bot added the ⤵️ pull label Mar 12, 2026
@pull pull bot merged commit d8a40d9 into code:master Mar 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants