Browse Source

use globalThis instead of window (fix #1326)

Gildas 2 năm trước cách đây
mục cha
commit
e5fa808421
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      src/core/content/content-bootstrap.js

+ 3 - 3
src/core/content/content-bootstrap.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, globalThis, window, document, location, setTimeout, XMLHttpRequest, Node, DOMParser */
+/* global browser, globalThis, document, location, setTimeout, XMLHttpRequest, Node, DOMParser */
 
 const MAX_CONTENT_SIZE = 32 * (1024 * 1024);
 
@@ -217,7 +217,7 @@ async function autoSavePage() {
 			await new Promise(resolve => autoSaveTimeout = setTimeout(resolve, optionsAutoSave.autoSaveDelay * 1000));
 			await autoSavePage();
 		} else {
-			const waitForUserScript = window[helper.WAIT_FOR_USERSCRIPT_PROPERTY_NAME];
+			const waitForUserScript = globalThis[helper.WAIT_FOR_USERSCRIPT_PROPERTY_NAME];
 			let frames = [];
 			let framesSessionId;
 			autoSaveTimeout = null;
@@ -271,7 +271,7 @@ function onUnload() {
 
 function autoSaveUnloadedPage({ autoSaveUnload, autoSaveDiscard, autoSaveRemove }) {
 	const helper = singlefile.helper;
-	const waitForUserScript = window[helper.WAIT_FOR_USERSCRIPT_PROPERTY_NAME];
+	const waitForUserScript = globalThis[helper.WAIT_FOR_USERSCRIPT_PROPERTY_NAME];
 	let frames = [];
 	if (!optionsAutoSave.removeFrames && globalThis.frames && globalThis.frames.length) {
 		frames = singlefile.processors.frameTree.getSync(optionsAutoSave);