diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js index f024b274..1fba2f7e 100644 --- a/lib/ace/worker/worker_client.js +++ b/lib/ace/worker/worker_client.js @@ -103,8 +103,12 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) { oop.implement(this, EventEmitter); this.$normalizePath = function(path) { - if (!path.match(/^\w+:/)) - path = location.protocol + "//" + location.host + location.pathname.replace(/\/[^\/]*$/, "") + "/" + path.replace(/^\//, ""); + if (!path.match(/^\w+:/)) { + path = location.protocol + "//" + location.host + // paths starting with a slash are relative to the root (host) + + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, "")) + + "/" + path.replace(/^[\/]+/, ""); + } return path; };