Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1766 from matrix-org/rxl881/iframePermissionsFix
Browse files Browse the repository at this point in the history
Allow widget iframes to request camera and microphone permissions.
  • Loading branch information
rxl881 committed Feb 22, 2018
2 parents 70d2ffc + 13bebd6 commit 8ac02b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/views/elements/AppTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'>
Expand All @@ -412,7 +416,13 @@ 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
allow={iframeFeatures}
ref="appFrame"
src={this._getSafeUrl()}
allowFullScreen="true"
Expand Down

0 comments on commit 8ac02b3

Please sign in to comment.