Bug 1495076 [wpt PR 13262] - [Background Fetch] Move CORS preflight check to the controller., a=testonly

Automatic update from web-platform-tests[Background Fetch] Move CORS preflight check to the controller.

Bug: 889888
Change-Id: I2429361627ffea2e1b8d5a11eb0e34b0cbfa1abb
Reviewed-on: https://chromium-review.googlesource.com/c/1249265
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Reviewed-by: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596707}

--

wpt-commits: 884ed4baadf3c58d33126793fb7effb2ba974408
wpt-pr: 13262
This commit is contained in:
Mugdha Lakhani 2018-10-09 04:14:26 +00:00 committed by moz-wptsync-bot
parent fc8b816462
commit 7fa4996b76

View File

@ -82,6 +82,41 @@ backgroundFetchTest(async (test, backgroundFetch) => {
}, 'Empty URL is OK.');
backgroundFetchTest(async (test, backgroundFetch) => {
const registrationId = uniqueId();
const registration =
await backgroundFetch.fetch(registrationId,
new Request('https://example/com', {
method: 'PUT',
}));
assert_equals(registration.id, registrationId);
const {type, eventRegistration, results} = await getMessageFromServiceWorker();
assert_equals(type, 'backgroundfetchsuccess');
assert_equals(eventRegistration.result, 'success');
assert_equals(eventRegistration.failureReason, '');
}, 'Requests with PUT method require CORS Preflight and succeed.');
backgroundFetchTest(async (test, backgroundFetch) => {
const registrationId = uniqueId();
const registration =
await backgroundFetch.fetch(registrationId,
new Request('https://example/com', {
method: 'POST',
headers: {'Content-Type': 'text/json'}
}));
assert_equals(registration.id, registrationId);
const {type, eventRegistration, results} = await getMessageFromServiceWorker();
assert_equals(type, 'backgroundfetchsuccess');
assert_equals(eventRegistration.result, 'success');
assert_equals(eventRegistration.failureReason, '');
}, 'Requests with text/json content type require CORS Preflight and succeed.');
backgroundFetchTest(async (test, backgroundFetch) => {
const registrationId = uniqueId();
const registration =