Selaa lähdekoodia

always remove the download listener and revoke Blob URI

Gildas 6 vuotta sitten
vanhempi
sitoutus
adae9ea9ad
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      extension/core/bg/download.js

+ 2 - 2
extension/core/bg/download.js

@@ -108,13 +108,13 @@ singlefile.download = (() => {
 						browser.downloads.onChanged.removeListener(onChanged);
 					}
 					if (event.state.current == "interrupted") {
+						URL.revokeObjectURL(page.url);
 						if (event.error && event.error.current == "USER_CANCELED") {
 							resolve({});
 						} else {
-							URL.revokeObjectURL(page.url);
 							reject(new Error(event.state.current));
-							browser.downloads.onChanged.removeListener(onChanged);
 						}
+						browser.downloads.onChanged.removeListener(onChanged);
 					}
 				}
 			}