[PM-7747] add timeout to safari sendMessageWithResponse (#9082)

* add timeout to safari sendMessageWithResponse

* change to query views instead of sending message
This commit is contained in:
Jake Fink 2024-05-09 10:54:05 -04:00 committed by GitHub
parent da144410e8
commit c69cc37716
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -163,6 +163,10 @@ export abstract class BrowserPlatformUtilsService implements PlatformUtilsServic
* the view is open.
*/
async isViewOpen(): Promise<boolean> {
if (this.isSafari()) {
// Query views on safari since chrome.runtime.sendMessage does not timeout and will hang.
return BrowserApi.isPopupOpen();
}
return Boolean(await BrowserApi.sendMessageWithResponse("checkVaultPopupHeartbeat"));
}