Cherry picked minor javascript fixes from Martin Reckziegel's fork at <https://bitbucket.org/derMart/ff-sync-client-chromium/>.