Skip to content

Commit c782480

Browse files
committed
fix: move WeakSet registration after validation to prevent poisoned context
1 parent 825aedc commit c782480

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/testing/src/playwright/setupClerkTestingToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export const setupClerkTestingToken = async ({ context, options, page }: SetupCl
4747
}
4848
return;
4949
}
50-
setupContexts.add(browserContext);
5150

5251
const fapiUrl = options?.frontendApiUrl || process.env.CLERK_FAPI;
5352
if (!fapiUrl) {
@@ -57,6 +56,7 @@ export const setupClerkTestingToken = async ({ context, options, page }: SetupCl
5756
const escapedFapiUrl = fapiUrl.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
5857
const apiUrl = new RegExp(`^https://${escapedFapiUrl}/v1/.*?(\\?.*)?$`);
5958

59+
setupContexts.add(browserContext);
6060
await browserContext.route(apiUrl, async route => {
6161
const originalUrl = new URL(route.request().url());
6262
const testingToken = process.env.CLERK_TESTING_TOKEN;

0 commit comments

Comments
 (0)