Customizer: Ensure we have a string that's JSON parseable.

props mattwiebe.
fixes #postmessage-check.diff.


git-svn-id: https://develop.svn.wordpress.org/trunk@26542 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-12-02 22:48:15 +00:00
parent ea5963f944
commit f27ae94140
1 changed files with 5 additions and 0 deletions

View File

@ -533,6 +533,11 @@ window.wp = window.wp || {};
if ( this.origin() && event.origin !== this.origin() )
return;
// Ensure we have a string that's JSON.parse-able
if ( typeof event.data !== 'string' || event.data[0] !== '{' ) {
return;
}
message = JSON.parse( event.data );
// Check required message properties.