mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
0a8ff0ad85
# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35951 --HG-- extra : source : 62f3501af4bc1c0bd1ee1977a28aee04706a6663
33 lines
795 B
JavaScript
33 lines
795 B
JavaScript
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");
|
|
}
|
|
});
|
|
};
|