Merge pull request +14519 from c9/ide-fix-various

Fix two small issues
pull/330/head
Harutyun Amirjanyan 2016-07-14 00:11:04 +04:00 zatwierdzone przez GitHub
commit a74b72c2ec
3 zmienionych plików z 18 dodań i 6 usunięć

Wyświetl plik

@ -393,8 +393,6 @@ var loadScriptWithTag = function(path, id, callback) {
if (path.lastIndexOf(require.MODULE_LOAD_URL, 0) == 0 && path[0] != "/") if (path.lastIndexOf(require.MODULE_LOAD_URL, 0) == 0 && path[0] != "/")
s.crossOrigin = true; s.crossOrigin = true;
head.appendChild(s);
s.onload = s.onreadystatechange = function(_, isAbort) { s.onload = s.onreadystatechange = function(_, isAbort) {
if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") { if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
s = s.onload = s.onreadystatechange = null; s = s.onload = s.onreadystatechange = null;
@ -409,6 +407,7 @@ var loadScriptWithTag = function(path, id, callback) {
path: path path: path
}); });
}; };
head.appendChild(s);
}; };
function loadText(path, cb) { function loadText(path, cb) {
@ -468,6 +467,9 @@ var loadCached = function(path, cb) {
} }
}); });
} }
if (!ideCache && !ideCachePromiss) {
checkCache();
}
if (ideCachePromiss) { if (ideCachePromiss) {
return ideCachePromiss.then(function(i) { return ideCachePromiss.then(function(i) {
if (i) ideCache = i; if (i) ideCache = i;
@ -494,7 +496,10 @@ var ideCache;
var ideCachePromiss; var ideCachePromiss;
function checkCache() { function checkCache() {
var baseUrl; var baseUrl;
ideCachePromiss = config.useCache && window.caches.open("ide").then(function(ideCache_) { ideCachePromiss = config.useCache && window.caches.open("ide").catch(function(e) {
console.error(e);
config.useCache = ideCachePromiss = ideCache = null;
}).then(function(ideCache_) {
ideCache = ideCache_; ideCache = ideCache_;
return ideCache.keys(); return ideCache.keys();
}).then(function(keys) { }).then(function(keys) {
@ -557,7 +562,7 @@ require.clearCache = function(callback) {
callback && callback(e); callback && callback(e);
}); });
}); });
} };
function post(path, val, progress, cb) { function post(path, val, progress, cb) {
var xhr = new window.XMLHttpRequest(); var xhr = new window.XMLHttpRequest();

Wyświetl plik

@ -3,6 +3,7 @@ module.exports = function (vfs, options, register) {
var net = require("net"); var net = require("net");
var Stream = require('stream'); var Stream = require('stream');
var path = require("path");
var SOCKET = process.platform == "win32" var SOCKET = process.platform == "win32"
? "\\\\.\\pipe\\.c9\\bridge.socket" ? "\\\\.\\pipe\\.c9\\bridge.socket"
@ -74,7 +75,6 @@ module.exports = function (vfs, options, register) {
clients.push(client); clients.push(client);
} }
api
var clients = []; var clients = [];
var stream = new Stream(); var stream = new Stream();
stream.readable = true; stream.readable = true;
@ -89,10 +89,17 @@ module.exports = function (vfs, options, register) {
var unixServer = net.createServer(registerClient); var unixServer = net.createServer(registerClient);
unixServer.listen(SOCKET); unixServer.listen(SOCKET);
var socketDirExists = false;
unixServer.on("error", function(err){ unixServer.on("error", function(err){
if (err.code == "EADDRINUSE") { if (err.code == "EADDRINUSE") {
createListenClient(api); createListenClient(api);
} }
else if (err.code == "EACCES" && !socketDirExists) {
vfs.mkdirP(path.dirname(SOCKET), {}, function() {
socketDirExists = true;
unixServer.listen(SOCKET);
});
}
else else
api.onError(err); api.onError(err);
}); });

Wyświetl plik

@ -251,7 +251,7 @@ define(function(require, exports, module) {
fsCache.model.getTooltipText = function(node) { fsCache.model.getTooltipText = function(node) {
var size = node.size; var size = node.size;
return node.label + (node.link ? " => " + node.link + "\n" : "") return (node.label || node.path) + (node.link ? " => " + node.link + "\n" : "")
+ (size != undefined && !node.isFolder ? " | " + ( + (size != undefined && !node.isFolder ? " | " + (
size < 0x400 ? size + " bytes" : size < 0x400 ? size + " bytes" :
size < 0x100000 ? (size / 0x400).toFixed(2) + "KB" : size < 0x100000 ? (size / 0x400).toFixed(2) + "KB" :