소스 검색

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