Bug 843776 - [sms] JavaScript errors when running application (sms.js) r=julienw

For review, I've left each commit intact. Once reviewed and approved, these can (will) be squashed.


https://bugzilla.mozilla.org/show_bug.cgi?id=843776