summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker.html')
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker.html b/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker.html
new file mode 100644
index 0000000000..77139fd08a
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta name="timeout" content="long">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/utils.js"></script>
+<script src="/common/dispatcher/dispatcher.js"></script>
+<script src="../resources/helper.sub.js"></script>
+<script>
+// Check whether the page is BFCached when there are shared workers that are
+// already loaded.
+runBfcacheTest({
+ funcBeforeNavigation: async () => {
+ globalThis.worker = new SharedWorker('../resources/echo-worker.js');
+ // Make sure the worker starts before navigation.
+ await WorkerHelper.pingWorker(globalThis.worker);
+ },
+ funcAfterAssertion: async (pageA) => {
+ // Confirm that the worker is still there.
+ assert_equals(
+ await pageA.execute_script(() => WorkerHelper.pingWorker(globalThis.worker)),
+ 'PASS',
+ 'SharedWorker should still work after restored from BFCache');
+ }
+}, 'Eligibility: shared workers');
+</script>