OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta http-equiv="Content-Security-Policy" content="treat-as-public-address"
> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="./resources/preflight.js"></script> |
| 8 </head> |
| 9 <body> |
| 10 <script> |
| 11 promise_test(function (t) { |
| 12 return promise_rejects(t, new TypeError(), fetch(preflightURL('fail-
with-500', 'json'))); |
| 13 }, "'fetch()' should fail on failed preflight: 500 status"); |
| 14 |
| 15 promise_test(function (t) { |
| 16 return promise_rejects(t, new TypeError(), fetch(preflightURL('fail-
without-allow', 'json'))); |
| 17 }, "'fetch()' should fail on failed preflight: no allow-external"); |
| 18 |
| 19 promise_test(function (t) { |
| 20 return fetch(preflightURL('pass', 'json')) |
| 21 .then(function (response) { |
| 22 return response.json(); |
| 23 }).then(function (json) { |
| 24 assert_equals('success', json.jsonpResult); |
| 25 }); |
| 26 }, "'fetch()' should pass on successful preflight"); |
| 27 </script> |
| 28 </body> |
| 29 </html> |
OLD | NEW |