mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-02 14:36:08 -04:00
adding ES6 and async feature detection to correctly flag old chromes and operas with the modern browser error
This commit is contained in:
parent
4332d0edb0
commit
70c38db81d
3 changed files with 12 additions and 5 deletions
13
js/legacy.js
13
js/legacy.js
|
@ -174,9 +174,16 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
// not checking for async/await, ES6 or Promise support, as most
|
||||
// browsers introduced these earlier then webassembly and webcrypto:
|
||||
// https://github.com/PrivateBin/PrivateBin/pull/431#issuecomment-493129359
|
||||
// async & ES6 support
|
||||
try {
|
||||
eval('async () => {}');
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
return true;
|
||||
} else {
|
||||
throw e; // throws CSP error
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue