Ever had the feeling the program is simply mocking you? Try doing addEventListener("foo", null, false) in a recent Mozilla or Firefox and you might understand.
It doesn't just throw an error (which seems a fairly sensible thing to do, given I'm providing bogus data), it throws a null error. That's not an error which says only "null", the actual error object itself is null! What gives?
With my basic knowledge of how XPConnect & co. work I can't work out how this can happen normally. The following three cases are what normally happens:
- If it can't convert the input data to make the wrapped call, you get a huge long error about "arg 1" or whatever.
- If the native code returns a failure code, you get an exception generated by XPConnect (which is just as excessive as the argument error one).
- If the native code returns a success code, you get the _retval, and not an exception.
This leaves only one option I can think of: the native code is returning a failure code, but also setting the XPConnect exception object explicitly to null (which allows native code to return nice exceptions to JS and other scripted languages, while still returning the 'nice' NS_ERROR code to native callers). I just can't find out where.