You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ScreenObtainer.js 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. /* global chrome, $, alert */
  2. import JitsiTrackError from '../../JitsiTrackError';
  3. import * as JitsiTrackErrors from '../../JitsiTrackErrors';
  4. import RTCBrowserType from './RTCBrowserType';
  5. const logger = require('jitsi-meet-logger').getLogger(__filename);
  6. const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
  7. /**
  8. * Indicates whether the Chrome desktop sharing extension is installed.
  9. * @type {boolean}
  10. */
  11. let chromeExtInstalled = false;
  12. /**
  13. * Indicates whether an update of the Chrome desktop sharing extension is
  14. * required.
  15. * @type {boolean}
  16. */
  17. let chromeExtUpdateRequired = false;
  18. /**
  19. * Whether the jidesha extension for firefox is installed for the domain on
  20. * which we are running. Null designates an unknown value.
  21. * @type {null}
  22. */
  23. let firefoxExtInstalled = null;
  24. /**
  25. * If set to true, detection of an installed firefox extension will be started
  26. * again the next time obtainScreenOnFirefox is called (e.g. next time the
  27. * user tries to enable screen sharing).
  28. */
  29. let reDetectFirefoxExtension = false;
  30. let gumFunction = null;
  31. /**
  32. * The error returned by chrome when trying to start inline installation from
  33. * popup.
  34. */
  35. const CHROME_EXTENSION_POPUP_ERROR
  36. = 'Inline installs can not be initiated from pop-up windows.';
  37. /**
  38. * The error returned by chrome when trying to start inline installation from
  39. * iframe.
  40. */
  41. const CHROME_EXTENSION_IFRAME_ERROR
  42. = 'Chrome Web Store installations can only be started by the top frame.';
  43. /**
  44. * The error message returned by chrome when the extension is installed.
  45. */
  46. const CHROME_NO_EXTENSION_ERROR_MSG // eslint-disable-line no-unused-vars
  47. = 'Could not establish connection. Receiving end does not exist.';
  48. /**
  49. * Handles obtaining a stream from a screen capture on different browsers.
  50. */
  51. const ScreenObtainer = {
  52. obtainStream: null,
  53. /**
  54. * Initializes the function used to obtain a screen capture
  55. * (this.obtainStream).
  56. *
  57. * @param {object} options
  58. * @param {boolean} [options.disableDesktopSharing]
  59. * @param {boolean} [options.desktopSharingChromeDisabled]
  60. * @param {boolean} [options.desktopSharingChromeExtId]
  61. * @param {boolean} [options.desktopSharingFirefoxDisabled]
  62. * @param {boolean} [options.desktopSharingFirefoxExtId] (deprecated)
  63. * @param {Function} gum GUM method
  64. */
  65. init(options = {
  66. disableDesktopSharing: false,
  67. desktopSharingChromeDisabled: false,
  68. desktopSharingChromeExtId: null,
  69. desktopSharingFirefoxDisabled: false,
  70. desktopSharingFirefoxExtId: null
  71. }, gum) {
  72. // eslint-disable-next-line no-param-reassign
  73. this.options = options = options || {};
  74. gumFunction = gum;
  75. this.obtainStream
  76. = this.options.disableDesktopSharing
  77. ? null : this._createObtainStreamMethod(options);
  78. if (!this.obtainStream) {
  79. logger.info('Desktop sharing disabled');
  80. }
  81. },
  82. /**
  83. * Returns a method which will be used to obtain the screen sharing stream
  84. * (based on the browser type).
  85. *
  86. * @param {object} options passed from {@link init} - check description
  87. * there
  88. * @returns {Function}
  89. * @private
  90. */
  91. _createObtainStreamMethod(options) {
  92. if (RTCBrowserType.isNWJS()) {
  93. return (_, onSuccess, onFailure) => {
  94. window.JitsiMeetNW.obtainDesktopStream(
  95. onSuccess,
  96. (error, constraints) => {
  97. let jitsiError;
  98. // FIXME:
  99. // This is very very dirty fix for recognising that the
  100. // user have clicked the cancel button from the Desktop
  101. // sharing pick window. The proper solution would be to
  102. // detect this in the NWJS application by checking the
  103. // streamId === "". Even better solution would be to
  104. // stop calling GUM from the NWJS app and just pass the
  105. // streamId to lib-jitsi-meet. This way the desktop
  106. // sharing implementation for NWJS and chrome extension
  107. // will be the same and lib-jitsi-meet will be able to
  108. // control the constraints, check the streamId, etc.
  109. //
  110. // I cannot find documentation about "InvalidStateError"
  111. // but this is what we are receiving from GUM when the
  112. // streamId for the desktop sharing is "".
  113. if (error && error.name === 'InvalidStateError') {
  114. jitsiError = new JitsiTrackError(
  115. JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED
  116. );
  117. } else {
  118. jitsiError = new JitsiTrackError(
  119. error, constraints, [ 'desktop' ]);
  120. }
  121. (typeof onFailure === 'function')
  122. && onFailure(jitsiError);
  123. });
  124. };
  125. } else if (RTCBrowserType.isElectron()) {
  126. return this.obtainScreenOnElectron;
  127. } else if (RTCBrowserType.isTemasysPluginUsed()) {
  128. // XXX Don't require Temasys unless it's to be used because it
  129. // doesn't run on React Native, for example.
  130. const plugin
  131. = require('./adapter.screenshare').WebRTCPlugin.plugin;
  132. if (!plugin.HasScreensharingFeature) {
  133. logger.warn(
  134. 'Screensharing not supported by this plugin version');
  135. return null;
  136. } else if (!plugin.isScreensharingAvailable) {
  137. logger.warn(
  138. 'Screensharing not available with Temasys plugin on'
  139. + ' this site');
  140. return null;
  141. }
  142. logger.info('Using Temasys plugin for desktop sharing');
  143. return obtainWebRTCScreen;
  144. } else if (RTCBrowserType.isChrome()) {
  145. if (RTCBrowserType.getChromeVersion() < 34) {
  146. logger.info('Chrome extension not supported until ver 34');
  147. return null;
  148. } else if (options.desktopSharingChromeDisabled
  149. || options.desktopSharingChromeMethod === false
  150. || !options.desktopSharingChromeExtId) {
  151. // TODO: desktopSharingChromeMethod is deprecated, remove.
  152. return null;
  153. }
  154. logger.info('Using Chrome extension for desktop sharing');
  155. initChromeExtension(options);
  156. return this.obtainScreenFromExtension;
  157. } else if (RTCBrowserType.isFirefox()) {
  158. if (options.desktopSharingFirefoxDisabled) {
  159. return null;
  160. } else if (window.location.protocol === 'http:') {
  161. logger.log('Screen sharing is not supported over HTTP. '
  162. + 'Use of HTTPS is required.');
  163. return null;
  164. }
  165. initFirefoxExtensionDetection(options);
  166. return this.obtainScreenOnFirefox;
  167. }
  168. logger.warn(
  169. 'Screen sharing not supported by the current browser: ',
  170. RTCBrowserType.getBrowserType(),
  171. RTCBrowserType.getBrowserName());
  172. return null;
  173. },
  174. /**
  175. * Checks whether obtaining a screen capture is supported in the current
  176. * environment.
  177. * @returns {boolean}
  178. */
  179. isSupported() {
  180. return this.obtainStream !== null;
  181. },
  182. /**
  183. * Obtains a screen capture stream on Firefox.
  184. * @param callback
  185. * @param errorCallback
  186. */
  187. obtainScreenOnFirefox(options, callback, errorCallback) {
  188. let extensionRequired = false;
  189. const { desktopSharingFirefoxMaxVersionExtRequired } = this.options;
  190. if (desktopSharingFirefoxMaxVersionExtRequired === -1
  191. || (desktopSharingFirefoxMaxVersionExtRequired >= 0
  192. && RTCBrowserType.getFirefoxVersion()
  193. <= desktopSharingFirefoxMaxVersionExtRequired)) {
  194. extensionRequired = true;
  195. logger.log(
  196. `Jidesha extension required on firefox version ${
  197. RTCBrowserType.getFirefoxVersion()}`);
  198. }
  199. if (!extensionRequired || firefoxExtInstalled === true) {
  200. obtainWebRTCScreen(options, callback, errorCallback);
  201. return;
  202. }
  203. if (reDetectFirefoxExtension) {
  204. reDetectFirefoxExtension = false;
  205. initFirefoxExtensionDetection(this.options);
  206. }
  207. // Give it some (more) time to initialize, and assume lack of
  208. // extension if it hasn't.
  209. if (firefoxExtInstalled === null) {
  210. window.setTimeout(
  211. () => {
  212. if (firefoxExtInstalled === null) {
  213. firefoxExtInstalled = false;
  214. }
  215. this.obtainScreenOnFirefox(callback, errorCallback);
  216. },
  217. 300);
  218. logger.log(
  219. 'Waiting for detection of jidesha on firefox to finish.');
  220. return;
  221. }
  222. // We need an extension and it isn't installed.
  223. // Make sure we check for the extension when the user clicks again.
  224. firefoxExtInstalled = null;
  225. reDetectFirefoxExtension = true;
  226. // Make sure desktopsharing knows that we failed, so that it doesn't get
  227. // stuck in 'switching' mode.
  228. errorCallback(
  229. new JitsiTrackError(JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED));
  230. },
  231. /**
  232. * Obtains a screen capture stream on Electron.
  233. *
  234. * @param {Object} [options] - Screen sharing options.
  235. * @param {Array<string>} [options.desktopSharingSources] - Array with the
  236. * sources that have to be displayed in the desktop picker window ('screen',
  237. * 'window', etc.).
  238. * @param onSuccess - Success callback.
  239. * @param onFailure - Failure callback.
  240. */
  241. obtainScreenOnElectron(options = {}, onSuccess, onFailure) {
  242. if (window.JitsiMeetScreenObtainer
  243. && window.JitsiMeetScreenObtainer.openDesktopPicker) {
  244. window.JitsiMeetScreenObtainer.openDesktopPicker(
  245. {
  246. desktopSharingSources:
  247. options.desktopSharingSources
  248. || this.options.desktopSharingChromeSources
  249. },
  250. (streamId, streamType) =>
  251. onGetStreamResponse(
  252. {
  253. streamId,
  254. streamType
  255. },
  256. onSuccess,
  257. onFailure
  258. ),
  259. err => onFailure(new JitsiTrackError(
  260. JitsiTrackErrors.ELECTRON_DESKTOP_PICKER_ERROR,
  261. err
  262. ))
  263. );
  264. } else {
  265. onFailure(new JitsiTrackError(
  266. JitsiTrackErrors.ELECTRON_DESKTOP_PICKER_NOT_FOUND));
  267. }
  268. },
  269. /**
  270. * Asks Chrome extension to call chooseDesktopMedia and gets chrome
  271. * 'desktop' stream for returned stream token.
  272. */
  273. obtainScreenFromExtension(options, streamCallback, failCallback) {
  274. const {
  275. desktopSharingChromeExtId,
  276. desktopSharingChromeSources
  277. } = this.options;
  278. const gumOptions = {
  279. desktopSharingChromeExtId,
  280. desktopSharingChromeSources:
  281. options.desktopSharingSources
  282. || desktopSharingChromeSources
  283. };
  284. if (chromeExtInstalled) {
  285. doGetStreamFromExtension(
  286. gumOptions,
  287. streamCallback,
  288. failCallback);
  289. } else {
  290. if (chromeExtUpdateRequired) {
  291. /* eslint-disable no-alert */
  292. alert(
  293. 'Jitsi Desktop Streamer requires update. '
  294. + 'Changes will take effect after next Chrome restart.');
  295. /* eslint-enable no-alert */
  296. }
  297. try {
  298. chrome.webstore.install(
  299. getWebStoreInstallUrl(this.options),
  300. arg => {
  301. logger.log('Extension installed successfully', arg);
  302. chromeExtInstalled = true;
  303. // We need to give a moment to the endpoint to become
  304. // available.
  305. waitForExtensionAfterInstall(this.options, 200, 10)
  306. .then(() => {
  307. doGetStreamFromExtension(
  308. gumOptions,
  309. streamCallback,
  310. failCallback);
  311. })
  312. .catch(() => {
  313. this.handleExtensionInstallationError(options,
  314. streamCallback, failCallback);
  315. });
  316. },
  317. this.handleExtensionInstallationError.bind(this,
  318. options, streamCallback, failCallback)
  319. );
  320. } catch (e) {
  321. this.handleExtensionInstallationError(options, streamCallback,
  322. failCallback, e);
  323. }
  324. }
  325. },
  326. /* eslint-disable max-params */
  327. handleExtensionInstallationError(options, streamCallback, failCallback, e) {
  328. const webStoreInstallUrl = getWebStoreInstallUrl(this.options);
  329. if ((CHROME_EXTENSION_POPUP_ERROR === e
  330. || CHROME_EXTENSION_IFRAME_ERROR === e)
  331. && options.interval > 0
  332. && typeof options.checkAgain === 'function'
  333. && typeof options.listener === 'function') {
  334. options.listener('waitingForExtension', webStoreInstallUrl);
  335. this.checkForChromeExtensionOnInterval(options, streamCallback,
  336. failCallback, e);
  337. return;
  338. }
  339. const msg
  340. = `Failed to install the extension from ${webStoreInstallUrl}`;
  341. logger.log(msg, e);
  342. failCallback(new JitsiTrackError(
  343. JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR,
  344. msg));
  345. },
  346. /* eslint-enable max-params */
  347. checkForChromeExtensionOnInterval(options, streamCallback, failCallback) {
  348. if (options.checkAgain() === false) {
  349. failCallback(new JitsiTrackError(
  350. JitsiTrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR));
  351. return;
  352. }
  353. waitForExtensionAfterInstall(this.options, options.interval, 1)
  354. .then(() => {
  355. chromeExtInstalled = true;
  356. options.listener('extensionFound');
  357. this.obtainScreenFromExtension(options,
  358. streamCallback, failCallback);
  359. })
  360. .catch(() => {
  361. this.checkForChromeExtensionOnInterval(options,
  362. streamCallback, failCallback);
  363. });
  364. }
  365. };
  366. /**
  367. * Obtains a desktop stream using getUserMedia.
  368. * For this to work on Chrome, the
  369. * 'chrome://flags/#enable-usermedia-screen-capture' flag must be enabled.
  370. *
  371. * On firefox, the document's domain must be white-listed in the
  372. * 'media.getusermedia.screensharing.allowed_domains' preference in
  373. * 'about:config'.
  374. */
  375. function obtainWebRTCScreen(options, streamCallback, failCallback) {
  376. gumFunction(
  377. [ 'screen' ],
  378. stream => streamCallback({ stream }),
  379. failCallback
  380. );
  381. }
  382. /**
  383. * Constructs inline install URL for Chrome desktop streaming extension.
  384. * The 'chromeExtensionId' must be defined in options parameter.
  385. * @param options supports "desktopSharingChromeExtId"
  386. * @returns {string}
  387. */
  388. function getWebStoreInstallUrl(options) {
  389. return (
  390. `https://chrome.google.com/webstore/detail/${
  391. options.desktopSharingChromeExtId}`);
  392. }
  393. /**
  394. * Checks whether an update of the Chrome extension is required.
  395. * @param minVersion minimal required version
  396. * @param extVersion current extension version
  397. * @returns {boolean}
  398. */
  399. function isUpdateRequired(minVersion, extVersion) {
  400. try {
  401. const s1 = minVersion.split('.');
  402. const s2 = extVersion.split('.');
  403. const len = Math.max(s1.length, s2.length);
  404. for (let i = 0; i < len; i++) {
  405. let n1 = 0,
  406. n2 = 0;
  407. if (i < s1.length) {
  408. n1 = parseInt(s1[i], 10);
  409. }
  410. if (i < s2.length) {
  411. n2 = parseInt(s2[i], 10);
  412. }
  413. if (isNaN(n1) || isNaN(n2)) {
  414. return true;
  415. } else if (n1 !== n2) {
  416. return n1 > n2;
  417. }
  418. }
  419. // will happen if both versions have identical numbers in
  420. // their components (even if one of them is longer, has more components)
  421. return false;
  422. } catch (e) {
  423. GlobalOnErrorHandler.callErrorHandler(e);
  424. logger.error('Failed to parse extension version', e);
  425. return true;
  426. }
  427. }
  428. /**
  429. *
  430. * @param callback
  431. * @param options
  432. */
  433. function checkChromeExtInstalled(callback, options) {
  434. if (typeof chrome === 'undefined' || !chrome || !chrome.runtime) {
  435. // No API, so no extension for sure
  436. callback(false, false);
  437. return;
  438. }
  439. chrome.runtime.sendMessage(
  440. options.desktopSharingChromeExtId,
  441. { getVersion: true },
  442. response => {
  443. if (!response || !response.version) {
  444. // Communication failure - assume that no endpoint exists
  445. logger.warn(
  446. 'Extension not installed?: ', chrome.runtime.lastError);
  447. callback(false, false);
  448. return;
  449. }
  450. // Check installed extension version
  451. const extVersion = response.version;
  452. logger.log(`Extension version is: ${extVersion}`);
  453. const updateRequired
  454. = isUpdateRequired(
  455. options.desktopSharingChromeMinExtVersion,
  456. extVersion);
  457. callback(!updateRequired, updateRequired);
  458. }
  459. );
  460. }
  461. /**
  462. *
  463. * @param options
  464. * @param streamCallback
  465. * @param failCallback
  466. */
  467. function doGetStreamFromExtension(options, streamCallback, failCallback) {
  468. // Sends 'getStream' msg to the extension.
  469. // Extension id must be defined in the config.
  470. chrome.runtime.sendMessage(
  471. options.desktopSharingChromeExtId,
  472. {
  473. getStream: true,
  474. sources: options.desktopSharingChromeSources
  475. },
  476. response => {
  477. if (!response) {
  478. // possibly re-wraping error message to make code consistent
  479. const lastError = chrome.runtime.lastError;
  480. failCallback(lastError instanceof Error
  481. ? lastError
  482. : new JitsiTrackError(
  483. JitsiTrackErrors.CHROME_EXTENSION_GENERIC_ERROR,
  484. lastError));
  485. return;
  486. }
  487. logger.log('Response from extension: ', response);
  488. onGetStreamResponse(response, streamCallback, failCallback);
  489. }
  490. );
  491. }
  492. /**
  493. * Initializes <link rel=chrome-webstore-item /> with extension id set in
  494. * config.js to support inline installs. Host site must be selected as main
  495. * website of published extension.
  496. * @param options supports "desktopSharingChromeExtId"
  497. */
  498. function initInlineInstalls(options) {
  499. if ($('link[rel=chrome-webstore-item]').length === 0) {
  500. $('head').append('<link rel="chrome-webstore-item">');
  501. }
  502. $('link[rel=chrome-webstore-item]').attr('href',
  503. getWebStoreInstallUrl(options));
  504. }
  505. /**
  506. *
  507. * @param options
  508. */
  509. function initChromeExtension(options) {
  510. // Initialize Chrome extension inline installs
  511. initInlineInstalls(options);
  512. // Check if extension is installed
  513. checkChromeExtInstalled((installed, updateRequired) => {
  514. chromeExtInstalled = installed;
  515. chromeExtUpdateRequired = updateRequired;
  516. logger.info(
  517. `Chrome extension installed: ${chromeExtInstalled
  518. } updateRequired: ${chromeExtUpdateRequired}`);
  519. }, options);
  520. }
  521. /**
  522. * Checks "retries" times on every "waitInterval"ms whether the ext is alive.
  523. * @param {Object} options the options passed to ScreanObtainer.obtainStream
  524. * @param {int} waitInterval the number of ms between retries
  525. * @param {int} retries the number of retries
  526. * @returns {Promise} returns promise that will be resolved when the extension
  527. * is alive and rejected if the extension is not alive even after "retries"
  528. * checks
  529. */
  530. function waitForExtensionAfterInstall(options, waitInterval, retries) {
  531. if (retries === 0) {
  532. return Promise.reject();
  533. }
  534. return new Promise((resolve, reject) => {
  535. let currentRetries = retries;
  536. const interval = window.setInterval(() => {
  537. checkChromeExtInstalled(installed => {
  538. if (installed) {
  539. window.clearInterval(interval);
  540. resolve();
  541. } else {
  542. currentRetries--;
  543. if (currentRetries === 0) {
  544. reject();
  545. window.clearInterval(interval);
  546. }
  547. }
  548. }, options);
  549. }, waitInterval);
  550. });
  551. }
  552. /**
  553. * Handles response from external application / extension and calls GUM to
  554. * receive the desktop streams or reports error.
  555. * @param {object} response
  556. * @param {string} response.streamId - the streamId for the desktop stream
  557. * @param {string} response.error - error to be reported.
  558. * @param {Function} onSuccess - callback for success.
  559. * @param {Function} onFailure - callback for failure.
  560. */
  561. function onGetStreamResponse(
  562. { streamId, streamType, error },
  563. onSuccess,
  564. onFailure) {
  565. if (streamId) {
  566. gumFunction(
  567. [ 'desktop' ],
  568. stream => onSuccess({
  569. stream,
  570. sourceId: streamId,
  571. sourceType: streamType
  572. }),
  573. onFailure,
  574. { desktopStream: streamId });
  575. } else {
  576. // As noted in Chrome Desktop Capture API:
  577. // If user didn't select any source (i.e. canceled the prompt)
  578. // then the callback is called with an empty streamId.
  579. if (streamId === '') {
  580. onFailure(new JitsiTrackError(
  581. JitsiTrackErrors.CHROME_EXTENSION_USER_CANCELED));
  582. return;
  583. }
  584. onFailure(new JitsiTrackError(
  585. JitsiTrackErrors.CHROME_EXTENSION_GENERIC_ERROR,
  586. error));
  587. }
  588. }
  589. /**
  590. * Starts the detection of an installed jidesha extension for firefox.
  591. * @param options supports "desktopSharingFirefoxDisabled",
  592. * "desktopSharingFirefoxExtId"
  593. */
  594. function initFirefoxExtensionDetection(options) {
  595. if (options.desktopSharingFirefoxDisabled) {
  596. return;
  597. }
  598. if (firefoxExtInstalled === false || firefoxExtInstalled === true) {
  599. return;
  600. }
  601. if (!options.desktopSharingFirefoxExtId) {
  602. firefoxExtInstalled = false;
  603. return;
  604. }
  605. const img = document.createElement('img');
  606. img.onload = () => {
  607. logger.log('Detected firefox screen sharing extension.');
  608. firefoxExtInstalled = true;
  609. };
  610. img.onerror = () => {
  611. logger.log('Detected lack of firefox screen sharing extension.');
  612. firefoxExtInstalled = false;
  613. };
  614. // The jidesha extension exposes an empty image file under the url:
  615. // "chrome://EXT_ID/content/DOMAIN.png"
  616. // Where EXT_ID is the ID of the extension with "@" replaced by ".", and
  617. // DOMAIN is a domain whitelisted by the extension.
  618. const src
  619. = `chrome://${options.desktopSharingFirefoxExtId.replace('@', '.')
  620. }/content/${document.location.hostname}.png`;
  621. img.setAttribute('src', src);
  622. }
  623. export default ScreenObtainer;