Add Modernizr warning when running in non-secure context (#28581)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-11-27 15:17:25 +00:00 committed by GitHub
parent bfac727307
commit 9c74110969
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,6 +67,10 @@ function checkBrowserFeatures(): boolean {
// although this would start to make (more) assumptions about how rust-crypto loads its wasm. // although this would start to make (more) assumptions about how rust-crypto loads its wasm.
window.Modernizr.addTest("wasm", () => typeof WebAssembly === "object" && typeof WebAssembly.Module === "function"); window.Modernizr.addTest("wasm", () => typeof WebAssembly === "object" && typeof WebAssembly.Module === "function");
// Check that the session is in a secure context otherwise most Crypto & WebRTC APIs will be unavailable
// https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext
window.Modernizr.addTest("securecontext", () => window.isSecureContext);
const featureList = Object.keys(window.Modernizr) as Array<keyof ModernizrStatic>; const featureList = Object.keys(window.Modernizr) as Array<keyof ModernizrStatic>;
let featureComplete = true; let featureComplete = true;