From c1af71714373e2b6db1da90d8a752205fadcc06a Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 22 Dec 2011 22:23:09 +0100 Subject: [PATCH] Fix cross-domain worker load issue. --- lib/ace/worker/worker_client.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js index 1b49cec9..31cc9a5d 100644 --- a/lib/ace/worker/worker_client.js +++ b/lib/ace/worker/worker_client.js @@ -104,12 +104,11 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) { oop.implement(this, EventEmitter); this.$normalizePath = function(path) { - 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(/^[\/]+/, ""); - } + 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) + + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, "")) + + "/" + path.replace(/^[\/]+/, ""); return path; };