From 7ef08314b8d329dda6abac2e56749b233fd2860a Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 19 Oct 2018 16:22:20 -0600 Subject: [PATCH 1/2] Redirect widgets to another location before deleting them This is so that shutdown hooks in the widget can correctly fire, such as Jitsi's hook to abandon its hold on the webcam. Fixes https://github.com/vector-im/riot-web/issues/7351 --- src/components/views/elements/AppTile.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 7be0bab33c..71cd65c89f 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -318,6 +318,19 @@ export default class AppTile extends React.Component { } this.setState({deleting: true}); + // HACK: This is a really dirty way to ensure that Jitsi cleans up + // its hold on the webcam. Without this, the widget holds a media + // stream open, even after death. See https://github.com/vector-im/riot-web/issues/7351 + if (this.refs.appFrame) { + // In practice we could just do `+= ''` to trick the browser + // into thinking the URL changed, however I can foresee this + // being optimized out by a browser. Instead, we'll just point + // the iframe at a page that is reasonably safe to use in the + // event the iframe doesn't wink away. + // This is relative to where the Riot instance is located. + this.refs.appFrame.src = '/config.json'; + } + WidgetUtils.setRoomWidget( this.props.room.roomId, this.props.id, From aaeb6e49785fdbf5b2e823ddb7e319d9052f2c0e Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 25 Oct 2018 15:59:42 -0600 Subject: [PATCH 2/2] Use about:blank instead --- 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 71cd65c89f..23b24adbb4 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -328,7 +328,7 @@ export default class AppTile extends React.Component { // the iframe at a page that is reasonably safe to use in the // event the iframe doesn't wink away. // This is relative to where the Riot instance is located. - this.refs.appFrame.src = '/config.json'; + this.refs.appFrame.src = 'about:blank'; } WidgetUtils.setRoomWidget(