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

pull/1/head
Alex Beregszaszi 8 years ago
parent 47c4b4163a
commit 9482ac9251
  1. 10
      src/app.js
  2. 8
      src/app/compiler.js

@ -487,14 +487,20 @@ var run = function () {
if (window.soljsonReleases !== undefined && window.soljsonReleases[version] !== undefined) {
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';
if (document.location.protocol !== 'file:' && Worker !== undefined && isFirefox) {
// Workers cannot load js on "file:"-URLs and we get a
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// resort to non-worker version in that case.
compiler.loadVersion(true, version);
compiler.loadVersion(true, url);
} else {
compiler.loadVersion(false, version);
compiler.loadVersion(false, url);
}
};

@ -123,13 +123,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
}
}
this.loadVersion = function (usingWorker, version) {
var url;
if (version !== 'soljson.js') {
url = 'https://ethereum.github.io/solc-bin/bin/' + version;
} else {
url = 'soljson.js';
}
this.loadVersion = function (usingWorker, url) {
console.log('Loading ' + url + ' ' + (usingWorker ? 'with worker' : 'without worker'));
if (usingWorker) {

Loading…
Cancel
Save