Bug 1489193 [wpt PR 12873] - [Background Fetch] Reject when requests have body., a=testonly
authorMugdha Lakhani <nator@chromium.org>
Thu, 13 Sep 2018 02:54:02 +0000
changeset 492303 cac62569adb80cffcabeae2af4558080e97ab892
parent 492302 0034e5f4af5ff68638cd1fd094c8f58215045f2a
child 492304 873fc52d8225c55401c9f1c41ae1d2b301cac763
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1489193, 12873, 881344, 1210125, 590309
milestone64.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 1489193 [wpt PR 12873] - [Background Fetch] Reject when requests have body., a=testonly Automatic update from web-platform-tests[Background Fetch] Reject when requests have body. With this CL, 1. Record the BackgroundFetch.HasRequestsWithBody UMA metric, which is true if any requests in the background fetch contain a body, false otherwise. 2. Reject the fetch() promise, if any requests do contain a body. Bug: 881344 Change-Id: I595800adefe1dcc2c8bb04bec2295cc2886d963d Reviewed-on: https://chromium-review.googlesource.com/1210125 Commit-Queue: Mugdha Lakhani <nator@chromium.org> Reviewed-by: Peter Beverloo <peter@chromium.org> Reviewed-by: Rayan Kanso <rayankans@chromium.org> Reviewed-by: Steven Holte <holte@chromium.org> Cr-Commit-Position: refs/heads/master@{#590309} -- wpt-commits: b02f81005983ebcce822f1cc9a398fe38cad4ea1 wpt-pr: 12873
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/background-fetch/fetch.https.window.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -439340,17 +439340,17 @@
    "0b5b1cb5e94d3f27bebbb5a462bf1e823dfc57b4",
    "testharness"
   ],
   "background-fetch/dangling-markup.https.window.js": [
    "764257d7d1a8eecfba6735647637055b21dcb94b",
    "testharness"
   ],
   "background-fetch/fetch.https.window.js": [
-   "f2cffd0b8cfc569ff1ad23bf1ac86596dcde6603",
+   "dee9cb0e03750586739bdb536557993e981467da",
    "testharness"
   ],
   "background-fetch/get-ids.https.window.js": [
    "4c8bf26190719108e65b446a34aafe0aeb1377be",
    "testharness"
   ],
   "background-fetch/get.https.window.js": [
    "5f249663fda2f02e3457d49226e8efd1754f49a3",
--- a/testing/web-platform/tests/background-fetch/fetch.https.window.js
+++ b/testing/web-platform/tests/background-fetch/fetch.https.window.js
@@ -117,8 +117,31 @@ backgroundFetchTest(async (test, backgro
 
   for (const result of results) {
     assert_true(result.url.includes('resources/feature-name.txt'));
     assert_equals(result.status, 200);
     assert_equals(result.text, 'Background Fetch');
   }
 
 }, 'Fetches can have requests with duplicate URLs');
+
+backgroundFetchTest(async (test, backgroundFetch) => {
+  const request =
+      new Request('resources/feature-name.txt',
+                  {method: 'POST', body: 'TestBody'});
+
+  const registration = await backgroundFetch.fetch('my-id', request);
+
+  const {type, eventRegistration, results} = await getMessageFromServiceWorker();
+  assert_equals('backgroundfetchsuccess', type);
+  assert_equals(results.length, 1);
+
+  assert_equals(eventRegistration.id, registration.id);
+  assert_equals(eventRegistration.state, 'success');
+  assert_equals(eventRegistration.failureReason, '');
+
+  for (const result of results) {
+    assert_true(result.url.includes('resources/feature-name.txt'));
+    assert_equals(result.status, 200);
+    assert_equals(result.text, 'Background Fetch');
+  }
+
+}, 'Fetches can have requests with a body');