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

Bug 349755

Summary: Plugins erased on deleting browser history
Product: [ECD] Orion Reporter: Pradyut Sarma <pradyutksarma>
Component: ClientAssignee: Simon Kaegi <simon_kaegi>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: simon_kaegi
Version: 0.2   
Target Milestone: 0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Pradyut Sarma CLA 2011-06-18 12:56:37 EDT
Build Identifier: M8

I have installed a couple of plugins in my custom Orion installation. Due to some issue with my browser, I had to delete the browser history. On doing that, the plugins that I have installed are no more there. But, the plugins that by default come installed with Orion remain. Is this expected behavior?

Reproducible: Always

Steps to Reproduce:
1. Install a plugin
2. Clear browser history
3. The plugins are installed
Comment 1 Simon Kaegi CLA 2011-06-18 15:57:54 EDT
No, this is a bug. We're not listening for the install event and sending an event to cause the users plugin preferences to get flushed to the backing store. They end up just staying in local storage and only get persisted if something else causes a flush to occur.
Comment 2 Simon Kaegi CLA 2011-06-18 16:03:55 EDT
Very late here but I think we should at least look at this for RC3. 
What we would need to do is modify the plugins pages to listen and flush after plugin events. I'll put together a patch.
Comment 3 Pradyut Sarma CLA 2011-06-18 16:16:27 EDT
Hi Simon,

Just to add to this. If I install a newer version of the same plugin, it still works with the older version. It works only when I clear browser cache. I am not sure if both these issues are related.

Best Regards,
Pradyut.

(In reply to comment #1)
> No, this is a bug. We're not listening for the install event and sending an
> event to cause the users plugin preferences to get flushed to the backing
> store. They end up just staying in local storage and only get persisted if
> something else causes a flush to occur.
Comment 4 Simon Kaegi CLA 2011-06-19 14:36:33 EDT
When we were putting the plugin registry in we wanted it to be standalone and in particular tried to decouple it from whatever underlying persistence mechanism was in place. I'm not sure if that was the greatest decision in retrospect especially given we did not suitably refactor it in this release. We likely would be better off if we had tied it to our preferences story with an eye to fixing this in a future release.

I think we can do something small and pragmatic that will work for this release but will try to go through a good representative set of plugin scenarios so we can be sure what we do have works as expected.
Comment 5 Simon Kaegi CLA 2011-06-20 10:59:10 EDT
For 0.2 what we're doing is flushing after install and uninstall operations on the list.html page and after the install operation on the install.html page.

I did a review with John where we did variations on install and uninstall while clearing localStorage.

As part of testing we found a bug in preferences.js "flush" function where it's assignment in the prototype needed to be to a function that wrapped the call to this._flush. Otherwise at the time of assignment "this" is the global object and "flush" is undefined. We missed this when updating the file to make it better suited for jsDoc.

On the server we found a missing null check in OrionServlet.removeOwnProtocolHostPort(...). For the "{}" JSONObject.getNames() will return null not an empty array so we need to return instead of iterating through the array. This is a safe change as this was the intent.