[PM-7687] Fix `reloadPopup` Recursion (#8902)

* Fix Message Sending Recursion

* Remove Change That Didn't Help

* Prefer `isExternalMessage` Guard

* Rollback Compare Change

---------

Co-authored-by: Cesar Gonzalez <cesar.a.gonzalezcs@gmail.com>
This commit is contained in:
Justin Baur 2024-04-24 16:54:16 -04:00 committed by GitHub
parent 3f4adff2c5
commit a6755f5f20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 5 deletions

View File

@ -10,7 +10,7 @@ import { SystemService } from "@bitwarden/common/platform/abstractions/system.se
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { CipherType } from "@bitwarden/common/vault/enums";
import { MessageListener } from "../../../../libs/common/src/platform/messaging";
import { MessageListener, isExternalMessage } from "../../../../libs/common/src/platform/messaging";
import {
closeUnlockPopout,
openSsoAuthResultPopout,
@ -266,7 +266,9 @@ export default class RuntimeBackground {
break;
}
case "reloadPopup":
this.messagingService.send("reloadPopup");
if (isExternalMessage(msg)) {
this.messagingService.send("reloadPopup");
}
break;
case "emailVerificationRequired":
this.messagingService.send("showDialog", {

View File

@ -92,9 +92,16 @@ export class LocalBackedSessionStorageService
// This is for observation purposes only. At some point, we don't want to write to local session storage if the value is the same.
if (this.platformUtilsService.isDev()) {
const existingValue = this.cache[key] as T;
if (this.compareValues<T>(existingValue, obj)) {
this.logService.warning(`Possible unnecessary write to local session storage. Key: ${key}`);
this.logService.warning(obj as any);
try {
if (this.compareValues<T>(existingValue, obj)) {
this.logService.warning(
`Possible unnecessary write to local session storage. Key: ${key}`,
);
this.logService.warning(obj as any);
}
} catch (err) {
this.logService.warning(`Error while comparing values for key: ${key}`);
this.logService.warning(err);
}
}