<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/relaunch-after-close-window.js"></script>
</head>
<body>
<script>

promise_test(async (t) => {
    const worker = new SharedWorker('resources/relaunch-after-close-sharedworker.js');

    await beginTestForPage1();
    w = open("resources/relaunch-after-close-page2.html");

    return new Promise((resolve, reject) => {
        window.addEventListener("result", (e) => {
            assert_equals(e.data, "PASS: Successfully shutdown and reconstructed the SharedWorker many times");
            resolve();
        });
    });
}, "Shared worker should be able to relaunch after calling SharedWorkerGlobalScope.close()");
</script>
</body>
</html>
