Skip to content

Commit

Permalink
Add Modernizr warning when running in non-secure context (element-hq#…
Browse files Browse the repository at this point in the history
…28581)

Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy authored Nov 27, 2024
1 parent bfac727 commit 9c74110
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ function checkBrowserFeatures(): boolean {
// 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");

// 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>;

let featureComplete = true;
Expand Down

0 comments on commit 9c74110

Please sign in to comment.