diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index 08f7d4d43..996df0c5a 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -703,7 +703,7 @@ vAPI.setIcon = (( ) => { const path = icons[i].path; for ( const key in path ) { if ( path.hasOwnProperty(key) === false ) { continue; } - imgs.push({ i: i, p: key }); + imgs.push({ i: i, p: key, cached: false }); } } @@ -724,6 +724,7 @@ vAPI.setIcon = (( ) => { const ctx = document.createElement('canvas').getContext('2d'); const iconData = [ null, null ]; for ( const img of imgs ) { + if ( img.cached ) { continue; } const w = img.r.naturalWidth, h = img.r.naturalHeight; ctx.width = w; ctx.height = h; ctx.clearRect(0, 0, w, h); @@ -741,6 +742,7 @@ vAPI.setIcon = (( ) => { return; } iconData[img.i][img.p] = imgData; + img.cached = true; } for ( let i = 0; i < iconData.length; i++ ) { if ( iconData[i] ) {