| OLD | NEW |
| 1 bodyDefault = ''' | 1 bodyDefault = ''' |
| 2 importScripts('worker-testharness.js'); | 2 importScripts('worker-testharness.js'); |
| 3 importScripts('test-helpers.sub.js'); | 3 importScripts('test-helpers.sub.js'); |
| 4 importScripts('../resources/get-host-info.sub.js'); | 4 importScripts('/common/get-host-info.sub.js'); |
| 5 | 5 |
| 6 var host_info = get_host_info(); | 6 var host_info = get_host_info(); |
| 7 | 7 |
| 8 test(function() { | 8 test(function() { |
| 9 var import_script_failed = false; | 9 var import_script_failed = false; |
| 10 try { | 10 try { |
| 11 importScripts(host_info.HTTPS_REMOTE_ORIGIN + | 11 importScripts(host_info.HTTPS_REMOTE_ORIGIN + |
| 12 base_path() + 'empty.js'); | 12 base_path() + 'empty.js'); |
| 13 } catch(e) { | 13 } catch(e) { |
| 14 import_script_failed = true; | 14 import_script_failed = true; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 40 assert_unreached('Redirected fetch should fail.'); | 40 assert_unreached('Redirected fetch should fail.'); |
| 41 }, function(){ | 41 }, function(){ |
| 42 t.done(); | 42 t.done(); |
| 43 }) | 43 }) |
| 44 .catch(unreached_rejection(t)); | 44 .catch(unreached_rejection(t)); |
| 45 }, 'Redirected fetch test for default-src');''' | 45 }, 'Redirected fetch test for default-src');''' |
| 46 | 46 |
| 47 bodyScript = ''' | 47 bodyScript = ''' |
| 48 importScripts('worker-testharness.js'); | 48 importScripts('worker-testharness.js'); |
| 49 importScripts('test-helpers.sub.js'); | 49 importScripts('test-helpers.sub.js'); |
| 50 importScripts('../resources/get-host-info.sub.js'); | 50 importScripts('/common/get-host-info.sub.js'); |
| 51 | 51 |
| 52 var host_info = get_host_info(); | 52 var host_info = get_host_info(); |
| 53 | 53 |
| 54 test(function() { | 54 test(function() { |
| 55 var import_script_failed = false; | 55 var import_script_failed = false; |
| 56 try { | 56 try { |
| 57 importScripts(host_info.HTTPS_REMOTE_ORIGIN + | 57 importScripts(host_info.HTTPS_REMOTE_ORIGIN + |
| 58 base_path() + 'empty.js'); | 58 base_path() + 'empty.js'); |
| 59 } catch(e) { | 59 } catch(e) { |
| 60 import_script_failed = true; | 60 import_script_failed = true; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 86 t.done(); | 86 t.done(); |
| 87 }, function(){ | 87 }, function(){ |
| 88 assert_unreached('Redirected fetch should not fail.'); | 88 assert_unreached('Redirected fetch should not fail.'); |
| 89 }) | 89 }) |
| 90 .catch(unreached_rejection(t)); | 90 .catch(unreached_rejection(t)); |
| 91 }, 'Redirected fetch test for script-src');''' | 91 }, 'Redirected fetch test for script-src');''' |
| 92 | 92 |
| 93 bodyConnect = ''' | 93 bodyConnect = ''' |
| 94 importScripts('worker-testharness.js'); | 94 importScripts('worker-testharness.js'); |
| 95 importScripts('test-helpers.sub.js'); | 95 importScripts('test-helpers.sub.js'); |
| 96 importScripts('../resources/get-host-info.sub.js'); | 96 importScripts('/common/get-host-info.sub.js'); |
| 97 | 97 |
| 98 var host_info = get_host_info(); | 98 var host_info = get_host_info(); |
| 99 | 99 |
| 100 test(function() { | 100 test(function() { |
| 101 var import_script_failed = false; | 101 var import_script_failed = false; |
| 102 try { | 102 try { |
| 103 importScripts(host_info.HTTPS_REMOTE_ORIGIN + | 103 importScripts(host_info.HTTPS_REMOTE_ORIGIN + |
| 104 base_path() + 'empty.js'); | 104 base_path() + 'empty.js'); |
| 105 } catch(e) { | 105 } catch(e) { |
| 106 import_script_failed = true; | 106 import_script_failed = true; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if directive == 'default': | 144 if directive == 'default': |
| 145 headers.append(('Content-Security-Policy', "default-src 'self'")) | 145 headers.append(('Content-Security-Policy', "default-src 'self'")) |
| 146 body = bodyDefault | 146 body = bodyDefault |
| 147 elif directive == 'script': | 147 elif directive == 'script': |
| 148 headers.append(('Content-Security-Policy', "script-src 'self'")) | 148 headers.append(('Content-Security-Policy', "script-src 'self'")) |
| 149 body = bodyScript | 149 body = bodyScript |
| 150 elif directive == 'connect': | 150 elif directive == 'connect': |
| 151 headers.append(('Content-Security-Policy', "connect-src 'self'")) | 151 headers.append(('Content-Security-Policy', "connect-src 'self'")) |
| 152 body = bodyConnect | 152 body = bodyConnect |
| 153 return headers, body | 153 return headers, body |
| OLD | NEW |