maciex / play-to-kodi

A Google Chrome/Firefox Extension for sending online content to be played on XBMC. Supported websites include YouTube, Vimeo, CollegeHumor, DailyMotion, eBaumsWorld and SoundCloud.
MIT License
25 stars 6 forks source link

Settings are lost after upgrade #17

Open maciex opened 7 years ago

maciex commented 7 years ago

After automatic upgrade all the setting of the Add-on were removed. This is probably caused by the Window.localStorage API used to handle settings:

Although this API is similar to Window.localStorage it is recommended that you don't use Window.localStorage in the extension code to store extension-related data. Firefox will clear data stored by extensions using the localStorage API in various scenarios where users clear their browsing history and data for privacy reasons, while data saved using the storage.local API will be correctly persisted in these scenarios. (from: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage)

MDN documentation advices to use storage.local instead of Window.localStorage. storage.local is asynchronous, so this won't be just a simple fix renaming function calls.

maciex commented 6 years ago

First version of the fix prepared in branch "use_storage". I'm contacting khloke from the upstream repo to decide if the code is OK.