diff --git a/lib/ace/worker/worker.js b/lib/ace/worker/worker.js index 295f90b3..b4c86649 100644 --- a/lib/ace/worker/worker.js +++ b/lib/ace/worker/worker.js @@ -56,6 +56,10 @@ require.tlns = {}; var define = function(id, deps, factory) { if (arguments.length == 2) { factory = deps; + if (typeof id != "string") { + deps = id; + id = require.id; + } } else if (arguments.length == 1) { factory = id; id = require.id; @@ -135,4 +139,7 @@ onmessage = function(e) { else if (msg.event && sender) { sender._emit(msg.event, msg.data); } + if (msg.eval) { + console.log(eval(msg.eval)); + } }; diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js index 0ec7a6a3..ed1ada78 100644 --- a/lib/ace/worker/worker_client.js +++ b/lib/ace/worker/worker_client.js @@ -114,6 +114,8 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) { oop.implement(this, EventEmitter); this.$normalizePath = function(path) { + if (!location.host) // needed for file:// protocol + return path; path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it path = location.protocol + "//" + location.host // paths starting with a slash are relative to the root (host)