From 9ce2427e79cdcb070eab5aff5abe8fb34fd96961 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 26 Sep 2022 15:18:22 +0200 Subject: [PATCH] [Firefox viewer] Skip some unnecessary code in the `FontLoader.bind` method Given that Firefox supports *synchronous* font loading, when the Font Loading API isn't being used, there's really no point including code which if called would just throw in the MOZCENTRAL build. (This is safe, since the `FontLoader.isSyncFontLoadingSupported`-getter always return `true` there.) --- src/display/font_loader.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/display/font_loader.js b/src/display/font_loader.js index 84449e077..185e42585 100644 --- a/src/display/font_loader.js +++ b/src/display/font_loader.js @@ -112,6 +112,9 @@ class FontLoader { if (this.isSyncFontLoadingSupported) { return; // The font was, synchronously, loaded. } + if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { + throw new Error("Not implemented: async font loading"); + } await new Promise(resolve => { const request = this._queueLoadingCallback(resolve); this._prepareFontLoadEvent(font, request);