Browse Source

make compatible with Firefox 78 (fix #1258)

Gildas 2 năm trước cách đây
mục cha
commit
ed862dc8aa

+ 1 - 0
manifest.json

@@ -30,6 +30,7 @@
 			],
 			"run_at": "document_start",
 			"js": [
+				"lib/web-stream.js",
 				"lib/chrome-browser-polyfill.js",
 				"lib/single-file-bootstrap.js",
 				"lib/single-file-extension-bootstrap.js",

+ 7 - 0
rollup.config.dev.js

@@ -161,4 +161,11 @@ export default [{
 		format: "iife",
 		plugins: []
 	}]
+}, {
+	input: ["src/lib/web-stream/index.js"],
+	output: [{
+		file: "lib/web-stream.js",
+		format: "iife",
+		plugins: []
+	}]
 }];

+ 7 - 0
rollup.config.js

@@ -161,4 +161,11 @@ export default [{
 		format: "iife",
 		plugins: [terser()]
 	}]
+}, {
+	input: ["src/lib/web-stream/index.js"],
+	output: [{
+		file: "lib/web-stream.js",
+		format: "iife",
+		plugins: [terser()]
+	}]
 }];

+ 1 - 0
src/core/bg/background.html

@@ -7,6 +7,7 @@
 </head>
 
 <body>
+	<script src="/lib/web-stream.js"></script>
 	<script src="/lib/chrome-browser-polyfill.js"></script>
 	<script src="/lib/single-file-extension-background.js"></script>
 	<script src="/lib/single-file.js"></script>

+ 1 - 0
src/lib/single-file/core/bg/scripts.js

@@ -26,6 +26,7 @@
 let contentScript, frameScript;
 
 const contentScriptFiles = [
+	"lib/web-stream.js",
 	"lib/chrome-browser-polyfill.js",
 	"lib/single-file.js"
 ];

+ 31 - 0
src/lib/web-stream/index.js

@@ -0,0 +1,31 @@
+/*
+ * Copyright 2010-2020 Gildas Lormeau
+ * contact : gildas.lormeau <at> gmail.com
+ * 
+ * This file is part of SingleFile.
+ *
+ *   The code in this file is free software: you can redistribute it and/or 
+ *   modify it under the terms of the GNU Affero General Public License 
+ *   (GNU AGPL) as published by the Free Software Foundation, either version 3
+ *   of the License, or (at your option) any later version.
+ * 
+ *   The code in this file is distributed in the hope that it will be useful, 
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of 
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero 
+ *   General Public License for more details.
+ *
+ *   As additional permission under GNU AGPL version 3 section 7, you may 
+ *   distribute UNMODIFIED VERSIONS OF THIS file without the copy of the GNU 
+ *   AGPL normally required by section 4, provided you include this license 
+ *   notice and a URL through which recipients can access the Corresponding 
+ *   Source.
+ */
+
+/* global globalThis */
+
+if (typeof globalThis.TransformStream === "undefined") {
+	globalThis.TransformStream = class TransformStream { };
+}
+if (typeof globalThis.WritableStream === "undefined") {
+	globalThis.WritableStream = class WritableStream { };
+}