1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-13 08:02:38 +03:00

Allow react performance profiling on widget iframes.

This commit is contained in:
Richard Lewis
2018-03-16 10:20:14 +00:00
parent 83412acbe7
commit 4d8f5072f7

View File

@@ -36,6 +36,7 @@ import WidgetUtils from '../../../WidgetUtils';
import dis from '../../../dispatcher'; import dis from '../../../dispatcher';
const ALLOWED_APP_URL_SCHEMES = ['https:', 'http:']; const ALLOWED_APP_URL_SCHEMES = ['https:', 'http:'];
const ENABLE_REACT_PERF = false;
export default class AppTile extends React.Component { export default class AppTile extends React.Component {
constructor(props) { constructor(props) {
@@ -452,7 +453,11 @@ export default class AppTile extends React.Component {
} }
_getSafeUrl() { _getSafeUrl() {
const parsedWidgetUrl = url.parse(this.state.widgetUrl); const parsedWidgetUrl = url.parse(this.state.widgetUrl, true);
if (ENABLE_REACT_PERF) {
parsedWidgetUrl.search = null;
parsedWidgetUrl.query.react_perf = true;
}
let safeWidgetUrl = ''; let safeWidgetUrl = '';
if (ALLOWED_APP_URL_SCHEMES.indexOf(parsedWidgetUrl.protocol) !== -1) { if (ALLOWED_APP_URL_SCHEMES.indexOf(parsedWidgetUrl.protocol) !== -1) {
safeWidgetUrl = url.format(parsedWidgetUrl); safeWidgetUrl = url.format(parsedWidgetUrl);