mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Revoke object URLs in two error cases
This commit is contained in:
@@ -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;
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user