Преглед на файлове

fix(browser) detect WebRTC APIs and mark browser unsupported if not

Some so called "security" browser extensions override WebRTC APIs so
even if the UA string suggests the browser is supported, it won't work.

Coincidentally, this should also mark Safari in Lockdown Mode as
unsupported, since the WebRTC APIs are not available in that case.
release-8443
Saúl Ibarra Corretgé преди 1 година
родител
ревизия
1ab4ae5e53
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6
    0
      modules/browser/BrowserCapabilities.js

+ 6
- 0
modules/browser/BrowserCapabilities.js Целия файл

@@ -71,6 +71,12 @@ export default class BrowserCapabilities extends BrowserDetection {
71 71
      * @returns {boolean} true if the browser is supported, false otherwise.
72 72
      */
73 73
     isSupported() {
74
+        // First check for WebRTC APIs because some "security" extensions are dumb.
75
+        if (typeof RTCPeerConnection === 'undefined'
76
+                || !navigator?.mediaDevices?.enumerateDevices || !navigator?.mediaDevices?.getUserMedia) {
77
+            return false;
78
+        }
79
+
74 80
         if (this.isSafari() && this._getSafariVersion() < MIN_REQUIRED_SAFARI_VERSION) {
75 81
             return false;
76 82
         }

Loading…
Отказ
Запис