浏览代码

Removes Firefox extension handle (removed in FF newer than latest ESR). (#722)

dev1
Дамян Минков 7 年前
父节点
当前提交
62f7e5c73e
共有 4 个文件被更改,包括 3 次插入131 次删除
  1. 0
    2
      JitsiTrackError.js
  2. 0
    3
      doc/API.md
  3. 1
    15
      doc/example/example.js
  4. 2
    111
      modules/RTC/ScreenObtainer.js

+ 0
- 2
JitsiTrackError.js 查看文件

@@ -4,8 +4,6 @@ const TRACK_ERROR_TO_MESSAGE_MAP = {};
4 4
 
5 5
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.UNSUPPORTED_RESOLUTION]
6 6
     = 'Video resolution is not supported: ';
7
-TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED]
8
-    = 'Firefox extension is not installed';
9 7
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR]
10 8
     = 'Failed to install Chrome extension';
11 9
 TRACK_ERROR_TO_MESSAGE_MAP[

+ 0
- 3
doc/API.md 查看文件

@@ -44,10 +44,7 @@ The ```options``` parameter is JS object with the following properties:
44 44
     - `desktopSharingChromeDisabled` - Boolean. Whether desktop sharing should be disabled on Chrome. Example: false.
45 45
     - `desktopSharingChromeSources` - Array of strings with the media sources to use when using screen sharing with the Chrome extension. Example: ['screen', 'window']
46 46
     - `desktopSharingChromeMinExtVersion` - Required version of Chrome extension. Example: '0.1'
47
-    - `desktopSharingFirefoxExtId` - The ID of the jidesha extension for Firefox. If null, we assume that no extension is required.
48 47
     - `desktopSharingFirefoxDisabled` - Boolean. Whether desktop sharing should be disabled on Firefox. Example: false.
49
-    - `desktopSharingFirefoxMaxVersionExtRequired` - The maximum version of Firefox which requires a jidesha extension. Example: if set to 41, we will require the extension for Firefox versions up to and including 41. On Firefox 42 and higher, we will run without the extension. If set to -1, an extension will be required for all versions of Firefox.
50
-    - `desktopSharingFirefoxExtensionURL` - The URL to the Firefox extension for desktop sharing. "null" if no extension is required.
51 48
     - `disableAudioLevels` - boolean property. Enables/disables audio levels.
52 49
     - `disableSimulcast` - boolean property. Enables/disables simulcast.
53 50
     - `enableWindowOnErrorHandler` - boolean property (default false). Enables/disables attaching global onerror handler (window.onerror).

+ 1
- 15
doc/example/example.js 查看文件

@@ -260,22 +260,8 @@ const initOptions = {
260 260
     // Required version of Chrome extension
261 261
     desktopSharingChromeMinExtVersion: '0.1',
262 262
 
263
-    // The ID of the jidesha extension for Firefox. If null, we assume that no
264
-    // extension is required.
265
-    desktopSharingFirefoxExtId: null,
266
-
267 263
     // Whether desktop sharing should be disabled on Firefox.
268
-    desktopSharingFirefoxDisabled: true,
269
-
270
-    // The maximum version of Firefox which requires a jidesha extension.
271
-    // Example: if set to 41, we will require the extension for Firefox versions
272
-    // up to and including 41. On Firefox 42 and higher, we will run without the
273
-    // extension.
274
-    // If set to -1, an extension will be required for all versions of Firefox.
275
-    desktopSharingFirefoxMaxVersionExtRequired: -1,
276
-
277
-    // The URL to the Firefox extension for desktop sharing.
278
-    desktopSharingFirefoxExtensionURL: null
264
+    desktopSharingFirefoxDisabled: true
279 265
 };
280 266
 
281 267
 JitsiMeetJS.init(initOptions)

+ 2
- 111
modules/RTC/ScreenObtainer.js 查看文件

@@ -20,20 +20,6 @@ let chromeExtInstalled = false;
20 20
  */
21 21
 let chromeExtUpdateRequired = false;
22 22
 
23
-/**
24
- * Whether the jidesha extension for firefox is installed for the domain on
25
- * which we are running. Null designates an unknown value.
26
- * @type {null}
27
- */
28
-let firefoxExtInstalled = null;
29
-
30
-/**
31
- * If set to true, detection of an installed firefox extension will be started
32
- * again the next time obtainScreenOnFirefox is called (e.g. next time the
33
- * user tries to enable screen sharing).
34
- */
35
-let reDetectFirefoxExtension = false;
36
-
37 23
 let gumFunction = null;
38 24
 
39 25
 /**
@@ -106,15 +92,13 @@ const ScreenObtainer = {
106 92
      * @param {boolean} [options.desktopSharingChromeDisabled]
107 93
      * @param {boolean} [options.desktopSharingChromeExtId]
108 94
      * @param {boolean} [options.desktopSharingFirefoxDisabled]
109
-     * @param {boolean} [options.desktopSharingFirefoxExtId] (deprecated)
110 95
      * @param {Function} gum GUM method
111 96
      */
112 97
     init(options = {
113 98
         disableDesktopSharing: false,
114 99
         desktopSharingChromeDisabled: false,
115 100
         desktopSharingChromeExtId: null,
116
-        desktopSharingFirefoxDisabled: false,
117
-        desktopSharingFirefoxExtId: null
101
+        desktopSharingFirefoxDisabled: false
118 102
     }, gum) {
119 103
         this.options = options;
120 104
         gumFunction = gum;
@@ -227,8 +211,6 @@ const ScreenObtainer = {
227 211
                 return null;
228 212
             }
229 213
 
230
-            initFirefoxExtensionDetection(options);
231
-
232 214
             return this.obtainScreenOnFirefox;
233 215
         }
234 216
 
@@ -254,58 +236,7 @@ const ScreenObtainer = {
254 236
      * @param errorCallback
255 237
      */
256 238
     obtainScreenOnFirefox(options, callback, errorCallback) {
257
-        let extensionRequired = false;
258
-        const { desktopSharingFirefoxMaxVersionExtRequired } = this.options;
259
-
260
-        if (desktopSharingFirefoxMaxVersionExtRequired === -1
261
-            || (desktopSharingFirefoxMaxVersionExtRequired >= 0
262
-            && !browser.isVersionGreaterThan(
263
-                desktopSharingFirefoxMaxVersionExtRequired))) {
264
-            extensionRequired = true;
265
-            logger.log(
266
-                `Jidesha extension required on firefox version ${
267
-                    browser.getVersion()}`);
268
-        }
269
-
270
-        if (!extensionRequired || firefoxExtInstalled === true) {
271
-            obtainWebRTCScreen(options.gumOptions, callback, errorCallback);
272
-
273
-            return;
274
-        }
275
-
276
-        if (reDetectFirefoxExtension) {
277
-            reDetectFirefoxExtension = false;
278
-            initFirefoxExtensionDetection(this.options);
279
-        }
280
-
281
-        // Give it some (more) time to initialize, and assume lack of
282
-        // extension if it hasn't.
283
-        if (firefoxExtInstalled === null) {
284
-            window.setTimeout(
285
-                () => {
286
-                    if (firefoxExtInstalled === null) {
287
-                        firefoxExtInstalled = false;
288
-                    }
289
-                    this.obtainScreenOnFirefox(
290
-                        options, callback, errorCallback);
291
-                },
292
-                300);
293
-            logger.log(
294
-                'Waiting for detection of jidesha on firefox to finish.');
295
-
296
-            return;
297
-        }
298
-
299
-        // We need an extension and it isn't installed.
300
-
301
-        // Make sure we check for the extension when the user clicks again.
302
-        firefoxExtInstalled = null;
303
-        reDetectFirefoxExtension = true;
304
-
305
-        // Make sure desktopsharing knows that we failed, so that it doesn't get
306
-        // stuck in 'switching' mode.
307
-        errorCallback(
308
-            new JitsiTrackError(JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED));
239
+        obtainWebRTCScreen(options.gumOptions, callback, errorCallback);
309 240
     },
310 241
 
311 242
     /**
@@ -782,44 +713,4 @@ function onGetStreamResponse(
782 713
     }
783 714
 }
784 715
 
785
-/**
786
- * Starts the detection of an installed jidesha extension for firefox.
787
- * @param options supports "desktopSharingFirefoxDisabled",
788
- * "desktopSharingFirefoxExtId"
789
- */
790
-function initFirefoxExtensionDetection(options) {
791
-    if (options.desktopSharingFirefoxDisabled) {
792
-        return;
793
-    }
794
-    if (firefoxExtInstalled === false || firefoxExtInstalled === true) {
795
-        return;
796
-    }
797
-    if (!options.desktopSharingFirefoxExtId) {
798
-        firefoxExtInstalled = false;
799
-
800
-        return;
801
-    }
802
-
803
-    const img = document.createElement('img');
804
-
805
-    img.onload = () => {
806
-        logger.log('Detected firefox screen sharing extension.');
807
-        firefoxExtInstalled = true;
808
-    };
809
-    img.onerror = () => {
810
-        logger.log('Detected lack of firefox screen sharing extension.');
811
-        firefoxExtInstalled = false;
812
-    };
813
-
814
-    // The jidesha extension exposes an empty image file under the url:
815
-    // "chrome://EXT_ID/content/DOMAIN.png"
816
-    // Where EXT_ID is the ID of the extension with "@" replaced by ".", and
817
-    // DOMAIN is a domain whitelisted by the extension.
818
-    const extId = options.desktopSharingFirefoxExtId.replace('@', '.');
819
-    const domain = document.location.hostname;
820
-    const src = `chrome://${extId}/content/${domain}.png`;
821
-
822
-    img.setAttribute('src', src);
823
-}
824
-
825 716
 export default ScreenObtainer;

正在加载...
取消
保存