| <!doctype html> |
| <meta charset="utf-8"> |
| <title>Background Fetch API: CORS preflight blocking test</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/serviceworker/resources/test-helpers.js"></script> |
| <script src="/serviceworker/resources/shared-utils.js"></script> |
| <script src="resources/utils.js"></script> |
| <script> |
| 'use strict'; |
| |
| // Requests that require CORS preflights are temporarily blocked, because the |
| // browser side of Background Fetch doesn't yet support performing CORS checks |
| // (crbug.com/711354). This is non-spec-compliant, which is why it is tested |
| // here instead of in web-platform-tests. |
| |
| // This is not a comprehensive test of CORS preflight detection - it is just |
| // intended to check that detection is enabled. |
| |
| backgroundFetchTest((t, bgFetch) => { |
| return bgFetch.fetch(uniqueTag(), new Request('https://example.com', { |
| method: 'POST', |
| headers: {'Content-Type': 'text/plain'} |
| })); |
| }, 'POST and text/plain are whitelisted, so should register ok'); |
| |
| backgroundFetchTest((t, bgFetch) => { |
| return bgFetch.fetch(uniqueTag(), new Request(self.origin, { |
| method: 'PUT', |
| headers: {'Content-Type': 'text/json'} |
| })); |
| }, 'same-origin fetches should register ok'); |
| |
| </script> |