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

Merge branch 'main' into km/tmp-ownership-2

This commit is contained in:
Bernd Schoolmann
2025-01-24 20:28:13 +01:00
committed by GitHub
5 changed files with 18 additions and 6 deletions

View File

@@ -280,10 +280,10 @@ describe("VaultPopupAutofillService", () => {
it("should close popup after a timeout for chromium browsers", async () => {
mockPlatformUtilsService.isFirefox.mockReturnValue(false);
jest.spyOn(global, "requestAnimationFrame");
jest.spyOn(global, "setTimeout");
await service.doAutofill(mockCipher);
jest.advanceTimersByTime(50);
expect(requestAnimationFrame).toHaveBeenCalled();
expect(setTimeout).toHaveBeenCalledTimes(1);
expect(BrowserApi.closePopup).toHaveBeenCalled();
});

View File

@@ -280,7 +280,7 @@ export class VaultPopupAutofillService {
}
// Slight delay to fix bug in Chromium browsers where popup closes without copying totp to clipboard
requestAnimationFrame(() => BrowserApi.closePopup(window));
setTimeout(() => BrowserApi.closePopup(window), 50);
}
/**

View File

@@ -6,7 +6,7 @@
"packages": {
"": {
"name": "@bitwarden/desktop",
"version": "2025.1.6",
"version": "2025.1.3",
"license": "GPL-3.0",
"dependencies": {
"@bitwarden/desktop-napi": "file:../desktop_native/napi"

View File

@@ -2,7 +2,7 @@
"name": "@bitwarden/desktop",
"productName": "Bitwarden",
"description": "A secure and free password manager for all of your devices.",
"version": "2025.1.6",
"version": "2025.1.3",
"author": "Bitwarden Inc. <hello@bitwarden.com> (https://bitwarden.com)",
"homepage": "https://bitwarden.com",
"license": "GPL-3.0",

View File

@@ -158,6 +158,7 @@ export class ApiService implements ApiServiceAbstraction {
private deviceType: string;
private isWebClient = false;
private isDesktopClient = false;
private refreshTokenPromise: Promise<string> | undefined;
/**
* The message (responseJson.ErrorModel.Message) that comes back from the server when a new device verification is required.
@@ -1733,7 +1734,18 @@ export class ApiService implements ApiServiceAbstraction {
);
}
protected async refreshToken(): Promise<string> {
// Keep the running refreshTokenPromise to prevent parallel calls.
protected refreshToken(): Promise<string> {
if (this.refreshTokenPromise === undefined) {
this.refreshTokenPromise = this.internalRefreshToken();
void this.refreshTokenPromise.finally(() => {
this.refreshTokenPromise = undefined;
});
}
return this.refreshTokenPromise;
}
private async internalRefreshToken(): Promise<string> {
const refreshToken = await this.tokenService.getRefreshToken();
if (refreshToken != null && refreshToken !== "") {
return this.refreshAccessToken();