Bug 1456466 P3 Fix tests to expect ServiceWorkerRegistration.update() to resolve with a registration. r=baku
authorBen Kelly <ben@wanderview.com>
Thu, 26 Apr 2018 13:52:30 -0700
changeset 472058 6f316e11d1fd80bbd490d9dd5016b138c4909d21
parent 472057 d195a2a5de0990e631122932d27d99c9b8e40761
child 472059 45c4b55aedbb5ddb087da402a227af4fda171b16
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1456466
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 1456466 P3 Fix tests to expect ServiceWorkerRegistration.update() to resolve with a registration. r=baku
dom/serviceworkers/test/worker_update.js
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/service-workers/service-worker/update-result.https.html
--- a/dom/serviceworkers/test/worker_update.js
+++ b/dom/serviceworkers/test/worker_update.js
@@ -1,14 +1,14 @@
 // For now this test only calls update to verify that our registration
 // job queueing works properly when called from the worker thread. We should
 // test actual update scenarios with a SJS test.
 onmessage = function(e) {
   self.registration.update().then(function(v) {
-    return v === undefined ? 'FINISH' : 'FAIL';
+    return v instanceof ServiceWorkerRegistration ? 'FINISH' : 'FAIL';
   }).catch(function(e) {
     return 'FAIL';
   }).then(function(result) {
     clients.matchAll().then(function(c) {
       if (c.length == 0) {
         dump("!!!!!!!!!!! WORKER HAS NO CLIENTS TO FINISH TEST !!!!!!!!!!!!\n");
         return;
       }
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -364373,16 +364373,22 @@
     ]
    ],
    "service-workers/service-worker/update-recovery.https.html": [
     [
      "/service-workers/service-worker/update-recovery.https.html",
      {}
     ]
    ],
+   "service-workers/service-worker/update-result.https.html": [
+    [
+     "/service-workers/service-worker/update-result.https.html",
+     {}
+    ]
+   ],
    "service-workers/service-worker/update.https.html": [
     [
      "/service-workers/service-worker/update.https.html",
      {}
     ]
    ],
    "service-workers/service-worker/waiting.https.html": [
     [
@@ -599394,16 +599400,20 @@
   "service-workers/service-worker/update-bytecheck.https.html": [
    "a39aa4877c3e47c8379b84f8520b6a726936867e",
    "testharness"
   ],
   "service-workers/service-worker/update-recovery.https.html": [
    "aac5705d6844e4a33200418504adb57053a45be2",
    "testharness"
   ],
+  "service-workers/service-worker/update-result.https.html": [
+   "06741e887be9746d7354394f74c054dd920d1b60",
+   "testharness"
+  ],
   "service-workers/service-worker/update.https.html": [
    "d55da98b05b5885084474ebdbabdf6c0998f8bca",
    "testharness"
   ],
   "service-workers/service-worker/waiting.https.html": [
    "7f891059dd421274db18967fd570abb3b1a90285",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/service-workers/service-worker/update-result.https.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>Service Worker: update() should resolve a ServiceWorkerRegistration</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+
+promise_test(async function(t) {
+  const script = './resources/empty.js';
+  const scope = './resources/empty.html?update-result';
+
+  let reg = await navigator.serviceWorker.register(script, { scope });
+  t.add_cleanup(async _ => await reg.unregister());
+  await wait_for_state(t, reg.installing, 'activated');
+
+  let result = await reg.update();
+  assert_true(result instanceof ServiceWorkerRegistration,
+              'update() should resolve a ServiceWorkerRegistration');
+}, 'ServiceWorkerRegistration.update() should resolve a registration object');
+
+</script>
+</body>