1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 04:03:29 +00:00

Only clear web request after all notification types are attempted. Colocate remov

able types alongside the method concerned with them.
This commit is contained in:
Miles Blackwood
2025-06-03 18:21:41 -04:00
parent 6cb3eef26f
commit 4e18faaba0
2 changed files with 13 additions and 10 deletions

View File

@@ -434,9 +434,7 @@ export class OverlayNotificationsBackground implements OverlayNotificationsBackg
},
{ tab },
);
if (success) {
this.clearCompletedWebRequest(requestId, tab);
} else {
if (!success) {
result = "Unqualified changedPassword notification attempt.";
}
}
@@ -453,9 +451,7 @@ export class OverlayNotificationsBackground implements OverlayNotificationsBackg
},
{ tab },
);
if (success) {
this.clearCompletedWebRequest(requestId, tab);
} else {
if (!success) {
result = "Unqualified addLogin notification attempt.";
}
}
@@ -486,12 +482,12 @@ export class OverlayNotificationsBackground implements OverlayNotificationsBackg
},
{ tab },
);
this.clearCompletedWebRequest(requestId, tab);
} else {
result = "Unqualified atRiskPassword notification attempt.";
}
}
}
this.clearCompletedWebRequest(requestId, tab);
return result;
};

View File

@@ -5,6 +5,7 @@ import { EVENTS } from "@bitwarden/common/autofill/constants";
import {
NotificationBarIframeInitData,
NotificationType,
NotificationTypes,
} from "../../../notification/abstractions/notification-bar";
import { sendExtensionMessage, setElementStyles } from "../../../utils";
import {
@@ -18,8 +19,7 @@ export class OverlayNotificationsContentService
{
private notificationBarElement: HTMLElement | null = null;
private notificationBarIframeElement: HTMLIFrameElement | null = null;
private currentNotificationBarType: string | null = null;
private removeTabFromNotificationQueueTypes = new Set(["add", "change"]);
private currentNotificationBarType: NotificationType | null = null;
private notificationRefreshFlag: boolean = false;
private notificationBarElementStyles: Partial<CSSStyleDeclaration> = {
height: "82px",
@@ -296,9 +296,16 @@ export class OverlayNotificationsContentService
this.notificationBarElement.remove();
this.notificationBarElement = null;
// Exclude Unlock
const removableNotificationTypes = [
NotificationTypes.Add,
NotificationTypes.Change,
NotificationTypes.AtRiskPassword,
];
if (
closedByUserAction &&
this.removeTabFromNotificationQueueTypes.has(this.currentNotificationBarType)
removableNotificationTypes.some((nt) => nt === this.currentNotificationBarType)
) {
void sendExtensionMessage("bgRemoveTabFromNotificationQueue");
}