Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(firefox): enable CSP tests that use new Function() (#1542)

Yury Semikhatsky89e123b708eb
diff --git a/package.json b/package.json
index 0a8d6589da..9f1396a038 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
"main": "index.js",
"playwright": {
"chromium_revision": "751710",
- "firefox_revision": "1056",
+ "firefox_revision": "1057",
"webkit_revision": "1182"
},
"scripts": {
diff --git a/test/evaluation.spec.js b/test/evaluation.spec.js
index c4158e6489..43cc0bb427 100644
--- a/test/evaluation.spec.js
+++ b/test/evaluation.spec.js
@@ -288,6 +288,11 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,
});
expect(result).toBe(42);
});
+ it('should work with new Function() and CSP', async({page, server}) => {
+ server.setCSP('/empty.html', 'script-src ' + server.PREFIX);
+ await page.goto(server.PREFIX + '/empty.html');
+ expect(await page.evaluate(() => new Function('return true')())).toBe(true);
+ });
});
describe('Page.addInitScript', function() {
diff --git a/test/waittask.spec.js b/test/waittask.spec.js
index 40a0e7beaf..83abdfd8f7 100644
--- a/test/waittask.spec.js
+++ b/test/waittask.spec.js
@@ -117,7 +117,7 @@ module.exports.describe = function({testRunner, expect, product, playwright, FFO
await page.evaluate(() => window.__FOO = 'hit');
await watchdog;
});
- it.fail(FFOX)('should work with strict CSP policy', async({page, server}) => {
+ it('should work with strict CSP policy', async({page, server}) => {
server.setCSP('/empty.html', 'script-src ' + server.PREFIX);
await page.goto(server.EMPTY_PAGE);
let error = null;