diff --git a/src/app/tabs/compileTab/compilerContainer.js b/src/app/tabs/compileTab/compilerContainer.js index d3b14c5ffb..9fe8183e47 100644 --- a/src/app/tabs/compileTab/compilerContainer.js +++ b/src/app/tabs/compileTab/compilerContainer.js @@ -376,11 +376,31 @@ class CompilerContainer { } url = `${this.data.baseurl}/${this.data.selectedVersion}` } - // Check if browser is compatible with web worker - if (this.browserSupportWorker) { - // 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. + + // Following restrictions should be deleted when Solidity will release fixed versions of compilers. + // See https://github.com/ethereum/remix-ide/issues/2461 + const isChrome = !!window.chrome + const os = this._retrieveOS() + // define a whitelist for Linux + const linuxWL = ['0.4.26', '0.5.3', '0.5.4', '0.5.5'] + const version = semver.coerce(this.data.selectedVersion) + // defining whitelist for chrome + let isFromWhiteList = false + switch (os) { + case 'Windows': + isFromWhiteList = semver.gt(version, '0.5.2') || version === '0.4.26' + break + case 'Linux': + isFromWhiteList = semver.gt(version, '0.5.13') || linuxWL.includes(version) + break + default : + isFromWhiteList = true + } + + // 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. + if (this.browserSupportWorker && (!isChrome || (isChrome && isFromWhiteList))) { this.compileTabLogic.compiler.loadVersion(true, url) this.setVersionText('(loading using worker)') } else { @@ -389,6 +409,14 @@ class CompilerContainer { } } + _retrieveOS () { + let osName = 'Unknown OS' + if (navigator.appVersion.indexOf('Win') !== -1) osName = 'Windows' + if (navigator.appVersion.indexOf('Mac') !== -1) osName = 'MacOS' + if (navigator.appVersion.indexOf('Linux') !== -1) osName = 'Linux' + return osName + } + _updateLanguageSelector () { // This is the first version when Yul is available if (!semver.valid(this._retrieveVersion()) || semver.lt(this._retrieveVersion(), 'v0.5.7+commit.6da8b019.js')) {