Skip to content

Commit

Permalink
Merge pull request #3588 from NatKarmios/notes-error-catch
Browse files Browse the repository at this point in the history
Fix error when the notes plugin receives a non-string message
  • Loading branch information
hakimel committed Mar 15, 2024
2 parents 488c5c8 + 2fb4b46 commit d4e5c39
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion plugin/notes/notes.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/notes/notes.js

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions plugin/notes/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,16 @@ const Plugin = () => {
// (added 12/5/22 as a XSS safeguard)
if( isSameOriginEvent( event ) ) {

let data = JSON.parse( event.data );
if( data && data.namespace === 'reveal-notes' && data.type === 'connected' ) {
clearInterval( connectInterval );
onConnected();
}
else if( data && data.namespace === 'reveal-notes' && data.type === 'call' ) {
callRevealApi( data.methodName, data.arguments, data.callId );
}
try {
let data = JSON.parse( event.data );
if( data && data.namespace === 'reveal-notes' && data.type === 'connected' ) {
clearInterval( connectInterval );
onConnected();
}
else if( data && data.namespace === 'reveal-notes' && data.type === 'call' ) {
callRevealApi( data.methodName, data.arguments, data.callId );
}
} catch (e) {}

}

Expand Down

0 comments on commit d4e5c39

Please sign in to comment.