Bug 1884032 [wpt PR 44942] - [css-color] add missing colorscheme-aware tests, a=testonly
[gecko.git] / dom / serviceworkers / test / worker_update.js
blob8935cedc52a6409546dc9e0c85d56d5a1ae9b056
1 // For now this test only calls update to verify that our registration
2 // job queueing works properly when called from the worker thread. We should
3 // test actual update scenarios with a SJS test.
4 onmessage = function (e) {
5   self.registration
6     .update()
7     .then(function (v) {
8       return v instanceof ServiceWorkerRegistration ? "FINISH" : "FAIL";
9     })
10     .catch(function (ex) {
11       return "FAIL";
12     })
13     .then(function (result) {
14       clients.matchAll().then(function (c) {
15         if (!c.length) {
16           dump(
17             "!!!!!!!!!!! WORKER HAS NO CLIENTS TO FINISH TEST !!!!!!!!!!!!\n"
18           );
19           return;
20         }
22         c[0].postMessage(result);
23       });
24     });