Add warnings about insecure context

Most (all?) new APIs will require a "secure context", which generally
means served over TLS. We can expect crashes because of missing
functions if this requirement isn't fulfilled, so try to warn the user.
This commit is contained in:
Pierre Ossman
2022-05-12 15:46:59 +02:00
parent 658e415796
commit cdfb336651
2 changed files with 14 additions and 0 deletions

View File

@@ -79,6 +79,12 @@ export default class RFB extends EventTargetMixin {
throw new Error("Must specify URL, WebSocket or RTCDataChannel");
}
// We rely on modern APIs which might not be available in an
// insecure context
if (!window.isSecureContext) {
Log.Error("noVNC requires a secure context (TLS). Expect crashes!");
}
super();
this._target = target;