Update/Install: Reject invalid messages in the Shiny Updates `postMessage` handler.

This prevents conflicts with third-party messages (e.g. sent by browser extensions). The updates script expects a specific JSON-encoded message and now bails early if it's not valid JSON.

Fixes #37125.

git-svn-id: https://develop.svn.wordpress.org/trunk@37976 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2016-07-05 16:15:04 +00:00
parent e34157ceb8
commit 146e6665c8
1 changed files with 5 additions and 1 deletions

View File

@ -2144,7 +2144,11 @@
return;
}
message = $.parseJSON( originalEvent.data );
try {
message = $.parseJSON( originalEvent.data );
} catch ( e ) {
return;
}
if ( 'undefined' === typeof message.action ) {
return;