Просмотр исходного кода

revoke Blob URI after the download

Gildas 7 лет назад
Родитель
Сommit
1cbfb23892
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      extension/core/content/content.js

+ 5 - 0
extension/core/content/content.js

@@ -39,6 +39,7 @@
 			try {
 				const page = await processMessage(message);
 				downloadPage(page);
+				revokeDownloadURL(page);
 			} catch (error) {
 				browser.runtime.sendMessage({ processError: true, error });
 			}
@@ -83,6 +84,10 @@
 		return page;
 	}
 
+	function revokeDownloadURL(page) {
+		URL.revokeObjectURL(page.url);
+	}
+
 	function fixInlineScripts() {
 		document.querySelectorAll("script").forEach(element => element.textContent = element.textContent.replace(/<\/script>/gi, "<\\/script>"));
 	}