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

props mattwiebe.
fixes #postmessage-check.diff.

Built from https://develop.svn.wordpress.org/trunk@26542


git-svn-id: http://core.svn.wordpress.org/trunk@26434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-12-02 22:49:09 +00:00
parent 3fe7726bd4
commit 67c504cf23
2 changed files with 6 additions and 1 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.

File diff suppressed because one or more lines are too long