mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Add some extra guards around image loading
This commit is contained in:
parent
fa3150fef0
commit
7a4880a6bd
|
@ -279,6 +279,9 @@
|
|||
image.classList.add('scale-to-fit');
|
||||
|
||||
image.addEventListener('load', () => {
|
||||
if (hasLoadedImage) {
|
||||
return;
|
||||
}
|
||||
hasLoadedImage = true;
|
||||
|
||||
vscode.postMessage({
|
||||
|
@ -297,7 +300,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
image.addEventListener('error', () => {
|
||||
image.addEventListener('error', e => {
|
||||
if (hasLoadedImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
hasLoadedImage = true;
|
||||
document.body.classList.add('error');
|
||||
document.body.classList.remove('loading');
|
||||
|
|
Loading…
Reference in a new issue