Gildas 2 лет назад
Родитель
Сommit
5eb146f32d
2 измененных файлов с 10 добавлено и 6 удалено
  1. 6 4
      lib/single-file-extension-editor.js
  2. 4 2
      src/ui/content/content-ui-editor-web.js

+ 6 - 4
lib/single-file-extension-editor.js

@@ -1,7 +1,7 @@
 (function () {
 	'use strict';
 
-	const { Array: Array$1, Object: Object$1, String, Number: Number$1, BigInt, Math: Math$1, Date, Map, Set: Set$1, Response, URL: URL$1, Error, Uint8Array: Uint8Array$1, Uint16Array, Uint32Array, DataView, Blob: Blob$1, Promise: Promise$1, TextEncoder, TextDecoder: TextDecoder$1, document: document$1, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker: Worker$1 } = globalThis;
+	const { Array: Array$1, Object: Object$1, String, Number: Number$1, BigInt, Math: Math$1, Date, Map, Set: Set$1, Response, URL: URL$1, Error, Uint8Array: Uint8Array$1, Uint16Array, Uint32Array, DataView, Blob: Blob$1, Promise: Promise$1, TextEncoder, TextDecoder: TextDecoder$1, document: document$1, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator: navigator$1, Worker: Worker$1 } = globalThis;
 
 	/*
 	 Copyright (c) 2022 Gildas Lormeau. All rights reserved.
@@ -158,8 +158,8 @@
 	const MINIMUM_CHUNK_SIZE = 64;
 	let maxWorkers = 2;
 	try {
-		if (typeof navigator != UNDEFINED_TYPE$1 && navigator.hardwareConcurrency) {
-			maxWorkers = navigator.hardwareConcurrency;
+		if (typeof navigator$1 != UNDEFINED_TYPE$1 && navigator$1.hardwareConcurrency) {
+			maxWorkers = navigator$1.hardwareConcurrency;
 		}
 	} catch (_error) {
 		// ignored
@@ -5249,6 +5249,8 @@
 
 	(globalThis => {
 
+		const IS_NOT_SAFARI = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent) || /Vivaldi/.test(navigator.userAgent) || /OPR/.test(navigator.userAgent);
+
 		const singlefile = globalThis.singlefile;
 
 		const FORBIDDEN_TAG_NAMES = ["a", "area", "audio", "base", "br", "col", "command", "embed", "hr", "img", "iframe", "input", "keygen", "link", "meta", "param", "source", "track", "video", "wbr"];
@@ -6357,7 +6359,7 @@ pre code {
 				} catch (error) {
 					delete zipOptions.workerScripts;
 				}
-				zipOptions.useWebWorkers = false;
+				zipOptions.useWebWorkers = IS_NOT_SAFARI;
 				const { docContent, origDocContent, resources, url } = await extract(content, {
 					password,
 					prompt,

+ 4 - 2
src/ui/content/content-ui-editor-web.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global globalThis, window, document, fetch, DOMParser, getComputedStyle, setTimeout, clearTimeout, NodeFilter, Readability, isProbablyReaderable, matchMedia, TextDecoder, Node, URL, MouseEvent, Blob, prompt, MutationObserver, FileReader, Worker */
+/* global globalThis, window, document, fetch, DOMParser, getComputedStyle, setTimeout, clearTimeout, NodeFilter, Readability, isProbablyReaderable, matchMedia, TextDecoder, Node, URL, MouseEvent, Blob, prompt, MutationObserver, FileReader, Worker, navigator */
 
 import * as zip from "single-file-core/vendor/zip/zip.js";
 import { extract } from "single-file-core/processors/compression/compression-extract.js";
@@ -29,6 +29,8 @@ import { display } from "single-file-core/processors/compression/compression-dis
 
 (globalThis => {
 
+	const IS_NOT_SAFARI = !/Safari/.test(navigator.userAgent) || /Chrome/.test(navigator.userAgent) || /Vivaldi/.test(navigator.userAgent) || /OPR/.test(navigator.userAgent);
+
 	const singlefile = globalThis.singlefile;
 
 	const FORBIDDEN_TAG_NAMES = ["a", "area", "audio", "base", "br", "col", "command", "embed", "hr", "img", "iframe", "input", "keygen", "link", "meta", "param", "source", "track", "video", "wbr"];
@@ -1137,7 +1139,7 @@ pre code {
 			} catch (error) {
 				delete zipOptions.workerScripts;
 			}
-			zipOptions.useWebWorkers = false;
+			zipOptions.useWebWorkers = IS_NOT_SAFARI;
 			const { docContent, origDocContent, resources, url } = await extract(content, {
 				password,
 				prompt,