summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html')
-rw-r--r--dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html b/dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html
new file mode 100644
index 0000000000..d611b01b59
--- /dev/null
+++ b/dom/serviceworkers/test/isolated/multi-e10s-update/file_multie10s_update.html
@@ -0,0 +1,40 @@
+<html>
+<body>
+<script>
+
+var bc = new BroadcastChannel('start');
+bc.onmessage = function(e) {
+ // This message is not for us.
+ if (e.data != 'go') {
+ return;
+ }
+
+ // It can happen that we don't have the registrations yet. Let's try with a
+ // timeout.
+ function proceed() {
+ return navigator.serviceWorker.getRegistrations().then(regs => {
+ if (!regs.length) {
+ setTimeout(proceed, 200);
+ return;
+ }
+
+ bc = new BroadcastChannel('result');
+ regs[0].update().then(() => {
+ bc.postMessage(0);
+ }, () => {
+ bc.postMessage(1);
+ });
+
+ // Tell the coordinating frame script that we've kicked off our update
+ // call so that the SW script can be released once both instances of us
+ // have triggered update() and 1 has failed.
+ const blockingChannel = new BroadcastChannel('update');
+ blockingChannel.postMessage(true);
+ });
+ }
+
+ proceed();
+}
+</script>
+</body>
+</html>