claim_worker_1.js (800B)
1 onactivate = function (e) { 2 var result = { 3 resolve_value: false, 4 match_count_before: -1, 5 match_count_after: -1, 6 message: "claim_worker_1", 7 }; 8 9 self.clients 10 .matchAll() 11 .then(function (matched) { 12 // should be 0 13 result.match_count_before = matched.length; 14 }) 15 .then(function () { 16 return self.clients.claim(); 17 }) 18 .then(function (ret) { 19 result.resolve_value = ret; 20 return self.clients.matchAll(); 21 }) 22 .then(function (matched) { 23 // should be 2 24 result.match_count_after = matched.length; 25 for (i = 0; i < matched.length; i++) { 26 matched[i].postMessage(result); 27 } 28 if (result.match_count_after !== 2) { 29 dump("ERROR: claim_worker_1 failed to capture clients.\n"); 30 } 31 }); 32 };