1
0
Эх сурвалжийг харах

don't override window.fetch

Gildas 7 жил өмнө
parent
commit
031ab4f516

+ 1 - 1
extension/core/scripts/content/fetch.js

@@ -20,7 +20,7 @@
 
 /* global window, chrome, Blob */
 
-window.fetch = (() => {
+window.superFetch = (() => {
 
 	return async (url, options) => {
 		const responseFetch = await chromeRuntimeSendMessage({ method: "fetch", url, options });

+ 2 - 2
lib/single-file/single-file-browser.js

@@ -18,7 +18,7 @@
  *   along with SingleFile.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* global fetch, document, btoa, DOMParser, getComputedStyle, FileReader, SingleFileCore */
+/* global SingleFileCore, btoa, DOMParser, getComputedStyle, FileReader, window, fetch */
 
 this.SingleFile = (() => {
 
@@ -37,7 +37,7 @@ this.SingleFile = (() => {
 			};
 			let resourceContent;
 			try {
-				resourceContent = await fetch(resourceURL, requestOptions);
+				resourceContent = await (window.superFetch || fetch)(resourceURL, requestOptions);
 			} catch (e) {
 				return asDataURI ? "data:base64," : "";
 			}