Skip to content

Commit

Permalink
Workaround for the VoteWidgetPage.postMessage() security error.
Browse files Browse the repository at this point in the history
But it's not secure, see #84.
VoteWidgetPage.postMessage() will now also pass a JSON string.
  • Loading branch information
JMLX42 committed Oct 22, 2016
1 parent 2585408 commit d397005
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/src/script/page/embed/VoteWidgetPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ var VoteWidgetPage = React.createClass({
ReactIntl.IntlMixin,
],

postMessage: function(msg, vote) {
console.log('postMessage: ' + msg, vote);
postMessage: function(msg, data) {
if (!!window.parent) {
// FIXME: we should not use a wildcard
window.parent.postMessage(msg, '*');
window.parent.postMessage(
JSON.stringify(Object.assign({}, data, {message: msg})),
'*'
);
}
},

Expand Down

0 comments on commit d397005

Please sign in to comment.