From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- dom/serviceworkers/test/worker_update.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 dom/serviceworkers/test/worker_update.js (limited to 'dom/serviceworkers/test/worker_update.js') diff --git a/dom/serviceworkers/test/worker_update.js b/dom/serviceworkers/test/worker_update.js new file mode 100644 index 0000000000..5c83b9cd9e --- /dev/null +++ b/dom/serviceworkers/test/worker_update.js @@ -0,0 +1,25 @@ +// 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 instanceof ServiceWorkerRegistration ? "FINISH" : "FAIL"; + }) + .catch(function(ex) { + return "FAIL"; + }) + .then(function(result) { + clients.matchAll().then(function(c) { + if (!c.length) { + dump( + "!!!!!!!!!!! WORKER HAS NO CLIENTS TO FINISH TEST !!!!!!!!!!!!\n" + ); + return; + } + + c[0].postMessage(result); + }); + }); +}; -- cgit v1.2.3