mirror of
https://github.com/bitwarden/browser
synced 2026-02-12 06:23:38 +00:00
Add Close Window Logging
This commit is contained in:
@@ -23,6 +23,8 @@ async function openUnlockPopout(senderTab: chrome.tabs.Tab, skipNotification = f
|
||||
const existingPopoutWindowTabs = await BrowserApi.tabsQuery({ windowType: "popup" });
|
||||
existingPopoutWindowTabs.forEach((tab) => {
|
||||
if (extensionUnlockUrls.has(tab.url)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Removing window in openUnlockPopout`, senderTab.url, tab.url, tab.windowId);
|
||||
// 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
|
||||
BrowserApi.removeWindow(tab.windowId);
|
||||
|
||||
@@ -237,6 +237,8 @@ export default class RuntimeBackground {
|
||||
|
||||
if (this.lockedVaultPendingNotifications?.length > 0) {
|
||||
item = this.lockedVaultPendingNotifications.pop();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("closing unlock popout after logging in.");
|
||||
await closeUnlockPopout();
|
||||
}
|
||||
|
||||
|
||||
@@ -430,6 +430,8 @@ export class BrowserApi {
|
||||
}
|
||||
|
||||
static closePopup(win: Window) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("closePopup", win.location.href);
|
||||
if (BrowserApi.isWebExtensionsApi && BrowserApi.isFirefoxOnAndroid) {
|
||||
// Reactivating the active tab dismisses the popup tab. The promise final
|
||||
// condition is only called if the popup wasn't already dismissed (future proofing).
|
||||
|
||||
@@ -173,6 +173,9 @@ class BrowserPopupUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`closeSingleActionPopout`, popoutKey, tab.url, tab.windowId);
|
||||
|
||||
setTimeout(() => BrowserApi.removeWindow(tab.windowId), delayClose);
|
||||
}
|
||||
}
|
||||
@@ -196,6 +199,8 @@ class BrowserPopupUtils {
|
||||
await BrowserPopupUtils.openPopout(`${parsedUrl.pathname}${hashRoute}`);
|
||||
|
||||
if (BrowserPopupUtils.inPopup(win)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Closing popup since we are in a popup '${win.location.href}' '${href}'`);
|
||||
BrowserApi.closePopup(win);
|
||||
}
|
||||
}
|
||||
@@ -238,7 +243,15 @@ class BrowserPopupUtils {
|
||||
});
|
||||
}
|
||||
|
||||
popoutTabs.forEach((tab) => BrowserApi.removeWindow(tab.windowId));
|
||||
popoutTabs.forEach((tab) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
"Closing popout tab while checking if isSingleActionPopoutOpen",
|
||||
tab.url,
|
||||
tab.windowId,
|
||||
);
|
||||
return BrowserApi.removeWindow(tab.windowId);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -320,6 +320,8 @@ export class VaultListItemsContainerComponent implements OnInit, AfterViewInit {
|
||||
await BrowserApi.createNewTab(cipher.login.launchUri);
|
||||
|
||||
if (BrowserPopupUtils.inPopup(window)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("launchCipher", window.location.href);
|
||||
BrowserApi.closePopup(window);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +279,8 @@ export class VaultPopupAutofillService {
|
||||
});
|
||||
setTimeout(async () => {
|
||||
await BrowserApi.focusTab(tab.id);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("Closing popout after delay.");
|
||||
await closeViewVaultItemPopout(`${VaultPopoutType.viewVaultItem}_${cipher.id}`);
|
||||
}, 1000);
|
||||
|
||||
@@ -290,11 +292,15 @@ export class VaultPopupAutofillService {
|
||||
}
|
||||
|
||||
if (this.platformUtilService.isFirefox() || this.platformUtilService.isSafari()) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Closing popup because firefox/safari ${window.location.href}.`);
|
||||
BrowserApi.closePopup(window);
|
||||
return;
|
||||
}
|
||||
|
||||
// Slight delay to fix bug in Chromium browsers where popup closes without copying totp to clipboard
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Closing poup after slight delay for Chromium ${window.location.href}.`);
|
||||
setTimeout(() => BrowserApi.closePopup(window), 50);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,8 @@ async function openFido2Popout(
|
||||
* @param sessionId - The session ID of the popout to close.
|
||||
*/
|
||||
async function closeFido2Popout(sessionId: string): Promise<void> {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Closing Fido2 popout '${sessionId}'`);
|
||||
await BrowserPopupUtils.closeSingleActionPopout(`${VaultPopoutType.fido2Popout}_${sessionId}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user