Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: bypassCSP should not crash with a javascript: url navigation (#43457)
Dmitry Gozman7a84ee8f609d
diff --git a/tests/library/browsercontext-csp.spec.ts b/tests/library/browsercontext-csp.spec.tsindex 1317b9e9d5..afce53055b 100644--- a/tests/library/browsercontext-csp.spec.ts+++ b/tests/library/browsercontext-csp.spec.ts@@ -111,3 +111,17 @@ it('should bypass CSP in iframes as well', async ({ browser, server }) => {await context.close();}});++it('should not crash on javascript: navigation', async ({ browser, server }) => {+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/43213' });+ const context = await browser.newContext({ bypassCSP: true });+ const page = await context.newPage();+ let crashed = false;+ page.on('crash', () => crashed = true);+ await page.goto(server.EMPTY_PAGE);+ await page.setContent(`<a id="a" href="javascript:window.__clicked = true">click</a>`);+ await page.click('#a');+ await expect.poll(() => page.evaluate(() => window['__clicked'])).toBe(true);+ expect(crashed).toBe(false);+ await context.close();+});