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 #5657 from matrix-org/t3chguy/usercontent
Browse files Browse the repository at this point in the history
Remove redundant lockOrigin parameter from usercontent
  • Loading branch information
t3chguy authored Feb 16, 2021
2 parents fbf0a73 + 6cb3381 commit b386f0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/views/messages/MFileBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export default class MFileBody extends React.Component {
<a ref={this._dummyLink} />
</div>
<iframe
src={`${url}?origin=${encodeURIComponent(window.location.origin)}`}
src={url}
onLoad={onIframeLoad}
ref={this._iframe}
sandbox="allow-scripts allow-downloads allow-downloads-without-user-activation" />
Expand Down
9 changes: 1 addition & 8 deletions src/usercontent/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
const params = window.location.search.substring(1).split('&');
let lockOrigin;
for (let i = 0; i < params.length; ++i) {
const parts = params[i].split('=');
if (parts[0] === 'origin') lockOrigin = decodeURIComponent(parts[1]);
}

function remoteRender(event) {
const data = event.data;

Expand Down Expand Up @@ -45,7 +38,7 @@ function remoteSetTint(event) {
}

window.onmessage = function(e) {
if (e.origin === lockOrigin) {
if (e.origin === window.location.origin) {
if (e.data.blob) remoteRender(e);
else remoteSetTint(e);
}
Expand Down

0 comments on commit b386f0c

Please sign in to comment.