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

This commit is contained in:
Yury Semikhatsky 2020-03-25 17:49:07 -07:00 committed by GitHub
parent 09cbf335bd
commit 89e123b708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View file

@ -9,7 +9,7 @@
"main": "index.js", "main": "index.js",
"playwright": { "playwright": {
"chromium_revision": "751710", "chromium_revision": "751710",
"firefox_revision": "1056", "firefox_revision": "1057",
"webkit_revision": "1182" "webkit_revision": "1182"
}, },
"scripts": { "scripts": {

View file

@ -288,6 +288,11 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,
}); });
expect(result).toBe(42); 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() { describe('Page.addInitScript', function() {

View file

@ -117,7 +117,7 @@ module.exports.describe = function({testRunner, expect, product, playwright, FFO
await page.evaluate(() => window.__FOO = 'hit'); await page.evaluate(() => window.__FOO = 'hit');
await watchdog; 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); server.setCSP('/empty.html', 'script-src ' + server.PREFIX);
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
let error = null; let error = null;