summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2019-08-26 11:09:35 -0700
committerGunnar Mills <gmills@us.ibm.com>2019-09-04 20:18:32 +0000
commitfa8697b330ab85059f959daa9535f887a578a2c1 (patch)
tree81e286b6503a8d1f456948710bab219ce6910a65
parentc799714db9e2696fc93242df5855e9b3266236c4 (diff)
downloadphosphor-webui-fa8697b330ab85059f959daa9535f887a578a2c1.tar.gz
phosphor-webui-fa8697b330ab85059f959daa9535f887a578a2c1.zip
Fix SoL open in new tab Safari bug
Wrapped WebSocket constructor in try/catch block to avoid compile errors in controller. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I38fbc1e5898b0b70d8a16e3f16a244e04e18347e
-rw-r--r--app/common/directives/serial-console.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/app/common/directives/serial-console.js b/app/common/directives/serial-console.js
index 4324708..27917a5 100644
--- a/app/common/directives/serial-console.js
+++ b/app/common/directives/serial-console.js
@@ -91,16 +91,20 @@ window.angular && (function(angular) {
term.setOption('theme', SOL_THEME);
var hostname = dataService.getHost().replace('https://', '');
var host = 'wss://' + hostname + '/console0';
- var ws = new WebSocket(host);
- term.attach(ws);
- ws.onopen = function() {
- console.log('websocket opened');
- };
- ws.onclose = function(event) {
- console.log(
- 'websocket closed. code: ' + event.code +
- ' reason: ' + event.reason);
- };
+ try {
+ var ws = new WebSocket(host);
+ term.attach(ws);
+ ws.onopen = function() {
+ console.log('websocket opened');
+ };
+ ws.onclose = function(event) {
+ console.log(
+ 'websocket closed. code: ' + event.code +
+ ' reason: ' + event.reason);
+ };
+ } catch (error) {
+ console.log(JSON.stringify(error));
+ }
$scope.openTerminalWindow = function() {
$window.open(
'#/server-control/remote-console-window',
OpenPOWER on IntegriCloud