Commit 9482ac92 authored by Alex Beregszaszi's avatar Alex Beregszaszi

Move the URL magic for loadVersion from the compiler to the app

parent 47c4b416
...@@ -487,14 +487,20 @@ var run = function () { ...@@ -487,14 +487,20 @@ var run = function () {
if (window.soljsonReleases !== undefined && window.soljsonReleases[version] !== undefined) { if (window.soljsonReleases !== undefined && window.soljsonReleases[version] !== undefined) {
version = window.soljsonReleases[version]; version = window.soljsonReleases[version];
} }
var url;
if (version !== 'soljson.js') {
url = 'https://ethereum.github.io/solc-bin/bin/' + version;
} else {
url = 'soljson.js';
}
var isFirefox = typeof InstallTrigger !== 'undefined'; var isFirefox = typeof InstallTrigger !== 'undefined';
if (document.location.protocol !== 'file:' && Worker !== undefined && isFirefox) { if (document.location.protocol !== 'file:' && Worker !== undefined && isFirefox) {
// Workers cannot load js on "file:"-URLs and we get a // Workers cannot load js on "file:"-URLs and we get a
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium, // "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// resort to non-worker version in that case. // resort to non-worker version in that case.
compiler.loadVersion(true, version); compiler.loadVersion(true, url);
} else { } else {
compiler.loadVersion(false, version); compiler.loadVersion(false, url);
} }
}; };
......
...@@ -123,13 +123,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) { ...@@ -123,13 +123,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
} }
} }
this.loadVersion = function (usingWorker, version) { this.loadVersion = function (usingWorker, url) {
var url;
if (version !== 'soljson.js') {
url = 'https://ethereum.github.io/solc-bin/bin/' + version;
} else {
url = 'soljson.js';
}
console.log('Loading ' + url + ' ' + (usingWorker ? 'with worker' : 'without worker')); console.log('Loading ' + url + ' ' + (usingWorker ? 'with worker' : 'without worker'));
if (usingWorker) { if (usingWorker) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment