Skip to content

Commit

Permalink
#5715 Fix id token fetch for exception reports (#5717)
Browse files Browse the repository at this point in the history
* #5715 Fix id token fetch for exception reports

* pr review
  • Loading branch information
sosnovsky authored and ioanmo226 committed May 27, 2024
1 parent 720da40 commit ef0e47e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion extension/chrome/settings/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export class SetupView extends View {
return;
}
if (!armoredPubkey) {
await Ui.modal.warning('Public key not usable - not sumbitting to Attester');
await Ui.modal.warning('Public key not usable - not submitting to Attester');
return;
}
const pub = await KeyUtil.parse(armoredPubkey);
Expand Down
15 changes: 8 additions & 7 deletions extension/js/common/platform/catch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import { Url } from '../core/common.js';
import { FLAVOR, InMemoryStoreKeys, SHARED_TENANT_API_HOST, VERSION } from '../core/const.js';
import { GlobalStore } from './store/global-store.js';
import { InMemoryStore } from './store/in-memory-store.js';

export class UnreportableError extends Error {}
Expand Down Expand Up @@ -283,8 +284,8 @@ export class Catch {
private static formatExceptionForReport(thrown: unknown, line?: number, col?: number): ErrorReport {
if (!line || !col) {
const { line: parsedLine, col: parsedCol } = Catch.getErrorLineAndCol(thrown);
line = parsedLine;
col = parsedCol;
line = parsedLine > 0 ? parsedLine : 1;
col = parsedCol > 0 ? parsedCol : 1;
}
if (thrown instanceof Error) {
// reporting stack may differ from the stack of the actual error, both may be interesting
Expand All @@ -299,8 +300,8 @@ export class Catch {
name: exception.name.substring(0, 50),
message: exception.message.substring(0, 200),
url: location.href.split('?')[0],
line: line || 0,
col: col || 0,
line: line || 1,
col: col || 1,
trace: exception.stack || '',
version: VERSION,
environment: Catch.RUNTIME_ENVIRONMENT,
Expand All @@ -311,8 +312,8 @@ export class Catch {

private static async doSendErrorToSharedTenantFes(errorReport: ErrorReport) {
try {
const uncheckedUrlParams = Url.parse(['acctEmail']);
const acctEmail = String(uncheckedUrlParams.acctEmail);
const { acctEmail: parsedEmail } = Url.parse(['acctEmail']);
const acctEmail = parsedEmail ? String(parsedEmail) : (await GlobalStore.acctEmailsGet())?.[0];
if (!acctEmail) {
console.error('Not reporting error because user is not logged in');
return;
Expand Down Expand Up @@ -376,7 +377,7 @@ export class Catch {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return { line: Number(matched![1]), col: Number(matched![2]) };
} catch (lineErr) {
return { line: 0, col: 0 };
return { line: 1, col: 1 };
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/source/tests/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3271,7 +3271,7 @@ export const defineComposeTests = (testVariant: TestVariant, testWithBrowser: Te
const acct = '[email protected]';
const settingsPage = await BrowserRecipe.openSettingsLoginApprove(t, browser, acct);
await SetupPageRecipe.autoSetupWithEKM(settingsPage, {
expectWarnModal: 'Public key not usable - not sumbitting to Attester',
expectWarnModal: 'Public key not usable - not submitting to Attester',
});
})
);
Expand Down
2 changes: 1 addition & 1 deletion test/source/tests/flaky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const defineFlakyTests = (testVariant: TestVariant, testWithBrowser: Test
clickOn: 'confirm',
});
await SettingsPageRecipe.waitForModalAndRespond(settingsPage, 'warning', {
contentToCheck: 'Public key not usable - not sumbitting to Attester',
contentToCheck: 'Public key not usable - not submitting to Attester',
clickOn: 'confirm',
});
await settingsPage.waitAndClick('@action-step4done-account-settings');
Expand Down
2 changes: 1 addition & 1 deletion test/source/tests/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ AN8G3r5Htj8olot+jm9mIa5XLXWzMNUZgg==
},
});
const settingsPage = await BrowserRecipe.openSettingsLoginApprove(t, browser, acctEmail);
await SetupPageRecipe.autoSetupWithEKM(settingsPage, { expectWarnModal: 'Public key not usable - not sumbitting to Attester' });
await SetupPageRecipe.autoSetupWithEKM(settingsPage, { expectWarnModal: 'Public key not usable - not submitting to Attester' });
const gmailPage = await openMockGmailPage(t, browser, acctEmail);
// Check if notification presents
let warningMsg =
Expand Down

0 comments on commit ef0e47e

Please sign in to comment.