Răsfoiți Sursa

fix retrieva of fonts loaded with FontFace

Gildas 5 ani în urmă
părinte
comite
6138606aed

+ 7 - 2
lib/single-file/processors/hooks/content/content-hooks-frames.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global globalThis */
+/* global globalThis, window */
 
 const LOAD_DEFERRED_IMAGES_START_EVENT = "single-file-load-deferred-images-start";
 const LOAD_DEFERRED_IMAGES_END_EVENT = "single-file-load-deferred-images-end";
@@ -46,7 +46,12 @@ const HTMLDocument = globalThis.HTMLDocument;
 const FileReader = globalThis.FileReader;
 const Blob = globalThis.Blob;
 
-const fontFaces = [];
+let fontFaces;
+if (window._singleFile_fontFaces) {
+	fontFaces = window._singleFile_fontFaces;
+} else {
+	fontFaces = window._singleFile_fontFaces = [];
+}
 
 if (document instanceof HTMLDocument) {
 	if (browser && browser.runtime && browser.runtime.getURL) {