Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 411766

Summary: Ignore "message" events that do not target Orion
Product: [ECD] Orion Reporter: Maciej Bendkowski <maciej.bendkowski>
Component: ClientAssignee: Simon Kaegi <simon_kaegi>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mamacdon, simon_kaegi
Version: unspecifiedFlags: mamacdon: review+
Target Milestone: 4.0 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Quick fix patch none

Description Maciej Bendkowski CLA 2013-06-27 08:49:28 EDT
Created attachment 232838 [details]
Quick fix patch

JSON parse syntax exception occurred while I was installing the Google Drive Plugin (https://github.com/maciej-bendkowski/orion-google-drive-file-system).
The problem lies in pluginregistry.js (~line 793). The provided event.data is in my case: 

!_{h:'http%3A//127.0.0.2%3A8080/orionGoogleDriveFileSystem.html_1372335923473'}

Clearly it's not a proper JSON object, however I wonder where does it came from.
It haven't noticed that exception installing any other plugin. A quick fix is to surround the method with a try-catch and in case of an error - call the handler with event.data instead (see attached patch). I'm not sure whether this quick fix is a proper bug solution. Could someone confirm?

In case it's a good fix:
 "I assert that I authored 100% of the content of this contribution and have the rights to donate the content to Eclipse under the EPL"
Comment 1 Simon Kaegi CLA 2013-06-27 16:40:53 EDT
That postmessage looks like it's coming from inside of one of the scripts client.js. It appears to be trying to establish an OpenSocial widget communication with the parent.

We could certainly do a better job in the plugin-registry to ignore the message but I am curious if we could be using client.js a bit better.
Comment 2 Maciej Bendkowski CLA 2013-08-01 06:49:31 EDT
Simon, is the quick fix patch I attached any good being considered a temporary solution? I'd like to use my Google Drive plugin again and unfortunately until there's no change here I can't.
Comment 3 Simon Kaegi CLA 2013-08-01 10:57:18 EDT
We can do something along these lines. Essentially, if we receive a message we do not understand we can ignore it. I have a bunch of other changes going on right now but I will add this and of course a test case.
Comment 4 Maciej Bendkowski CLA 2013-09-22 11:44:58 EDT
(In reply to Simon Kaegi from comment #3)
> We can do something along these lines. Essentially, if we receive a message
> we do not understand we can ignore it. I have a bunch of other changes going
> on right now but I will add this and of course a test case.

Simon, is there any possibility we can have this fixed in RC1?
Comment 5 Simon Kaegi CLA 2013-09-22 23:24:05 EDT
Sorry Maciej, this got lost. 
RC1 should be fine.
Comment 6 Simon Kaegi CLA 2013-10-15 12:28:11 EDT
Fixed in Master.