diff --git a/node_modules/vfs-http-adapter/restful.js b/node_modules/vfs-http-adapter/restful.js index 2d6c53eb..ecf7ae88 100644 --- a/node_modules/vfs-http-adapter/restful.js +++ b/node_modules/vfs-http-adapter/restful.js @@ -39,7 +39,7 @@ module.exports = function setup(mount, vfs, mountOptions) { if (path) { entry.href = path + entry.name; var mime = entry.linkStat ? entry.linkStat.mime : entry.mime; - if (mime && mime.match(/(directory|folder)$/)) { + if (/(directory|folder)$/.test(mime)) { entry.href += "/"; } } diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index 68b50bdf..c53c1ad4 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -9,7 +9,15 @@ var pathBasename = require("path").basename; var dirname = require("path").dirname; var basename = require("path").basename; var Stream = require("stream").Stream; -var getMime = require("simple-mime")("application/octet-stream"); +var getMime = (function(simpleMime) { + // workaround for a bug in simple-mime + return function(path) { + var mime = simpleMime(path); + if (typeof mime != "string") + return "application/octet-stream" + return mime; + } +})(require("simple-mime")()); var vm = require("vm"); var exists = fs.exists || require("path").exists; var crypto = require("crypto"); diff --git a/plugins/c9.core/util.js b/plugins/c9.core/util.js index 34f17ae2..d941dc3a 100644 --- a/plugins/c9.core/util.js +++ b/plugins/c9.core/util.js @@ -30,85 +30,43 @@ define(function(require, exports, module) { return '"' + name + '"'; }; - var SupportedIcons = { - "c9search": "page_white_magnify", - "js": "page_white_code", - "jsx": "page_white_code_red", - "ts": "page_white_code", - "tsx": "page_white_code_red", - "json": "page_white_code", - "css": "css", - "scss": "css", - "sass": "css", - "less": "css", - "xml": "page_white_code_red", - "svg": "page_white_picture", - "php": "page_white_php", - "phtml": "page_white_php", - "html": "html", - "xhtml": "html", - "coffee": "page_white_cup", - "py": "page_white_code", - "go": "page_white_code", - "java": "page_white_cup", - "logic": "logiql", - "ru": "page_white_ruby", - "gemspec": "page_white_ruby", - "rake": "page_white_ruby", - "rb": "page_white_ruby", - "c": "page_white_c", - "cc": "page_white_c", - "cpp": "page_white_cplusplus", - "cxx": "page_white_c", - "h": "page_white_h", - "hh": "page_white_h", - "hpp": "page_white_h", - "bmp": "image", - "djv": "image", - "djvu": "image", - "gif": "image", - "ico": "image", - "jpeg": "image", - "jpg": "image", - "pbm": "image", - "pgm": "image", - "png": "image", - "pnm": "image", - "ppm": "image", - "psd": "image", - "svgz": "image", - "tif": "image", - "tiff": "image", - "xbm": "image", - "xpm": "image", - "pdf": "page_white_acrobat", - "clj": "page_white_code", - "ml": "page_white_code", - "mli": "page_white_code", - "cfm": "page_white_coldfusion", - "sql": "page_white_database", - "db": "page_white_database", - "sh": "page_white_wrench", - "bash": "page_white_wrench", - "xq": "page_white_code", - "xz": "page_white_zip", - "gz": "page_white_zip", - "bz": "page_white_zip", - "zip": "page_white_zip", - "tar": "page_white_zip", - "rar": "page_white_compressed", - "exe": "page_white_swoosh", - "o": "page_white_swoosh", - "lnk": "page_white_swoosh", - "txt": "page_white_text", - "settings": "page_white_gear", - "run": "page_white_gear", - "build": "page_white_gear", - "gitignore": "page_white_gear", - "profile": "page_white_gear", - "bashrc": "page_white_gear", - }; - + var SupportedIcons = (function() { + var extToClass = Object.create(null); + var classToExt = { + "page_white_magnify": "c9search", + "page_white_code": ["clj", "go", "js", "json", "ml", "mli", "py", "ts", "xq"], + "page_white_code_red": ["jsx", "tsx", "xml"], + "css": ["css", "less", "sass", "scss"], + "page_white_picture": "svg", + "page_white_php": ["php", "phtml"], + "html": ["html", "xhtml"], + "page_white_cup": ["coffee", "java"], + "logiql": "logic", + "page_white_ruby": ["gemspec", "rake", "rb", "ru"], + "page_white_c": ["c", "cc", "cxx"], + "page_white_cplusplus": "cpp", + "page_white_h": ["h", "hh", "hpp"], + "image": ["bmp", "djv", "djvu", "gif", "ico", "jpeg", "jpg", "pbm", "pgm", "png", "pnm", "ppm", "psd", "svgz", "tif", "tiff", "xbm", "xpm"], + "page_white_acrobat": "pdf", + "page_white_coldfusion": "cfm", + "page_white_database": ["db", "sql"], + "page_white_wrench": ["bash", "sh"], + "page_white_zip": ["bz", "gz", "tar", "xz", "zip"], + "page_white_compressed": "rar", + "page_white_swoosh": ["exe", "lnk", "o", "bin", "class"], + "page_white_text": "txt", + "page_white_gear": ["bashrc", "build", "gitignore", "profile", "run", "settings"] + }; + Object.keys(classToExt).forEach(function(k) { + var exts = classToExt[k]; + if (typeof exts == "string") + exts = [exts]; + exts.forEach(function(ext) { + extToClass[ext] = k; + }); + }); + return extToClass; + })(); plugin.getFileIcon = function(name) { var icon = "page_white_text"; var ext; diff --git a/plugins/c9.fs/fs.cache.xml.js b/plugins/c9.fs/fs.cache.xml.js index 32cf2ca1..bc68d3ef 100644 --- a/plugins/c9.fs/fs.cache.xml.js +++ b/plugins/c9.fs/fs.cache.xml.js @@ -707,7 +707,7 @@ define(function(require, exports, module) { status: "pending", className: "projectRoot", isEditable: false, - map: {} + map: Object.create(null) }; var root = {}; root.map = Object.create(null); diff --git a/plugins/c9.fs/mock/__lookupSetter__ b/plugins/c9.fs/mock/__lookupSetter__ new file mode 100644 index 00000000..9cbe6ea5 --- /dev/null +++ b/plugins/c9.fs/mock/__lookupSetter__ @@ -0,0 +1 @@ +e \ No newline at end of file diff --git a/plugins/c9.fs/mock/__proto__ b/plugins/c9.fs/mock/__proto__ new file mode 100644 index 00000000..bb79ec2d --- /dev/null +++ b/plugins/c9.fs/mock/__proto__ @@ -0,0 +1 @@ +v \ No newline at end of file diff --git a/plugins/c9.fs/mock/constructor b/plugins/c9.fs/mock/constructor new file mode 100644 index 00000000..597a6db2 --- /dev/null +++ b/plugins/c9.fs/mock/constructor @@ -0,0 +1 @@ +i \ No newline at end of file diff --git a/plugins/c9.fs/mock/toString/toString b/plugins/c9.fs/mock/toString/toString new file mode 100644 index 00000000..e69de29b diff --git a/plugins/c9.fs/mock/toString/toString.__proto__ b/plugins/c9.fs/mock/toString/toString.__proto__ new file mode 100644 index 00000000..e69de29b diff --git a/plugins/c9.fs/mock/toString/toString.constructor b/plugins/c9.fs/mock/toString/toString.constructor new file mode 100644 index 00000000..e69de29b diff --git a/plugins/c9.fs/mock/valueOf b/plugins/c9.fs/mock/valueOf new file mode 100644 index 00000000..baf72b1d --- /dev/null +++ b/plugins/c9.fs/mock/valueOf @@ -0,0 +1 @@ +l \ No newline at end of file diff --git a/plugins/c9.vfs.client/vfs_client.js b/plugins/c9.vfs.client/vfs_client.js index da0b3c38..0fd09d42 100644 --- a/plugins/c9.vfs.client/vfs_client.js +++ b/plugins/c9.vfs.client/vfs_client.js @@ -209,6 +209,7 @@ define(function(require, exports, module) { } function reconnect(callback) { + if (!connection) return; connection.socket.setSocket(null); vfsEndpoint.get(protocolVersion, function(err, urls) { @@ -336,6 +337,11 @@ define(function(require, exports, module) { plugin.on("unload", function(){ loaded = false; + if (consumer) + consumer.disconnect(); + if (connection) + connection.disconnect(); + id = null; buffer = []; region = null; @@ -346,6 +352,7 @@ define(function(require, exports, module) { serviceUrl = null; eioOptions = null; consumer = null; + connection = null; vfs = null; showErrorTimer = null; showErrorTimerMessage = null; diff --git a/plugins/c9.vfs.standalone/www/test.html b/plugins/c9.vfs.standalone/www/test.html index cfc89979..b4c1320e 100644 --- a/plugins/c9.vfs.standalone/www/test.html +++ b/plugins/c9.vfs.standalone/www/test.html @@ -271,6 +271,7 @@ return cb(); setTimeout.paused = true; window.app.services.vfs.connection.disconnect(); + window.app.services["vfs.endpoint"].clearCache(); setTimeout.force(function() { setTimeout.paused = false; setTimeout.clear();