diff options
author | David Barksdale <amatus@amatus.name> | 2014-12-05 18:26:06 -0600 |
---|---|---|
committer | David Barksdale <amatus@amatus.name> | 2014-12-05 18:26:06 -0600 |
commit | e5aaf1a88fa05a25bdc46c9a6b1c590c3a039ccc (patch) | |
tree | e5fc214beafb2945c7b33fc280608b73b4faa23e | |
parent | 1c58ffc01a5758e4e3559e3ccd648da71fe74c65 (diff) |
Handle missing SharedWorker
-rw-r--r-- | gnunet-build/packages/gnunet/gnunet/files/client.js | 9 | ||||
-rw-r--r-- | src/hl/index.cljs.hl | 14 |
2 files changed, 19 insertions, 4 deletions
diff --git a/gnunet-build/packages/gnunet/gnunet/files/client.js b/gnunet-build/packages/gnunet/gnunet/files/client.js index b99655d..06b4cde 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/client.js +++ b/gnunet-build/packages/gnunet/gnunet/files/client.js @@ -47,8 +47,13 @@ mergeInto(LibraryManager.library, { if (typeof client_connect == "function") client_connect(service_name, channel.port2); else - gnunet_web.service.client_connect(service_name, "client.js", - channel.port2); + try { + gnunet_web.service.client_connect(service_name, "client.js", + channel.port2); + } catch(e) { + console.error("Failed to connect to " + service_name, e); + return 0; + } return port; }, GNUNET_CLIENT_disconnect__deps: ['$CLIENT_PORTS'], diff --git a/src/hl/index.cljs.hl b/src/hl/index.cljs.hl index aad44f0..5310a46 100644 --- a/src/hl/index.cljs.hl +++ b/src/hl/index.cljs.hl @@ -33,7 +33,13 @@ (js/MessageChannel.) (catch :default e (reset! browser-support - "Your browser does not support MessageChannel. This website will not work."))) + "This website requires MessageChannel support. Try Chromium or Google Chrome."))) + +(try + (js/SharedWorker.) + (catch :default e + (reset! browser-support + "This website requires SharedWorker support. Try Chromium or Google Chrome."))) (defn peer-id-short [peer] @@ -129,8 +135,12 @@ (recur)))))) (.readAsArrayBuffer reader file))) -(def topology-worker (service/start-worker "topology" +(try + (def topology-worker (service/start-worker "topology" "js/gnunet-daemon-topology.js")) + (catch :default e + nil)) + (hostlist/fetch-and-process!) (defelem ui-search |