diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/serviceworkers/test/claim_worker_2.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/serviceworkers/test/claim_worker_2.js')
-rw-r--r-- | dom/serviceworkers/test/claim_worker_2.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dom/serviceworkers/test/claim_worker_2.js b/dom/serviceworkers/test/claim_worker_2.js new file mode 100644 index 0000000000..4293873da7 --- /dev/null +++ b/dom/serviceworkers/test/claim_worker_2.js @@ -0,0 +1,34 @@ +onactivate = function (e) { + var result = { + resolve_value: false, + match_count_before: -1, + match_count_after: -1, + message: "claim_worker_2", + }; + + self.clients + .matchAll() + .then(function (matched) { + // should be 0 + result.match_count_before = matched.length; + }) + .then(function () { + return clients.claim(); + }) + .then(function (ret) { + result.resolve_value = ret; + return clients.matchAll(); + }) + .then(function (matched) { + // should be 1 + result.match_count_after = matched.length; + if (result.match_count_after === 1) { + matched[0].postMessage(result); + } else { + dump("ERROR: claim_worker_2 failed to capture clients.\n"); + for (let i = 0; i < matched.length; ++i) { + dump("### ### matched[" + i + "]: " + matched[i].url + "\n"); + } + } + }); +}; |