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