|
|
@@ -58,6 +58,7 @@ this.singlefile.lib.modules.fontsAltMinifier = this.singlefile.lib.modules.fonts
|
|
|
"extra-expanded": "150%",
|
|
|
"ultra-expanded": "200%"
|
|
|
};
|
|
|
+ const FONT_MAX_LOAD_DELAY = 5000;
|
|
|
|
|
|
return {
|
|
|
process: async (doc, stylesheets, fontURLs) => {
|
|
|
@@ -219,9 +220,9 @@ this.singlefile.lib.modules.fontsAltMinifier = this.singlefile.lib.modules.fonts
|
|
|
const fontURL = fontURLs.get(srcDeclaration.data);
|
|
|
const fontFace = new FontFace("test-font", "url(" + fontURL + ")");
|
|
|
try {
|
|
|
- await fontFace.load();
|
|
|
- await fontFace.loaded;
|
|
|
- source.valid = true;
|
|
|
+ await Promise.race(
|
|
|
+ [fontFace.load().then(() => fontFace.loaded).then(() => source.valid = true),
|
|
|
+ new Promise(resolve => setTimeout(resolve, FONT_MAX_LOAD_DELAY))]);
|
|
|
} catch (error) {
|
|
|
// ignored
|
|
|
}
|