Bug 1452884 [wpt PR 10395] - S13nSW: Update wpt/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html, a=testonly
authorKenichi Ishibashi <bashi@chromium.org>
Sun, 22 Apr 2018 08:42:06 +0000
changeset 468853 3a62d29343d0e33cfd0cf83910150455e3b74018
parent 468852 9775b44cb66fc460bffeec2bba5b13dc7703313f
child 468854 60aa0cb8748a94e49594d73ad68231f80994f012
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1452884, 10395, 830472, 1004562, 550061
milestone61.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 1452884 [wpt PR 10395] - S13nSW: Update wpt/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html, a=testonly Automatic update from web-platform-testsS13nSW: Update wpt/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html Before this CL, the test expected that preloadResponse is rejected when decoding a chunked body is failed. However preloadResponse is supposed to be resolved once the headers are arrived. It should be resolved instead of rejected. Update the test to expect that preloadResponse is resolved even for broken chunked body. With S13nSW enabled, this test will start passing but it wouldn't pass w/o S13nSW. This CL also adds a test case where broken chunked body is transfered with delays. Bug: 830472 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: Ibc2909dfc4537f209417a13cff63898ad39229a7 Reviewed-on: https://chromium-review.googlesource.com/1004562 Commit-Queue: Kenichi Ishibashi <bashi@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#550061} -- wpt-commits: 1dcdb61cb2eb054e6d16733d4eb4a6b56793b598 wpt-pr: 10395
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html
testing/web-platform/tests/service-workers/service-worker/navigation-preload/resources/broken-chunked-encoding-worker.js
testing/web-platform/tests/service-workers/service-worker/navigation-preload/resources/chunked-encoding-scope.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -596962,17 +596962,17 @@
    "1cb6912164a02808f455538ea292f288b2f12ace",
    "testharness"
   ],
   "service-workers/service-worker/navigate-window.https.html": [
    "4b481c60520981f5f5791344cd78d638412b4ecb",
    "testharness"
   ],
   "service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html": [
-   "4953b0c2e9c0a0a02b285ca89b69947798804e58",
+   "df73c412cd275ebeacf9e416e050c1c5c6de9156",
    "testharness"
   ],
   "service-workers/service-worker/navigation-preload/chunked-encoding.https.html": [
    "2d77619348ca1ed77fd9f2b29412a9b5452607d6",
    "testharness"
   ],
   "service-workers/service-worker/navigation-preload/empty-preload-response-body.https.html": [
    "dddc7bde0f8e734144d8e8d77a2905b35c000b43",
@@ -596994,21 +596994,21 @@
    "6d9bfe62e8bd342ed70696322967e8395b84756a",
    "testharness"
   ],
   "service-workers/service-worker/navigation-preload/resources/broken-chunked-encoding-scope.asis": [
    "d1fd50a8f194803dcc0c0f6d74bdc57197c3d6e5",
    "support"
   ],
   "service-workers/service-worker/navigation-preload/resources/broken-chunked-encoding-worker.js": [
-   "becb31d5c7cd2773c064161ef689c31ebe8b7c3e",
+   "88a8274ce886b65f1e2e41ded7b1b423c0fcc9da",
    "support"
   ],
   "service-workers/service-worker/navigation-preload/resources/chunked-encoding-scope.py": [
-   "a12cd710fb4accc11a2662a33cda0b8a98d80a30",
+   "c3bf571de18291d5d1d3d8ee54f7d8529ff48fd1",
    "support"
   ],
   "service-workers/service-worker/navigation-preload/resources/chunked-encoding-worker.js": [
    "845d59cfe2e5b4d7c6bbb1bafe728df11e62207f",
    "support"
   ],
   "service-workers/service-worker/navigation-preload/resources/empty-preload-response-body-scope.html": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
--- a/testing/web-platform/tests/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/navigation-preload/broken-chunked-encoding.https.html
@@ -13,13 +13,30 @@ promise_test(t => {
           add_completion_callback(_ => registration.unregister());
           var worker = registration.installing;
           return wait_for_state(t, worker, 'activated');
         })
       .then(_ => with_iframe(scope))
       .then(frame => {
           assert_equals(
             frame.contentDocument.body.textContent,
-            'Done');
+            'PASS: preloadResponse resolved');
         });
-  }, 'Navigation Preload with broken chunked encoding must fail.');
+  }, 'FetchEvent#preloadResponse resolves even if the body is sent with broken chunked encoding.');
+
+promise_test(t => {
+    var script = 'resources/broken-chunked-encoding-worker.js';
+    var scope = 'resources/chunked-encoding-scope.py?use_broken_body';
+    return service_worker_unregister_and_register(t, script, scope)
+      .then(registration => {
+          add_completion_callback(_ => registration.unregister());
+          var worker = registration.installing;
+          return wait_for_state(t, worker, 'activated');
+        })
+      .then(_ => with_iframe(scope))
+      .then(frame => {
+          assert_equals(
+            frame.contentDocument.body.textContent,
+            'PASS: preloadResponse resolved');
+        });
+  }, 'FetchEvent#preloadResponse resolves even if the body is sent with broken chunked encoding with some delays');
 
 </script>
--- a/testing/web-platform/tests/service-workers/service-worker/navigation-preload/resources/broken-chunked-encoding-worker.js
+++ b/testing/web-platform/tests/service-workers/service-worker/navigation-preload/resources/broken-chunked-encoding-worker.js
@@ -1,11 +1,11 @@
 self.addEventListener('activate', event => {
     event.waitUntil(
         self.registration.navigationPreload.enable());
   });
 
 self.addEventListener('fetch', event => {
     event.respondWith(event.preloadResponse
       .then(
-        _ => new Response('Fail: got a response'),
-        _ => new Response('Done')));
+        _ => new Response('PASS: preloadResponse resolved'),
+        _ => new Response('FAIL: preloadResponse rejected')));
   });
--- a/testing/web-platform/tests/service-workers/service-worker/navigation-preload/resources/chunked-encoding-scope.py
+++ b/testing/web-platform/tests/service-workers/service-worker/navigation-preload/resources/chunked-encoding-scope.py
@@ -1,17 +1,20 @@
 import time
 
 def main(request, response):
-    body = "hello\nworld\n\n"
+    use_broken_body = 'use_broken_body' in request.GET
 
     response.add_required_headers = False
     response.writer.write_status(200)
     response.writer.write_header("Content-type", "text/html; charset=UTF-8")
     response.writer.write_header("Transfer-encoding", "chunked")
     response.writer.end_headers()
 
     for idx in range(10):
-        response.writer.write("%s\r\n%s\r\n" % (len(str(idx)), idx))
+        if use_broken_body:
+            response.writer.write("%s\n%s\n" % (len(str(idx)), idx))
+        else:
+            response.writer.write("%s\r\n%s\r\n" % (len(str(idx)), idx))
         response.writer.flush()
         time.sleep(0.001)
 
     response.writer.write("0\r\n\r\n")