kopia lustrzana https://github.com/c9/core
Merge remote-tracking branch 'origin/master' into fix/engineio-upgrade
Conflicts: npm-shrinkwrap.jsonpull/39/head
commit
2cd16eacf7
|
@ -33,7 +33,6 @@ module.exports = function(config, optimist) {
|
|||
.describe("hosted", "Use default config of the hosted version")
|
||||
.default("hosted", false)
|
||||
.describe("auth", "Basic Auth username:password")
|
||||
.default("auth", ":")
|
||||
.describe("collab", "Whether to enable collab.")
|
||||
.default("collab", config.collab)
|
||||
.describe("cache", "use cached version of cdn files")
|
||||
|
@ -90,7 +89,12 @@ module.exports = function(config, optimist) {
|
|||
if (testing && argv.k)
|
||||
require("child_process").exec("tmux -L cloud91.9 kill-server", function(){});
|
||||
|
||||
var auth = argv.auth.split(":");
|
||||
var isLocalhost = host == "localhost" || host == "127.0.0.1";
|
||||
if (argv.auth !== ":" && !isLocalhost) {
|
||||
console.log("Authentication is required when not running on localhost.\nPlease use -a user:pass or --listen localhost to listen locally.");
|
||||
process.exit(255);
|
||||
}
|
||||
var auth = (argv.auth || ":").split(":");
|
||||
|
||||
var plugins = [
|
||||
{
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
module.exports = function (callback) {
|
||||
var start = Date.now();
|
||||
// setInterval is handled after setImmediate and setTimeout handlers
|
||||
var interval = setTimeout(function () {
|
||||
clearInterval(interval);
|
||||
var took = Date.now() - start;
|
||||
return callback(took);
|
||||
}, 0);
|
||||
};
|
|
@ -0,0 +1,60 @@
|
|||
"use strict";
|
||||
"use server";
|
||||
|
||||
var assert = require("assert");
|
||||
var blocked = require("./blocked");
|
||||
|
||||
module.exports = {
|
||||
|
||||
"test normal run should return low blocked time": function(next) {
|
||||
blocked(function(time) {
|
||||
assert(time < 10);
|
||||
next();
|
||||
});
|
||||
},
|
||||
"test busy loop should report high blocked time": function(next) {
|
||||
blocked(function(time) {
|
||||
assert(time >= 100);
|
||||
next();
|
||||
});
|
||||
|
||||
var start = Date.now();
|
||||
while (Date.now() - start < 100) {}
|
||||
},
|
||||
"test busy loop in setTimeout should report high blocked time": function(next) {
|
||||
setTimeout(function() {
|
||||
var start = Date.now();
|
||||
while (Date.now() - start < 100) {}
|
||||
}, 0);
|
||||
|
||||
blocked(function(time) {
|
||||
assert(time >= 100);
|
||||
next();
|
||||
});
|
||||
},
|
||||
"test busy loop in setInterval should report high blocked time": function(next) {
|
||||
var interval = setInterval(function() {
|
||||
clearInterval(interval);
|
||||
var start = Date.now();
|
||||
while (Date.now() - start < 100) {}
|
||||
});
|
||||
|
||||
blocked(function(time) {
|
||||
assert(time >= 100);
|
||||
next();
|
||||
});
|
||||
},
|
||||
"test busy loop in setImmediate should report high blocked time": function(next) {
|
||||
setImmediate(function() {
|
||||
var start = Date.now();
|
||||
while (Date.now() - start < 100) {}
|
||||
});
|
||||
|
||||
blocked(function(time) {
|
||||
assert(time >= 100);
|
||||
next();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
!module.parent && require("asyncjs").test.testcase(module.exports).exec();
|
|
@ -58,7 +58,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
"test get head revision sync": function(next) {
|
||||
var rev = git.getHeadRevisionSync(__dirname + "/../");
|
||||
var rev = git.getHeadRevisionSync(__dirname + "/../../");
|
||||
assert.equal(rev.length, 40);
|
||||
|
||||
next();
|
||||
|
@ -70,6 +70,6 @@ module.exports = {
|
|||
next();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
!module.parent && require("asyncjs").test.testcase(module.exports).exec();
|
||||
|
|
|
@ -1,30 +1,14 @@
|
|||
/*global describe it before after beforeEach afterEach define*/
|
||||
"use strict";
|
||||
"use client";
|
||||
"use server";
|
||||
"use mocha";
|
||||
|
||||
// Test flags
|
||||
//
|
||||
// "use root"; the unit test will be executed as root (using sudo); use with care! (ex. back-up / restore tests)
|
||||
// "use non-osx"; test will be skipped if the operating system is Mac OS
|
||||
// "use server"; tests are supposed to run on server-side (either with node or mocha)
|
||||
// "use client"; tests are run by means of Selenium on client side
|
||||
// "use mocha"; tests can be run by mocha or by node; this label indicates needs be run using mocha.
|
||||
require("c9/inline-mocha")(module);
|
||||
|
||||
if (typeof define === "undefined") {
|
||||
require("c9/inline-mocha")(module);
|
||||
require("amd-loader");
|
||||
require("../../test/setup_paths");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var assert = require("ace/test/assertions");
|
||||
var assert = require("assert");
|
||||
var passcrypt = require('./passcrypt');
|
||||
var bcrypt = require('bcrypt');
|
||||
|
||||
|
||||
describe("c9/passcrypt", function(){
|
||||
this.timeout(2000);
|
||||
|
||||
|
@ -78,6 +62,4 @@ describe("c9/passcrypt", function(){
|
|||
});
|
||||
});
|
||||
|
||||
if (typeof onload !== "undefined")
|
||||
onload();
|
||||
});
|
||||
if (typeof onload !== "undefined") onload();
|
||||
|
|
|
@ -59,8 +59,8 @@
|
|||
"c9.ide.language.javascript.eslint": "#cf4b2d05af",
|
||||
"c9.ide.language.javascript.tern": "#a65ad88dd9",
|
||||
"c9.ide.language.javascript.infer": "#702bbd4dcd",
|
||||
"c9.ide.language.jsonalyzer": "#eaf8152b03",
|
||||
"c9.ide.collab": "#d07855bac7",
|
||||
"c9.ide.language.jsonalyzer": "#722983bf96",
|
||||
"c9.ide.collab": "#13fe5c8f27",
|
||||
"c9.ide.local": "#2bfd7ff051",
|
||||
"c9.ide.find": "#989c06e6a7",
|
||||
"c9.ide.find.infiles": "#28b3cfcb47",
|
||||
|
|
|
@ -79,9 +79,6 @@ define(function(require, module, exports) {
|
|||
var widths = options.widths || {};
|
||||
var count = 0;
|
||||
|
||||
if (custom === undefined)
|
||||
custom = !(body || heading);
|
||||
|
||||
var dialog, buttons, titles;
|
||||
|
||||
var loaded;
|
||||
|
@ -183,7 +180,8 @@ define(function(require, module, exports) {
|
|||
implementation();
|
||||
|
||||
// Update UI
|
||||
if (!custom && (heading || body)) {
|
||||
var custom = options.custom || !(heading || body);
|
||||
if (!custom) {
|
||||
titles.$int.innerHTML = "<h3 style='margin:0 0 10px 0'>"
|
||||
+ heading + "</h3><div class='alertMsg'>"
|
||||
+ body + "</div>";
|
||||
|
|
|
@ -256,19 +256,21 @@ define(function(require, exports, module) {
|
|||
function bindKey(key, command, asDefault) {
|
||||
removeCommand(command, null, true);
|
||||
|
||||
if (!key || !command)
|
||||
if (!command)
|
||||
return;
|
||||
|
||||
command.bindKey = {
|
||||
position: command.originalBindKey.position
|
||||
};
|
||||
if (typeof key == "string" || !key) {
|
||||
command.bindKey = {};
|
||||
command.bindKey[commandManager.platform] = key;
|
||||
} else
|
||||
command.bindKey = key;
|
||||
|
||||
command.bindKey[commandManager.platform] = key;
|
||||
if (command.bindKey.position == undefined)
|
||||
command.bindKey.position = command.originalBindKey.position;
|
||||
|
||||
commandManager.bindKey(key, command, asDefault);
|
||||
|
||||
plugin.commandManager
|
||||
.setProperty(command.name, key);
|
||||
commandManager.bindKey(command.bindKey, command, asDefault);
|
||||
plugin.commandManager.setProperty(command.name,
|
||||
command.bindKey[commandManager.platform]);
|
||||
}
|
||||
|
||||
function findKey(key, scope) {
|
||||
|
@ -291,11 +293,7 @@ define(function(require, exports, module) {
|
|||
|
||||
Object.keys(commands).forEach(function(name) {
|
||||
var cmd = commands[name];
|
||||
var key = cmd.bindKey && cmd.bindKey[platform];
|
||||
if (key)
|
||||
bindKey(key, cmd);
|
||||
else
|
||||
delete plugin.commandManager[name];
|
||||
bindKey(cmd.originalBindKey, cmd);
|
||||
});
|
||||
|
||||
if (noReload)
|
||||
|
|
|
@ -173,6 +173,8 @@ define(function(require, exports, module) {
|
|||
"By resetting your keybindings to their "
|
||||
+ "defaults you will lose all custom keybindings.",
|
||||
function(){
|
||||
settings.set("user/ace/@keyboardmode", "default");
|
||||
settings.set("user/key-bindings/@platform", "auto");
|
||||
reset();
|
||||
}, function(){});
|
||||
},
|
||||
|
|
|
@ -932,6 +932,7 @@ define(function(require, exports, module) {
|
|||
plugin.on("load", function(){
|
||||
aml = new ui.menu({
|
||||
id: options.id,
|
||||
zindex: options.zindex,
|
||||
"onprop.visible" : function(e) {
|
||||
emit(e.value ? "show" : "hide", lastCoords);
|
||||
checkItems.call(this, e);
|
||||
|
@ -1032,6 +1033,12 @@ define(function(require, exports, module) {
|
|||
* @readonly
|
||||
*/
|
||||
get visible(){ return aml.visible; },
|
||||
/**
|
||||
* Specifies the zindex of the menu
|
||||
* @property {Number} zindex
|
||||
*/
|
||||
get zindex(){ return aml && ui.getStyle(aml.$ext, "z-index"); },
|
||||
set zindex(value) { aml && aml.setAttribute("zindex", value); },
|
||||
/**
|
||||
* The menu items appended to this menu
|
||||
* @property {MenuItem[]} items
|
||||
|
|
|
@ -122,8 +122,6 @@ define(function(require, exports, module) {
|
|||
}
|
||||
|
||||
var url = server + "/" + req.projectSession.pid + "/preview";
|
||||
if (req.session.token)
|
||||
url += "?access_token=" + encodeURIComponent(req.session.token);
|
||||
|
||||
req.proxyUrl = url;
|
||||
next();
|
||||
|
@ -135,6 +133,8 @@ define(function(require, exports, module) {
|
|||
|
||||
var path = req.params.path;
|
||||
var url = req.proxyUrl + path;
|
||||
if (req.session.token)
|
||||
url += "?access_token=" + encodeURIComponent(req.session.token);
|
||||
|
||||
var parsedUrl = parseUrl(url);
|
||||
var httpModule = parsedUrl.protocol == "https:" ? https : http;
|
||||
|
|
|
@ -146,7 +146,7 @@ Vfs.prototype._createEngine = function(vfs, options) {
|
|||
var that = this;
|
||||
|
||||
var engine = new eio.Server({
|
||||
pingTimeout: 3000,
|
||||
pingTimeout: 5000,
|
||||
pingInterval: 15000,
|
||||
transports: ["polling", "websocket"],
|
||||
allowUpgrades: true,
|
||||
|
|
|
@ -67,18 +67,24 @@ function main(config, settings, options, callback) {
|
|||
compress: options.compress,
|
||||
virtual: options.virtual
|
||||
})
|
||||
.concat({
|
||||
consumes: [],
|
||||
provides: ["cdn.build", "db"],
|
||||
setup: function(options, imports, register) {
|
||||
register(null, { "cdn.build": {}, "db": {} });
|
||||
}
|
||||
})
|
||||
.filter(function(p) {
|
||||
var path = p.packagePath;
|
||||
return !path || path.indexOf("c9.db.redis/redis") == -1
|
||||
&& path.indexOf("c9.static/build") == -1
|
||||
&& path.indexOf("c9.api/health") == -1;
|
||||
})
|
||||
.concat({
|
||||
consumes: [],
|
||||
provides: ["cdn.build", "db", "health"],
|
||||
setup: function(options, imports, register) {
|
||||
register(null, {
|
||||
"cdn.build": {},
|
||||
"db": {},
|
||||
"health": {
|
||||
addCheck: function() {}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue