From d5688180a74bbeb1fc38f2a988dc4f8d70f8e2bd Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 24 Oct 2016 15:00:00 +0200 Subject: [PATCH] Use absolute url for worker. --- src/app/compiler.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/compiler.js b/src/app/compiler.js index ad1a99a383..a925e002b3 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -201,6 +201,13 @@ function Compiler (editor, handleGithubCall) { jobs.push({sources: source}); worker.postMessage({cmd: 'compile', job: jobs.length - 1, source: JSON.stringify(source), optimize: optimize}); }; + if (!url.startsWith('http') && !url.startsWith('file')) { + var loc = window.document.location; + var locStr = loc.protocol + '//' + loc.host + '/' + loc.pathname; + if (!locStr.endsWith('/')) + locStr += '/'; + url = locStr + url; + } worker.postMessage({cmd: 'loadVersion', data: url}); }