diff --git a/src/BasePlatform.js b/src/BasePlatform.js index 897a1a2dc8..b8c400c6e3 100644 --- a/src/BasePlatform.js +++ b/src/BasePlatform.js @@ -63,7 +63,7 @@ export default class BasePlatform { requestNotificationPermission() : Promise { } - displayNotification(title: string, msg: string, avatarUrl: string) { + displayNotification(title: string, msg: string, avatarUrl: string, room: Object) { } /** diff --git a/src/Notifier.js b/src/Notifier.js index b9260a046d..a58fc0132f 100644 --- a/src/Notifier.js +++ b/src/Notifier.js @@ -73,7 +73,7 @@ var Notifier = { ev.sender, 40, 40, 'crop' ) : null; - const notif = plaf.displayNotification(title, msg, avatarUrl); + const notif = plaf.displayNotification(title, msg, avatarUrl, room); // if displayNotification returns non-null, the platform supports // clearing notifications later, so keep track of this. diff --git a/src/ScalarMessaging.js b/src/ScalarMessaging.js index db2baa433b..75062daaa2 100644 --- a/src/ScalarMessaging.js +++ b/src/ScalarMessaging.js @@ -292,12 +292,15 @@ const onMessage = function(event) { event.origin = event.originalEvent.origin; } - // check it is from the integrations UI URL (remove trailing spaces) + // Check that the integrations UI URL starts with the origin of the event + // This means the URL could contain a path (like /develop) and still be used + // to validate event origins, which do not specify paths. + // (See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) + // + // All strings start with the empty string, so for sanity return if the length + // of the event origin is 0. let url = SdkConfig.get().integrations_ui_url; - if (url.endsWith("/")) { - url = url.substr(0, url.length - 1); - } - if (url !== event.origin) { + if (event.origin.length === 0 || !url.startsWith(event.origin)) { return; // don't log this - debugging APIs like to spam postMessage which floods the log otherwise } diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index 31ac59c730..a9e16d364c 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -402,6 +402,9 @@ module.exports = React.createClass({ q.finally(fillPromise, () => { this._pendingFillRequests[dir] = false; }).then((hasMoreResults) => { + if (this.unmounted) { + return; + } // Unpaginate once filling is complete this._checkUnfillState(!backwards); diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index b82f2f5958..49674957bc 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -338,17 +338,15 @@ module.exports = React.createClass({ }, _renderCryptoInfo: function() { - var client = MatrixClientPeg.get(); - var deviceId = client.deviceId; - var identityKey = client.getDeviceEd25519Key() || ""; + const client = MatrixClientPeg.get(); + const deviceId = client.deviceId; + const identityKey = client.getDeviceEd25519Key() || ""; - var myDevice = client.getStoredDevicesForUser(MatrixClientPeg.get().credentials.userId)[0]; return (

Cryptography

    -
  • { myDevice.getDisplayName() }
  • {deviceId}
  • {identityKey}
diff --git a/src/components/views/elements/DirectorySearchBox.js b/src/components/views/elements/DirectorySearchBox.js index a453dfb62a..3ea0d16336 100644 --- a/src/components/views/elements/DirectorySearchBox.js +++ b/src/components/views/elements/DirectorySearchBox.js @@ -89,7 +89,7 @@ export default class DirectorySearchBox extends React.Component { return
-