adding ES6 and async feature detection to correctly flag old chromes and operas with the modern browser error

This commit is contained in:
El RIDO
2019-09-18 07:47:26 +02:00
parent 4332d0edb0
commit 70c38db81d
3 changed files with 12 additions and 5 deletions

View File

@@ -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;
}