瀏覽代碼

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…
取消
儲存