Skip to content

Commit 132dd83

Browse files
committed
try
1 parent f6dfa7a commit 132dd83

File tree

2 files changed

+23
-58
lines changed

2 files changed

+23
-58
lines changed

test/e2e/tests/vault-corruption/vault-corruption.spec.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,8 @@ describe('Vault Corruption', function () {
120120
* @param driver - The WebDriver instance.
121121
*/
122122
async function waitForVaultRestorePage(driver: Driver) {
123-
await driver.waitUntil(
124-
async () => {
125-
await driver.navigate(PAGES.HOME, { waitForControllers: false });
126-
const title = await driver.driver.getTitle();
127-
// the browser will return an error message for our UI's HOME page until
128-
// the extension has restarted
129-
return title === WINDOW_TITLES.ExtensionInFullScreenView;
130-
},
131-
// reload and check title as quickly a possible
132-
{ interval: 100, timeout: 10000 },
133-
);
123+
await driver.delay(10000)
124+
await driver.navigate(PAGES.HOME, { waitForControllers: false });
134125
await driver.assertElementNotPresent('.loading-logo', { timeout: 10000 });
135126
}
136127

ui/helpers/utils/critical-startup-error-handler.ts

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ export class CriticalStartupErrorHandler {
3434

3535
#onLivenessCheckCompleted?: () => void;
3636

37-
#errorDisplayed = false;
38-
3937
/**
4038
* Creates an instance of CriticalStartupErrorHandler.
4139
* This class listens for critical startup errors from the background script
@@ -68,17 +66,13 @@ export class CriticalStartupErrorHandler {
6866
try {
6967
await Promise.race([livenessCheck, timeoutPromise]);
7068
} catch (error) {
71-
// Only display error if we haven't already displayed one
72-
if (!this.#errorDisplayed) {
73-
this.#errorDisplayed = true;
74-
await displayCriticalError(
75-
this.#container,
76-
CriticalErrorTranslationKey.TroubleStarting,
77-
// This cast is safe because `livenessCheck` can't throw, and `timeoutPromise` only throws an
78-
// error.
79-
error as ErrorLike,
80-
);
81-
}
69+
await displayCriticalError(
70+
this.#container,
71+
CriticalErrorTranslationKey.TroubleStarting,
72+
// This cast is safe because `livenessCheck` can't throw, and `timeoutPromise` only throws an
73+
// error.
74+
error as ErrorLike,
75+
);
8276
} finally {
8377
clearTimeout(this.#livenessCheckTimeoutId);
8478
}
@@ -107,9 +101,7 @@ export class CriticalStartupErrorHandler {
107101
if (method === BACKGROUND_LIVENESS_METHOD) {
108102
if (this.#onLivenessCheckCompleted) {
109103
this.#onLivenessCheckCompleted();
110-
} else if (!this.#errorDisplayed) {
111-
// Only display error if we haven't already displayed one and liveness check wasn't initialized
112-
this.#errorDisplayed = true;
104+
} else {
113105
await displayCriticalError(
114106
this.#container,
115107
CriticalErrorTranslationKey.TroubleStarting,
@@ -133,22 +125,13 @@ export class CriticalStartupErrorHandler {
133125
hasBackup: boolean;
134126
currentLocale?: string;
135127
};
136-
// Only display error if we haven't already displayed one
137-
if (!this.#errorDisplayed) {
138-
this.#errorDisplayed = true;
139-
// Cancel the liveness check since we're displaying a corruption error
140-
clearTimeout(this.#livenessCheckTimeoutId);
141-
if (this.#onLivenessCheckCompleted) {
142-
this.#onLivenessCheckCompleted();
143-
}
144-
await displayStateCorruptionError(
145-
this.#container,
146-
this.#port,
147-
error,
148-
hasBackup,
149-
currentLocale,
150-
);
151-
}
128+
await displayStateCorruptionError(
129+
this.#container,
130+
this.#port,
131+
error,
132+
hasBackup,
133+
currentLocale,
134+
);
152135
} else if (method === DISPLAY_GENERAL_STARTUP_ERROR) {
153136
if (!hasProperty(data, 'params') || !isObject(data.params)) {
154137
log.error(
@@ -162,21 +145,12 @@ export class CriticalStartupErrorHandler {
162145
error: ErrorLike;
163146
currentLocale?: string;
164147
};
165-
// Only display error if we haven't already displayed one
166-
if (!this.#errorDisplayed) {
167-
this.#errorDisplayed = true;
168-
// Cancel the liveness check since we're displaying a general error
169-
clearTimeout(this.#livenessCheckTimeoutId);
170-
if (this.#onLivenessCheckCompleted) {
171-
this.#onLivenessCheckCompleted();
172-
}
173-
await displayCriticalError(
174-
this.#container,
175-
CriticalErrorTranslationKey.TroubleStarting,
176-
error as ErrorLike,
177-
currentLocale,
178-
);
179-
}
148+
await displayCriticalError(
149+
this.#container,
150+
CriticalErrorTranslationKey.TroubleStarting,
151+
error as ErrorLike,
152+
currentLocale,
153+
);
180154
}
181155
};
182156

0 commit comments

Comments
 (0)