From e2f0f086a24294b7c3a52a141d988527cdffbc0c Mon Sep 17 00:00:00 2001
From: Greg Fodor <gfodor@gmail.com>
Date: Wed, 31 Oct 2018 04:11:21 +0000
Subject: [PATCH] Handle case where register fais

---
 src/hub.js | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/hub.js b/src/hub.js
index a6cb40842..6d5a92b4d 100644
--- a/src/hub.js
+++ b/src/hub.js
@@ -292,10 +292,14 @@ document.addEventListener("DOMContentLoaded", async () => {
   const subscriptions = new Subscriptions(hubId);
 
   if (navigator.serviceWorker) {
-    navigator.serviceWorker.register("/hub.service.js");
-    navigator.serviceWorker.ready
-      .then(registration => subscriptions.setRegistration(registration))
-      .catch(() => subscriptions.setRegistrationFailed());
+    try {
+      navigator.serviceWorker.register("/hub.service.js");
+      navigator.serviceWorker.ready
+        .then(registration => subscriptions.setRegistration(registration))
+        .catch(() => subscriptions.setRegistrationFailed());
+    } catch (e) {
+      subscriptions.setRegistrationFailed();
+    }
   }
 
   const scene = document.querySelector("a-scene");
-- 
GitLab