From 55bf553df943fc793cf560a968d0c769bd3d3dbb Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 24 Oct 2016 20:41:07 +0100 Subject: [PATCH] Move location code to upstream loadVersion() --- src/app.js | 8 +++++++- src/app/compiler.js | 7 ------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/app.js b/src/app.js index a2d5de4263..0188203cdb 100644 --- a/src/app.js +++ b/src/app.js @@ -516,7 +516,13 @@ var run = function () { queryParams.update({ version: version }); var url; if (version === 'builtin') { - url = 'soljson.js'; + var location = window.document.location; + location = location.protocol + '//' + location.host + '/' + location.pathname; + if (!location.endsWith('/')) { + location += '/'; + } + + url = location + 'soljson.js'; } else { url = 'https://ethereum.github.io/solc-bin/bin/' + version; } diff --git a/src/app/compiler.js b/src/app/compiler.js index a925e002b3..ad1a99a383 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -201,13 +201,6 @@ 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}); }