Parcourir la source

always pass `cache`and `referrerPolicy` options to `fetch`

Gildas il y a 1 an
Parent
commit
dddab9ed0f
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      src/lib/single-file/fetch/content/content-fetch.js

+ 5 - 1
src/lib/single-file/fetch/content/content-fetch.js

@@ -30,7 +30,11 @@ const FETCH_RESPONSE_EVENT = "single-file-response-fetch";
 const ERR_HOST_FETCH = "Host fetch error (SingleFile)";
 const USE_HOST_FETCH = Boolean(window.wrappedJSObject);
 
-const fetch = (url, options) => window.fetch(url, options);
+const fetch = (url, options) => {
+	options.cache = "force-cache";
+	options.referrerPolicy = "strict-origin-when-cross-origin";
+	window.fetch(url, options);
+};
 
 let requestId = 0, pendingResponses = new Map(), hostFetchSupported;