Skip to content

Commit

Permalink
Remove ad-hoc CORS logic from TextTrackLoader
Browse files Browse the repository at this point in the history
As specified in [1], it should use "same-origin" request mode rather
than having ad-hoc CORS logic in TextTrackLoader.

Now a response from service worker with type "cors" is rejected. The
new behavior is actually more spec compliant (and matching with
Firfox), so fix the corresponding web platform test.

1: https://html.spec.whatwg.org/multipage/media.html#start-the-track-processing-model

Bug: 875153
Change-Id: Ib39ed9684528d734c9ca3d40eb8f6890c77af986
Reviewed-on: https://chromium-review.googlesource.com/1195446
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587492}
  • Loading branch information
yutakahirano authored and chromium-wpt-export-bot committed Aug 30, 2018
1 parent 12c5fcb commit 7078352
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions service-workers/service-worker/webvtt-cross-origin.https.html
Expand Up @@ -7,11 +7,14 @@
<script src="resources/test-helpers.sub.js?pipe=sub"></script>
<body>
<script>
// This file tests opaque responses for WebVTT text track. It creates
// an iframe with a <track> element, controlled by a service worker.
// This file tests responses for WebVTT text track from a service worker. It
// creates an iframe with a <track> element, controlled by a service worker.
// Each test tries to load a text track, the service worker intercepts the
// requests and responds with opaque or non-opaque responses. The opaque
// responses should result in load errors.
// requests and responds with opaque or non-opaque responses. As the
// crossorigin attribute is not set, request's mode is always "same-origin",
// and as specified in https://fetch.spec.whatwg.org/#http-fetch,
// a response from a service worker whose type is neither "basic" nor
// "default" is rejected.

const host_info = get_host_info();
const kScript = 'resources/fetch-rewrite-worker.js';
Expand Down Expand Up @@ -100,9 +103,9 @@
url += '&credentials=same-origin';
return load_track(url)
.then(result => {
assert_equals(result, 'load event');
assert_equals(result, 'error event');
});
}, 'cross-origin text track with approved cors request should load');
}, 'cross-origin text track with approved cors request should not load');

// Redirect tests.

Expand Down Expand Up @@ -165,8 +168,8 @@
url += '&credentials=same-origin';
return load_track(url)
.then(result => {
assert_equals(result, 'load event');
assert_equals(result, 'error event');
});
}, 'same-origin text track that redirects to a cross-origin text track with approved cors should load');
}, 'same-origin text track that redirects to a cross-origin text track with approved cors should not load');
</script>
</body>

0 comments on commit 7078352

Please sign in to comment.