chromium/third_party/blink/web_tests/external/wpt/content-security-policy/support/ping.js

if (typeof ServiceWorkerGlobalScope === "function") {
  self.onmessage = function (e) { e.source.postMessage("ping"); };
} else if (typeof SharedWorkerGlobalScope === "function") {
  onconnect = function (e) {
    var port = e.ports[0];

    port.onmessage = function () { port.postMessage("ping"); }
    port.postMessage("ping");
  };
} else if (typeof DedicatedWorkerGlobalScope === "function") {
  self.postMessage("ping");
}