From 208586cead06b3a4608c1f76a8ab979032e9b483 Mon Sep 17 00:00:00 2001 From: Hristo Terezov Date: Tue, 30 Nov 2021 15:03:50 -0600 Subject: [PATCH] fix(gravatar): Add crossOrigin attribute. In cross origin issolated mode we need to explicitly add crossOrigin attribute for all resources that are loaded with CORS headers. --- .../base/avatar/components/web/StatelessAvatar.js | 2 ++ react/features/base/avatar/constants.js | 6 ++++++ react/features/base/avatar/functions.js | 12 ++++++++++++ react/features/base/avatar/index.js | 1 + react/features/base/participants/functions.js | 3 ++- react/features/base/participants/preloadImage.web.js | 5 +++++ 6 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 react/features/base/avatar/constants.js diff --git a/react/features/base/avatar/components/web/StatelessAvatar.js b/react/features/base/avatar/components/web/StatelessAvatar.js index 57a1b8b17..67c85954f 100644 --- a/react/features/base/avatar/components/web/StatelessAvatar.js +++ b/react/features/base/avatar/components/web/StatelessAvatar.js @@ -3,6 +3,7 @@ import React from 'react'; import { Icon } from '../../../icons'; +import { isGravatarURL } from '../../functions'; import AbstractStatelessAvatar, { type Props as AbstractProps } from '../AbstractStatelessAvatar'; type Props = AbstractProps & { @@ -66,6 +67,7 @@ export default class StatelessAvatar extends AbstractStatelessAvatar { avatar { return new Promise((resolve, reject) => { const image = document.createElement('img'); + if (isGravatarURL(src)) { + image.setAttribute('crossOrigin', ''); + } image.onload = () => resolve(src); image.onerror = reject;