Skip to content

Commit

Permalink
Add Back Safari Only Handling of Process Reload (#11115)
Browse files Browse the repository at this point in the history
  • Loading branch information
justindbaur authored Sep 17, 2024
1 parent 99ba567 commit e8979de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/browser/src/background/main.background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,14 @@ export default class MainBackground {

const systemUtilsServiceReloadCallback = async () => {
await this.taskSchedulerService.clearAllScheduledTasks();
if (this.platformUtilsService.isSafari()) {
// If we do `chrome.runtime.reload` on safari they will send an onInstalled reason of install
// and that prompts us to show a new tab, this apparently doesn't happen on sideloaded
// extensions and only shows itself production scenarios. See: https://bitwarden.atlassian.net/browse/PM-12298
self.location.reload();
return;
}

BrowserApi.reloadExtension();
};

Expand Down
6 changes: 6 additions & 0 deletions apps/browser/src/popup/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ export class AppComponent implements OnInit, OnDestroy {
this.showNativeMessagingFingerprintDialog(msg);
} else if (msg.command === "showToast") {
this.toastService._showToast(msg);
} else if (msg.command === "reloadProcess") {
if (this.platformUtilsService.isSafari()) {
window.setTimeout(() => {
window.location.reload();
}, 2000);
}
} else if (msg.command === "reloadPopup") {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down

0 comments on commit e8979de

Please sign in to comment.