Revoke object URLs in two error cases
This commit is contained in:
parent
1ee47735d9
commit
c4551ca7ca
2 changed files with 17 additions and 3 deletions
|
@ -1805,7 +1805,6 @@ Whisper.ConversationView = Whisper.View.extend({
|
|||
return new Promise((resolve, reject) => {
|
||||
const url = URL.createObjectURL(file);
|
||||
const img = document.createElement('img');
|
||||
img.onerror = reject;
|
||||
img.onload = () => {
|
||||
URL.revokeObjectURL(url);
|
||||
|
||||
|
@ -1863,6 +1862,16 @@ Whisper.ConversationView = Whisper.View.extend({
|
|||
file: blob,
|
||||
});
|
||||
};
|
||||
img.onerror = (
|
||||
_event: unknown,
|
||||
_source: unknown,
|
||||
_lineno: unknown,
|
||||
_colno: unknown,
|
||||
error: Error = new Error('Failed to load image for auto-scaling')
|
||||
) => {
|
||||
URL.revokeObjectURL(url);
|
||||
reject(error);
|
||||
};
|
||||
img.src = url;
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue