diff --git a/lib/ace/worker/worker.js b/lib/ace/worker/worker.js index 295f90b3..2e1853df 100644 --- a/lib/ace/worker/worker.js +++ b/lib/ace/worker/worker.js @@ -35,8 +35,8 @@ var require = function(parentId, id) { var module = require.modules[id]; if (module) { if (!module.initialized) { - module.exports = module.factory().exports; module.initialized = true; + module.exports = module.factory().exports; } return module.exports; } @@ -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; 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)