fracture91 / ignpp

Firefox and Chrome extension for boards.ign.com
http://vestitools.pbworks.com/
3 stars 2 forks source link

Chrome: Make GM_getValue more exception-proof #237

Closed fracture91 closed 13 years ago

fracture91 commented 13 years ago

When parsing JSON, exceptions can be thrown. For example, an outside force might completely bork the localStorage with invalid values that break the parser. Since these functions are used all over the place, many things can break. For example, after messing up one of the settings, the options page wouldn't add preferences to the page. Wrap the JSON parsing in a try/catch.

GM_setValue should still throw an exception if it can't stringify the value, since we should never be giving it something it can't stringify.