-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different warning when Weebassembly is not enable #660
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = | ||
'<div class="passwords-browser-compatibility passwords-jit-compatibility">' + | ||
'<div class="message"><img class="warning-icon" src="' + imgpath +'"/>'+OC.L10N.translate('passwords', 'To view this website properly, please enable Javascript JIT.') + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a broken image here. But i also don't think we need a warning icon for this. |
||
'</div><div class="info" >' + | ||
'<h3 class="howto">' + OC.L10N.translate('passwords', 'How to enable it') + '</h3>' + | ||
'<p>' + 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.') + '</p><br />' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This text is placed directly onto the background image. This could be unreadable. |
||
'</div></div>'; | ||
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); | ||
window.addEventListener('DOMContentLoaded', checkSystem, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be either
var container
or the previous line should have a comma. I don't think you need imgpath at all.