File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,17 @@ describe('Capabilities', function() {
34
34
expect ( value ) . toBe ( 'incoming' ) ;
35
35
} ) ;
36
36
37
- it . fail ( FFOX ) ( 'should respect CSP' , async ( { page, server} ) => {
38
- server . setCSP ( '/empty.html' , 'script-src ' + server . PREFIX ) ;
37
+ it ( 'should respect CSP' , async ( { page, server} ) => {
38
+ server . setRoute ( '/empty.html' , async ( req , res ) => {
39
+ res . setHeader ( 'Content-Security-Policy' , `script-src 'unsafe-inline';` ) ;
40
+ res . end ( `
41
+ <script>
42
+ window.testStatus = 'SUCCESS';
43
+ window.testStatus = eval("'FAILED'");
44
+ </script>` ) ;
45
+ } ) ;
46
+
39
47
await page . goto ( server . EMPTY_PAGE ) ;
40
- expect ( await page . evaluate ( ( ) => new Promise ( f => setTimeout ( ( ) => {
41
- try {
42
- f ( eval ( "'failed'" ) ) ;
43
- } catch ( e ) {
44
- f ( 'success' ) ;
45
- }
46
- } , 0 ) ) ) ) . toBe ( 'success' ) ;
48
+ expect ( await page . evaluate ( ( ) => window . testStatus ) ) . toBe ( 'SUCCESS' ) ;
47
49
} ) ;
48
50
} ) ;
You can’t perform that action at this time.
0 commit comments