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:
parent
ea5963f944
commit
f27ae94140
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue