chromium/third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/clients-get-client-types-shared-worker.js

onconnect = function(e) {
  var port = e.ports[0];
  fetch('clientId')
    .then(function(response) {
        return response.text();
      })
    .then(function(text) {
        port.postMessage({clientId: text});
      });
};