瀏覽代碼

fix retrieva of fonts loaded with FontFace

Gildas 5 年之前
父節點
當前提交
6138606aed
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      lib/single-file/processors/hooks/content/content-hooks-frames.js

+ 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) {