diff --git a/src/js/Helper/compatibility.js b/src/js/Helper/compatibility.js index 6549f212..3db98973 100644 --- a/src/js/Helper/compatibility.js +++ b/src/js/Helper/compatibility.js @@ -41,8 +41,32 @@ function showBrowserCompatibilityWarning() { throw new Error('Browser does not suport ECMAScript 2017 / ES2017'); } +function isWebAssemblyEnable(){ + if(!window.hasOwnProperty('WebAssembly') || typeof window.WebAssembly.instantiate !== "function") { + console.error('WebAssembly not supported'); + return false; + } +} + +function showWebAssemblyCompatibilityWarning() { + + var imgpath = OC.filePath('passwords', 'img', 'warning.png'); + container = document.getElementById('main'); + container.innerHTML = + '
' + + '
'+OC.L10N.translate('passwords', 'To view this website properly, please enable Javascript JIT.') + + '
' + + '

' + OC.L10N.translate('passwords', 'How to enable it') + '

' + + '

' + OC.L10N.translate('passwords', 'JavaScript JIT might be disabled in your browser in order to render web content in a more secure configuration. You can always enable Javascript JIT in the settings, depending on your web browser.') + '


' + + '
'; + container.setAttribute('class', ''); + + throw new Error('Browser does not suport WebAssembly'); +} + function checkSystem() { - if(!isCompatibleBrowser()) showBrowserCompatibilityWarning(); + if(!isWebAssemblyEnable()) showWebAssemblyCompatibilityWarning(); + else if(!isCompatibleBrowser()) showBrowserCompatibilityWarning(); } -window.addEventListener('DOMContentLoaded', checkSystem, false); \ No newline at end of file +window.addEventListener('DOMContentLoaded', checkSystem, false); diff --git a/src/scss/Partials/_compatibility.scss b/src/scss/Partials/_compatibility.scss index 47da9262..4bcb9f1d 100644 --- a/src/scss/Partials/_compatibility.scss +++ b/src/scss/Partials/_compatibility.scss @@ -1,5 +1,6 @@ #main { .passwords-https-report, + .passwords-jit-compatibility, .passwords-browser-compatibility { position : absolute; top : 55px; @@ -118,5 +119,31 @@ list-style : disc; } } + + .info { + max-width: 400px; + margin: auto; + color: var(--color-main-text); + padding: 0px 24px 24px 24px; + } + + .warning-icon{ + margin-right: 4px; + height: 24px; + } + + .howto{ + color: var(--color-main-text); + font-weight: bold; + font-size: 20px; + } + + } + + .passwords-jit-compatibility{ + .message{ + display: flex; + justify-content: center; + } } } \ No newline at end of file