tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

match_all_client_id_worker.js (685B)


      1 onmessage = function (e) {
      2  dump("MatchAllClientIdWorker:" + e.data + "\n");
      3  var id = [];
      4  var iterations = 5;
      5  var counter = 0;
      6 
      7  for (var i = 0; i < iterations; i++) {
      8    self.clients.matchAll().then(function (res) {
      9      if (!res.length) {
     10        dump("ERROR: no clients are currently controlled.\n");
     11      }
     12 
     13      client = res[0];
     14      id[counter] = client.id;
     15      counter++;
     16      if (counter >= iterations) {
     17        var response = true;
     18        for (var index = 1; index < iterations; index++) {
     19          if (id[0] != id[index]) {
     20            response = false;
     21            break;
     22          }
     23        }
     24        client.postMessage(response);
     25      }
     26    });
     27  }
     28 };