chromium/third_party/blink/web_tests/http/tests/workers/resources/create-shared-worker-frame.html

<body>
<script>
var workerNames = window.location.search.toString().substring(1);
var nameArray = workerNames.split(",");
var wait_pong_promises = [];

for (var i = 0; i < nameArray.length; i++) {
    wait_pong_promises.push(new Promise(function(resolve) {
        var worker = new SharedWorker("shared-worker-common.js", nameArray[i]);
        worker.port.addEventListener('message', function(e) {
                resolve(e.data);
            }, false);
        worker.port.start();
        worker.port.postMessage('ping');
    }));
}
</script>
</body>