From 58a71ed8062b23402f15f463337563c9425d5cfa Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Fri, 20 Sep 2019 13:42:25 +0530 Subject: [PATCH] separate function added --- src/app/tabs/compileTab/compilerContainer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/tabs/compileTab/compilerContainer.js b/src/app/tabs/compileTab/compilerContainer.js index f1ac414b77..948cd8a825 100644 --- a/src/app/tabs/compileTab/compilerContainer.js +++ b/src/app/tabs/compileTab/compilerContainer.js @@ -320,7 +320,7 @@ class CompilerContainer { url = `${this.data.baseurl}/${this.data.selectedVersion}` } // Check if browser is compatible with web worker - if (document.location.protocol !== 'file:' && Worker !== undefined) { + 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. @@ -374,6 +374,10 @@ class CompilerContainer { this.data.compileTimeout = window.setTimeout(() => this.compileIfAutoCompileOn(), this.data.timeout) } + browserSupportWorker () { + return document.location.protocol !== 'file:' && Worker !== undefined + } + } module.exports = CompilerContainer