we can keep this for now, but keep in mind that it's not like the real thing: the real thing will call this asynchronously, not synchronously.

see eg https://github.com/mozilla-b2g/gaia/blob/master/shared/test/unit/mocks/mock_navigator_moz_apps.js (where there is only a success handler) or https://github.com/mozilla-b2g/gaia/blob/master/apps/sms/test/unit/mock_navigatormoz_sms.js (where there are both success and error handler). That makes the test files sometimes less readable, but closer to the reality. And this would definitely make your onerror test easier to write too.

So, it's not to be done now in this PR, but maybe more for your test PR.