Переглянути джерело

fix(screensharing): set error type for cancelling extension install

When cancelling the prompt to install the extension, instead of
treating it as a generic error treat is as the cancel extension
error. This allows existing logic to trigger that will not show
an error message on cancel.
dev1
Leonard Kim 7 роки тому
джерело
коміт
4ba219da99
1 змінених файлів з 16 додано та 4 видалено
  1. 16
    4
      modules/RTC/ScreenObtainer.js

+ 16
- 4
modules/RTC/ScreenObtainer.js Переглянути файл

@@ -69,6 +69,13 @@ const CHROME_NO_EXTENSION_ERROR_MSG // eslint-disable-line no-unused-vars
69 69
 const CHROME_USER_GESTURE_REQ_ERROR
70 70
     = 'Chrome Web Store installations can only be initated by a user gesture.';
71 71
 
72
+/**
73
+ * The error message returned by chrome when the extension install has been
74
+ * cancelled by the user.
75
+ * @type {string}
76
+ */
77
+const CHROME_USER_CANCEL_EXTENSION_INSTALL = 'User cancelled install';
78
+
72 79
 /**
73 80
  * Handles obtaining a stream from a screen capture on different browsers.
74 81
  */
@@ -400,10 +407,15 @@ const ScreenObtainer = {
400 407
 
401 408
         logger.log(msg, e);
402 409
 
403
-        const error
404
-            = e === CHROME_USER_GESTURE_REQ_ERROR
405
-                ? JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED
406
-                : JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR;
410
+        let error;
411
+
412
+        if (e === CHROME_USER_CANCEL_EXTENSION_INSTALL) {
413
+            error = JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED;
414
+        } else if (e === CHROME_USER_GESTURE_REQ_ERROR) {
415
+            error = JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED;
416
+        } else {
417
+            error = JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR;
418
+        }
407 419
 
408 420
         failCallback(new JitsiTrackError(error, msg));
409 421
     },

Завантаження…
Відмінити
Зберегти