Bug 1640930 [wpt PR 23775] - CacheStorage: Persist explicit response mime type., a=testonly
authorBen Kelly <wanderview@chromium.org>
Sat, 30 May 2020 09:50:19 +0000
changeset 597305 2746d529a7cc21bd5a1f1d53003dc6f2631e30e0
parent 597304 7ce73f5b515c5e8be5daa763ad60bf92e64a0f63
child 597306 d9a26b58a5165bd1f5ed1921c4583354ecaf873d
push id13310
push userffxbld-merge
push dateMon, 29 Jun 2020 14:50:06 +0000
treeherdermozilla-beta@15a59a0afa5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1640930, 23775, 938939, 2211949, 771921
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1640930 [wpt PR 23775] - CacheStorage: Persist explicit response mime type., a=testonly Automatic update from web-platform-tests CacheStorage: Persist explicit response mime type. This CL fixes a small interop issue where chromium would always recompute the mime type for a response after reading it from cache_storage. This was incorrect because the mime type should be fixed at original response construction time even if its headers are later mutated. This CL also causes service workers to use the mime type originally computed for the Response instead of re-extracting the value from the content-type header. Bug: 938939 Change-Id: I941c1b1e3863e41da49128ce814ac0f1762dae70 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211949 Commit-Queue: Ben Kelly <wanderview@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#771921} -- wpt-commits: baaeb9f35537fdbac74bec334aedacdf74c9f08f wpt-pr: 23775
testing/web-platform/tests/service-workers/service-worker/resources/mime-sniffing-worker.js
--- a/testing/web-platform/tests/service-workers/service-worker/resources/mime-sniffing-worker.js
+++ b/testing/web-platform/tests/service-workers/service-worker/resources/mime-sniffing-worker.js
@@ -1,5 +1,9 @@
 self.addEventListener('fetch', function(event) {
-    var res = new Response('<!DOCTYPE html>\n<h1 id=\'testid\'>test</h1>');
-    res.headers.delete('content-type');
+    // Use an empty content-type value to force mime-sniffing.  Note, this
+    // must be passed to the constructor since the mime-type of the Response
+    // is fixed and cannot be later changed.
+    var res = new Response('<!DOCTYPE html>\n<h1 id=\'testid\'>test</h1>', {
+      headers: { 'content-type': '' }
+    });
     event.respondWith(res);
   });