mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-26 22:01:32 +01:00
[PM-5189] Add a fallback for image assets that do not load correctly
This commit is contained in:
parent
7994e6072a
commit
828e187dc4
@ -79,6 +79,8 @@ export class AutofillOverlayInlineMenuElements implements InlineMenuElementsInte
|
||||
* longer triggers.
|
||||
*/
|
||||
private removeInlineMenu = (message?: AutofillExtensionMessage) => {
|
||||
return;
|
||||
|
||||
if (message?.overlayElement === AutofillOverlayElement.Button) {
|
||||
this.removeInlineMenuButton();
|
||||
return;
|
||||
|
@ -397,6 +397,15 @@ class AutofillOverlayList extends AutofillOverlayPageElement {
|
||||
try {
|
||||
const url = new URL(cipher.icon.image);
|
||||
cipherIcon.style.backgroundImage = `url(${url.href})`;
|
||||
|
||||
const dummyImageElement = globalThis.document.createElement("img");
|
||||
dummyImageElement.src = url.href;
|
||||
dummyImageElement.addEventListener("error", () => {
|
||||
cipherIcon.style.backgroundImage = "";
|
||||
cipherIcon.classList.add("cipher-icon", "bwi", cipher.icon.icon);
|
||||
});
|
||||
dummyImageElement.remove();
|
||||
|
||||
return cipherIcon;
|
||||
} catch {
|
||||
// Silently default to the globe icon element if the image URL is invalid
|
||||
|
Loading…
Reference in New Issue
Block a user