From ffb524b6a5a614734d9ae30401b95b44eb62ca48 Mon Sep 17 00:00:00 2001 From: Richard Lewis <rxl881@olivia.local> Date: Wed, 21 Feb 2018 23:10:08 +0000 Subject: [PATCH 1/4] Allow widget iframes to request camera and microphone permissions. --- src/components/views/elements/AppTile.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index a63823555f..b325dace84 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -393,6 +393,10 @@ export default React.createClass({ const sandboxFlags = "allow-forms allow-popups allow-popups-to-escape-sandbox "+ "allow-same-origin allow-scripts allow-presentation"; + // Additional iframe feature pemissions + // (see - https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-permissions-in-cross-origin-iframes and https://wicg.github.io/feature-policy/) + const iframeFeatures = "microphone; camera; encrypted-media;"; + if (this.props.show) { const loadingElement = ( <div className='mx_AppTileBody mx_AppLoading'> @@ -413,6 +417,8 @@ export default React.createClass({ <div className={this.state.loading ? 'mx_AppTileBody mx_AppLoading' : 'mx_AppTileBody'}> { this.state.loading && loadingElement } <iframe + is + allow={iframeFeatures} ref="appFrame" src={this._getSafeUrl()} allowFullScreen="true" From 7e8660cd37dde21c3cca3b6a026343b9b8d84998 Mon Sep 17 00:00:00 2001 From: Richard Lewis <rxl881@olivia.local> Date: Wed, 21 Feb 2018 23:23:44 +0000 Subject: [PATCH 2/4] Add comment for "is" attribute. --- src/components/views/elements/AppTile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index b325dace84..e52cbade96 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -417,7 +417,7 @@ export default React.createClass({ <div className={this.state.loading ? 'mx_AppTileBody mx_AppLoading' : 'mx_AppTileBody'}> { this.state.loading && loadingElement } <iframe - is + is // This is required in order to enable passing of that "allow" preoperty, which is unknown to react 15 allow={iframeFeatures} ref="appFrame" src={this._getSafeUrl()} From ecde099146e37b9fd91ae2806f12d3031476503c Mon Sep 17 00:00:00 2001 From: Richard Lewis <rxl881@olivia.local> Date: Wed, 21 Feb 2018 23:24:53 +0000 Subject: [PATCH 3/4] Fix typo. --- src/components/views/elements/AppTile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index e52cbade96..b83ddbcee9 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -417,7 +417,7 @@ export default React.createClass({ <div className={this.state.loading ? 'mx_AppTileBody mx_AppLoading' : 'mx_AppTileBody'}> { this.state.loading && loadingElement } <iframe - is // This is required in order to enable passing of that "allow" preoperty, which is unknown to react 15 + is // This is required in order to enable passing of the "allow" property, which is unknown to react 15 allow={iframeFeatures} ref="appFrame" src={this._getSafeUrl()} From 13bebd69c9f9d5abe96b0372bb5f47231caa9bed Mon Sep 17 00:00:00 2001 From: Richard Lewis <rxl881@olivia.local> Date: Wed, 21 Feb 2018 23:35:57 +0000 Subject: [PATCH 4/4] Made comment "react-style". --- src/components/views/elements/AppTile.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index b83ddbcee9..3972b0d0be 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -416,8 +416,12 @@ export default React.createClass({ appTileBody = ( <div className={this.state.loading ? 'mx_AppTileBody mx_AppLoading' : 'mx_AppTileBody'}> { this.state.loading && loadingElement } + { /* + The "is" attribute in the following iframe tag is needed in order to enable rendering of the + "allow" attribute, which is unknown to react 15. + */ } <iframe - is // This is required in order to enable passing of the "allow" property, which is unknown to react 15 + is allow={iframeFeatures} ref="appFrame" src={this._getSafeUrl()}