diff --git a/plugins/c9.fs/fs.streams.js b/plugins/c9.fs/fs.streams.js
index d2d8e609..1793144b 100644
--- a/plugins/c9.fs/fs.streams.js
+++ b/plugins/c9.fs/fs.streams.js
@@ -7,7 +7,7 @@ return function(vfs, base, baseProc, cli) {
var resolvePath = function(path, basePath) {
if (path.charAt(0) == "~") {
- if (cli && typeof process != "undefined")
+ if (cli && typeof process != "undefined" && process.env)
return process.env.HOME + "/" + path.substr(1);
return path;
}
diff --git a/plugins/c9.ide.ace.keymaps/keymaps.js b/plugins/c9.ide.ace.keymaps/keymaps.js
index f8f3ca88..52282e78 100644
--- a/plugins/c9.ide.ace.keymaps/keymaps.js
+++ b/plugins/c9.ide.ace.keymaps/keymaps.js
@@ -173,7 +173,7 @@ define(function(require, exports, module) {
}
function normalize(str) {
- return str && str.replace(/(^|-| )(\w)/g, function(_, a, b) {
+ return str && str.replace(/(^|-| |\|)(\w)/g, function(_, a, b) {
return a + b.toUpperCase();
});
}
diff --git a/plugins/c9.ide.ace.keymaps/sublime/keymap.js b/plugins/c9.ide.ace.keymaps/sublime/keymap.js
index abe92e0f..bb969add 100644
--- a/plugins/c9.ide.ace.keymaps/sublime/keymap.js
+++ b/plugins/c9.ide.ace.keymaps/sublime/keymap.js
@@ -57,24 +57,14 @@ exports.ideKeymap = [
bindKey: { mac: "cmd-t|cmd-p", win: "ctrl-p" },
name: "navigate"
}, {
- bindKey: { mac: "cmd-r", win: "ctrl-r" },
+ bindKey: { mac: "cmd-r|cmd-shift-r", win: "ctrl-r|ctrl-shift-r" },
name: "outline",
args: { overlay: "goto", text: "@" }
-}, {
- bindKey: { mac: "cmd-shift-r", win: "ctrl-shift-r" },
- // todo: this should be project outline
- name: "outline"
}, {
bindKey: { mac: "ctrl-g", win: "ctrl-g" },
name: "gotoline",
args: { overlay: "goto", text: ":" }
-},
-// todo what is this?
-// {
-// bindKey: {win: "ctrl-;"},
-// name: "show_overlay",
-// args: {overlay: "goto", text: "#"}
-// },
+},
{
bindKey: { mac: "cmd-shift-p", win: "ctrl-shift-p" },
name: "commands"
@@ -358,6 +348,9 @@ exports.ideKeymap = [
}, {
bindKey: { mac: "cmd-shift-f", win: "ctrl-shift-f" },
name: "searchinfiles",
+}, {
+ bindKey: { mac: "", win: "" },
+ name: "restartc9",
},
// {
// bindKey: {mac: "f4", win: "f4"},
diff --git a/plugins/c9.ide.immediate/evaluators/browserjs.js b/plugins/c9.ide.immediate/evaluators/browserjs.js
index bbf8455d..5c78fae2 100644
--- a/plugins/c9.ide.immediate/evaluators/browserjs.js
+++ b/plugins/c9.ide.immediate/evaluators/browserjs.js
@@ -21,6 +21,8 @@ define(function(require, exports, module) {
var Evaluator = imports.Evaluator;
var ui = imports.ui;
+ var escapeHTML = require("ace/lib/lang").escapeHTML;
+
/***** Initialization *****/
var plugin = new Evaluator("Ajax.org", main.consumes, {
@@ -108,7 +110,7 @@ define(function(require, exports, module) {
function insert(div, markup, name) {
if (name !== undefined)
- insert(div, "" + name + ": ");
+ insert(div, "" + escapeHTML(name) + ": ");
markup = markup.replace(/([a-z]\w{1,4}:\/\/[\w:_\-\?&\/\.\#]*)/gi, "$1");
div.insertAdjacentHTML("beforeend", markup);
@@ -279,7 +281,7 @@ define(function(require, exports, module) {
var count = Math.min(Math.min(props.length, 5),
Math.max(0, 100 - object.length));
for (var i = 0; i < count; i++) {
- insert(preview, (found || i !== 0 ? ", " : "") + props[i] + ": ");
+ insert(preview, (found || i !== 0 ? ", " : "") + escapeHTML(props[i]) + ": ");
renderType(object[props[i]], preview, false, 2);
}
if (props.length > count)
diff --git a/plugins/c9.ide.immediate/evaluators/debugnode.js b/plugins/c9.ide.immediate/evaluators/debugnode.js
index 778f63ac..9da0d46d 100644
--- a/plugins/c9.ide.immediate/evaluators/debugnode.js
+++ b/plugins/c9.ide.immediate/evaluators/debugnode.js
@@ -113,7 +113,7 @@ define(function(require, exports, module) {
function insert(div, markup, name) {
if (name !== undefined)
- insert(div, "" + name + ": ");
+ insert(div, "" + escapeHTML(name) + ": ");
markup = markup.replace(/([a-z]\w{1,4}:\/\/[\w:_\-\?&\/\.\#]*)/gi, "$1");
div.insertAdjacentHTML("beforeend", markup);
@@ -319,7 +319,7 @@ define(function(require, exports, module) {
var count = Math.min(Math.min(props.length, 5),
Math.max(0, 100 - object.length));
for (var i = 0; i < count; i++) {
- insert(preview, (i !== 0 ? ", " : "") + props[i] + ": ");
+ insert(preview, (i !== 0 ? ", " : "") + escapeHTML(props[i]) + ": ");
renderType(props[i], preview, false, 2);
}
if (props.length > count)
diff --git a/plugins/c9.ide.language.core/outline.js b/plugins/c9.ide.language.core/outline.js
index 74c7befc..859486b3 100644
--- a/plugins/c9.ide.language.core/outline.js
+++ b/plugins/c9.ide.language.core/outline.js
@@ -653,7 +653,11 @@ define(function(require, exports, module) {
/**
*
*/
- addOutlinePlugin: addOutlinePlugin
+ addOutlinePlugin: addOutlinePlugin,
+ /**
+ * @ignore
+ */
+ get tree() { return tree },
});
register(null, {
diff --git a/plugins/c9.ide.preview/preview_test.js b/plugins/c9.ide.preview/preview_test.js
new file mode 100644
index 00000000..c3492f88
--- /dev/null
+++ b/plugins/c9.ide.preview/preview_test.js
@@ -0,0 +1,139 @@
+/*global describe it before after bar*/
+
+"use client";
+
+require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) {
+ var expect = chai.expect;
+
+ expect.setupArchitectTest([
+ {
+ packagePath: "plugins/c9.core/c9",
+ workspaceId: "ubuntu/ip-10-35-77-180",
+ startdate: new Date(),
+ debug: true,
+ hosted: true,
+ local: false,
+ },
+
+ "plugins/c9.core/ext",
+ "plugins/c9.core/http-xhr",
+ "plugins/c9.core/util",
+ "plugins/c9.ide.ui/lib_apf",
+ "plugins/c9.ide.ui/menus",
+ {
+ packagePath: "plugins/c9.core/settings",
+ settings: "default",
+ testing: true
+ },
+ "plugins/c9.core/api.js",
+ {
+ packagePath: "plugins/c9.ide.ui/ui",
+ staticPrefix: "plugins/c9.ide.ui"
+ },
+ "plugins/c9.ide.editors/document",
+ "plugins/c9.ide.editors/undomanager",
+ {
+ packagePath: "plugins/c9.ide.editors/editors",
+ defaultEditor: "ace"
+ },
+ "plugins/c9.ide.editors/editor",
+ "plugins/c9.ide.editors/tabmanager",
+ "plugins/c9.ide.ui/focus",
+ "plugins/c9.ide.editors/pane",
+ "plugins/c9.ide.editors/tab",
+ "plugins/c9.ide.keys/commands",
+ "plugins/c9.fs/proc",
+ "plugins/c9.vfs.client/vfs_client",
+ "plugins/c9.vfs.client/endpoint",
+ "plugins/c9.ide.auth/auth",
+ "plugins/c9.fs/fs",
+
+ "plugins/c9.ide.dialog/dialog",
+ "plugins/c9.ide.dialog.common/alert",
+ "plugins/c9.ide.dialog.common/alert_internal",
+ // Previewer
+ {
+ packagePath: "plugins/c9.ide.preview/preview",
+ staticPrefix: "/static" + "/plugins/c9.ide.preview",
+ defaultPreviewer: "preview.browser",
+ previewUrl: "/preview",
+ },
+ "plugins/c9.ide.preview/previewer",
+ "plugins/c9.ide.preview/previewers/raw",
+ {
+ packagePath: "plugins/c9.ide.preview.browser/browser",
+ staticPrefix: "/static" + "/plugins/c9.ide.preview.browser"
+ },
+ {
+ packagePath: "plugins/c9.ide.preview.markdown/markdown",
+ staticPrefix: "/static",
+ htmlPath: "/plugins/c9.ide.preview.markdown/markdown.html",
+ },
+ "plugins/c9.ide.remote/manager",
+ "plugins/c9.ide.remote/documents/htmldocument",
+ "plugins/c9.ide.remote/documents/cssdocument",
+ "plugins/c9.ide.remote/documents/jsdocument",
+ {
+ packagePath: "plugins/c9.ide.remote/transports/postmessage",
+ // previewBaseUrl: options.previewBaseUrl
+ },
+
+ {
+ consumes: ["tabManager", "ace", "commands", "fs", "preview"],
+ provides: [],
+ setup: main
+ }
+ ], architect);
+
+ function main(options, imports, register) {
+ var fs = imports.fs;
+ var ace = imports.ace;
+ var tabs = imports.tabManager;
+ var preview = imports.preview;
+ var commands = imports.commands;
+
+ describe('ace', function() {
+ before(function(done) {
+ bar.$ext.style.background = "rgba(220, 220, 220, 0.93)";
+ bar.$ext.style.position = "fixed";
+ bar.$ext.style.left = "20px";
+ bar.$ext.style.width = "1000px";
+ bar.$ext.style.bottom = "20px";
+ bar.$ext.style.height = "33%";
+
+ document.body.style.marginBottom = "33%";
+
+ tabs.once("ready", function() {
+ tabs.getPanes()[0].focus();
+ done();
+ });
+ });
+
+ describe("open", function() {
+ this.timeout(10000);
+
+ it('should open html preview', function(done) {
+ fs.writeFile("/dir/preview.md", [
+ "ok",
+ "
"
+ ].join("\n"), function(err) {
+ expect(err).to.not.ok;
+ preview.openPreview("/dir/preview.md", null, true, function(err, tab) {
+ expect(err).to.not.ok;
+ done();
+ });
+ });
+ });
+ });
+
+ if (!onload.remain) {
+ after(function(done) {
+ tabs.unload();
+ done();
+ });
+ }
+ });
+
+ register();
+ }
+});
\ No newline at end of file
diff --git a/plugins/c9.ide.terminal/terminal_test.js b/plugins/c9.ide.terminal/terminal_test.js
index 3e712175..e13b3dc8 100644
--- a/plugins/c9.ide.terminal/terminal_test.js
+++ b/plugins/c9.ide.terminal/terminal_test.js
@@ -1,4 +1,4 @@
-/*global describe it before after bar =*/
+/*global describe it before after bar*/
"use client";
@@ -69,9 +69,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc
describe('terminal', function() {
before(function(done) {
- apf.config.setProperty("allow-select", false);
- apf.config.setProperty("allow-blur", false);
-
bar.$ext.style.background = "rgba(220, 220, 220, 0.93)";
bar.$ext.style.position = "fixed";
bar.$ext.style.left = "20px";
@@ -153,16 +150,24 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function (arc
it('should handle multiple terminals in the same pane', function(done) {
tabs.openEditor("terminal", function(err, tab) {
+ expect(err).to.not.ok;
expect(tabs.getTabs()).length(2);
tab.activate();
var doc = tab.document;
- doc.on("setTitle", function c1() {
- // expect(doc.title).match(new RegExp("^bash - "));
-
- doc.off("setTitle", c1);
- done();
+ doc.once("setTitle", function() {
+ var terminal = tab.editor.ace.session.term;
+ terminal.once("afterWrite", function() {
+ expect(window.xss).to.not.ok;
+ terminal.write("echo \"
\"");
+ tab.editor.ace.resize(true);
+ expect(tab.editor.ace.container.textContent.indexOf("