From 2bccb3c06c864450929d0e819a190009265987a1 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 24 Apr 2017 01:39:54 +0400 Subject: [PATCH 1/3] restore browser version detection in apf --- plugins/c9.ide.ui/lib_apf.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/c9.ide.ui/lib_apf.js b/plugins/c9.ide.ui/lib_apf.js index 8962536d..ae4b71ce 100644 --- a/plugins/c9.ide.ui/lib_apf.js +++ b/plugins/c9.ide.ui/lib_apf.js @@ -310,6 +310,12 @@ function(require, module, exports) { this.isLinux = Browser.Platform.linux; this.isIphone = Browser.Platform.ios || UA.indexOf("aspen simulator") != -1; + this.versionWebkit = this.isWebkit ? Browser.version : null; + this.versionGecko = this.isGecko ? Browser.version : null; + this.versionFF = this.isGecko ? Browser.version : null; + this.versionSafari = this.isSafari ? Browser.version : null; + this.versionChrome = this.isChrome ? Browser.version : null; + this.versionOpera = this.isOpera ? Browser.version : null; }, /** From bb1784f8ed33af1d74b292a300518db42550b699 Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 24 Apr 2017 17:29:11 +0400 Subject: [PATCH 2/3] warn about safari 10.1 bug --- plugins/c9.vfs.client/vfs_client.js | 14 +++++++++++++- plugins/c9.vfs.standalone/www/test.js | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/c9.vfs.client/vfs_client.js b/plugins/c9.vfs.client/vfs_client.js index 7a0c9252..7a8bed61 100644 --- a/plugins/c9.vfs.client/vfs_client.js +++ b/plugins/c9.vfs.client/vfs_client.js @@ -3,7 +3,7 @@ define(function(require, exports, module) { main.consumes = [ "Plugin", "auth", "vfs.endpoint", "dialog.error", - "dialog.alert", "error_handler", "metrics" + "dialog.alert", "error_handler", "metrics", "apf" ]; main.provides = ["vfs"]; return main; @@ -32,6 +32,7 @@ define(function(require, exports, module) { var showAlert = imports["dialog.alert"].show; var errorHandler = imports.error_handler; var metrics = imports.metrics; + var apf = imports.apf; var eio = require("engine.io"); var Consumer = require("vfs-socket/consumer").Consumer; @@ -137,6 +138,8 @@ define(function(require, exports, module) { }); } } + + plugin.once("connect", warnBrokenSafariVersion); } /***** Methods *****/ @@ -279,6 +282,15 @@ define(function(require, exports, module) { console.error("Fatal connection error:", err); } + function warnBrokenSafariVersion() { + if (apf.isSafari && apf.versionSafari == "10.1") { + showAlert("Broken Browser Version Detected", "Websockets are broken in Safari version 10.1.", + "Due to https://bugs.webkit.org/show_bug.cgi?id=170463, websockets do not work well on this browser version. " + + " Please use Chrome, 'Safari Technology Preview' or another browser " + + " until the Safari updates to version 10.2."); + } + } + function onDisconnect() { vfs = null; emit("disconnect"); diff --git a/plugins/c9.vfs.standalone/www/test.js b/plugins/c9.vfs.standalone/www/test.js index ddd04b35..b38c4cdf 100644 --- a/plugins/c9.vfs.standalone/www/test.js +++ b/plugins/c9.vfs.standalone/www/test.js @@ -90,6 +90,7 @@ require([ x.connected = true; return x; })(), + apf: {}, vfs: (function() { var x = new EventEmitter(); return x; From 333d1813642c939a3e14a41f7909235b56f08a73 Mon Sep 17 00:00:00 2001 From: Harutyun Amirjanyan Date: Mon, 24 Apr 2017 18:05:28 +0400 Subject: [PATCH 3/3] improve wording of the error message --- plugins/c9.vfs.client/vfs_client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/c9.vfs.client/vfs_client.js b/plugins/c9.vfs.client/vfs_client.js index 7a8bed61..2ad7b669 100644 --- a/plugins/c9.vfs.client/vfs_client.js +++ b/plugins/c9.vfs.client/vfs_client.js @@ -285,7 +285,8 @@ define(function(require, exports, module) { function warnBrokenSafariVersion() { if (apf.isSafari && apf.versionSafari == "10.1") { showAlert("Broken Browser Version Detected", "Websockets are broken in Safari version 10.1.", - "Due to https://bugs.webkit.org/show_bug.cgi?id=170463, websockets do not work well on this browser version. " + "Due to https://bugs.webkit.org/show_bug.cgi?id=170463, websockets do not work well" + + " on this browser version which may result in frequent disconnects from the service." + " Please use Chrome, 'Safari Technology Preview' or another browser " + " until the Safari updates to version 10.2."); } @@ -470,4 +471,4 @@ define(function(require, exports, module) { "vfs": plugin }); } -}); \ No newline at end of file +});