Browse Source

feat(ScreenObtainer): CHROME_EXTENSION_USER_GESTURE_REQUIRED

CHROME_EXTENSION_USER_GESTURE_REQUIRED will be triggered if
the extension installation fails, because the request to get desktop
stream did not originate in user gesture handler (a button click for
example).
dev1
paweldomas 8 years ago
parent
commit
5dd206721e
3 changed files with 29 additions and 3 deletions
  1. 4
    0
      JitsiTrackError.js
  2. 10
    0
      JitsiTrackErrors.js
  3. 15
    3
      modules/RTC/ScreenObtainer.js

+ 4
- 0
JitsiTrackError.js View File

8
     = 'Firefox extension is not installed';
8
     = 'Firefox extension is not installed';
9
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR]
9
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR]
10
     = 'Failed to install Chrome extension';
10
     = 'Failed to install Chrome extension';
11
+TRACK_ERROR_TO_MESSAGE_MAP[
12
+    JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED]
13
+    = 'Failed to install Chrome extension - installations can only be initiated'
14
+        + ' by a user gesture.';
11
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED]
15
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED]
12
     = 'User canceled Chrome\'s screen sharing prompt';
16
     = 'User canceled Chrome\'s screen sharing prompt';
13
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.CHROME_EXTENSION_GENERIC_ERROR]
17
 TRACK_ERROR_TO_MESSAGE_MAP[JitsiTrackErrors.CHROME_EXTENSION_GENERIC_ERROR]

+ 10
- 0
JitsiTrackErrors.js View File

15
 export const CHROME_EXTENSION_INSTALLATION_ERROR
15
 export const CHROME_EXTENSION_INSTALLATION_ERROR
16
     = 'gum.chrome_extension_installation_error';
16
     = 'gum.chrome_extension_installation_error';
17
 
17
 
18
+/**
19
+ * This error indicates that the attempt to start screensharing was initiated by
20
+ * a script which did not originate in user gesture handler. It means that
21
+ * you should to trigger the action again in response to a button click for
22
+ * example.
23
+ * @type {string}
24
+ */
25
+export const CHROME_EXTENSION_USER_GESTURE_REQUIRED
26
+    = 'gum.chrome_extension_user_gesture_required';
27
+
18
 /**
28
 /**
19
  * An error which indicates that user canceled screen sharing window
29
  * An error which indicates that user canceled screen sharing window
20
  * selection dialog in jidesha extension for Chrome.
30
  * selection dialog in jidesha extension for Chrome.

+ 15
- 3
modules/RTC/ScreenObtainer.js View File

56
 const CHROME_NO_EXTENSION_ERROR_MSG // eslint-disable-line no-unused-vars
56
 const CHROME_NO_EXTENSION_ERROR_MSG // eslint-disable-line no-unused-vars
57
     = 'Could not establish connection. Receiving end does not exist.';
57
     = 'Could not establish connection. Receiving end does not exist.';
58
 
58
 
59
+/**
60
+ * The error message returned by chrome when the extension install action needs
61
+ * to be initiated by a user gesture.
62
+ * @type {string}
63
+ */
64
+const CHROME_USER_GESTURE_REQ_ERROR
65
+    = 'Chrome Web Store installations can only be initated by a user gesture.';
66
+
59
 /**
67
 /**
60
  * Handles obtaining a stream from a screen capture on different browsers.
68
  * Handles obtaining a stream from a screen capture on different browsers.
61
  */
69
  */
394
             = `Failed to install the extension from ${webStoreInstallUrl}`;
402
             = `Failed to install the extension from ${webStoreInstallUrl}`;
395
 
403
 
396
         logger.log(msg, e);
404
         logger.log(msg, e);
397
-        failCallback(new JitsiTrackError(
398
-            JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR,
399
-            msg));
405
+
406
+        const error
407
+            = e === CHROME_USER_GESTURE_REQ_ERROR
408
+                ? JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED
409
+                : JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR;
410
+
411
+        failCallback(new JitsiTrackError(error, msg));
400
     },
412
     },
401
 
413
 
402
     /* eslint-enable max-params */
414
     /* eslint-enable max-params */

Loading…
Cancel
Save