Remove ad-hoc CORS logic from TextTrackLoader

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}
diff --git a/service-workers/service-worker/webvtt-cross-origin.https.html b/service-workers/service-worker/webvtt-cross-origin.https.html
index 637f494..9394ff7 100644
--- a/service-workers/service-worker/webvtt-cross-origin.https.html
+++ b/service-workers/service-worker/webvtt-cross-origin.https.html
@@ -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';
@@ -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.
 
@@ -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>