Fix cross-domain worker load issue.
This commit is contained in:
parent
c52d1b2030
commit
c1af717143
1 changed files with 5 additions and 6 deletions
|
|
@ -104,12 +104,11 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
|
||||||
oop.implement(this, EventEmitter);
|
oop.implement(this, EventEmitter);
|
||||||
|
|
||||||
this.$normalizePath = function(path) {
|
this.$normalizePath = function(path) {
|
||||||
if (!path.match(/^\w+:/)) {
|
path = path.replace(/^[a-z]+:\/\/[^\/]+\//, ""); // Remove domain name and rebuild it
|
||||||
path = location.protocol + "//" + location.host
|
path = location.protocol + "//" + location.host
|
||||||
// paths starting with a slash are relative to the root (host)
|
// paths starting with a slash are relative to the root (host)
|
||||||
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
|
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
|
||||||
+ "/" + path.replace(/^[\/]+/, "");
|
+ "/" + path.replace(/^[\/]+/, "");
|
||||||
}
|
|
||||||
return path;
|
return path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue