On 24/11/2014 8:40 PM, Philipp Kewisch wrote:
On 11/24/14 1:43 AM, Mark Hammond wrote:
* Is Components.returnCode expected to be used when the code throws (as
SessionStore.jsm does) or when the code returns without an exception?
(Or maybe both?)
* If it is supposed to be used with a normal return, is the change so
GetPendingResult() is called the correct approach to take? (ie, should
I open a bug with that as the patch?)
I've also had this in nsIInterfaceRequestor::getInterface. If this
function throws, an exception gets logged and other parts of the
networking code treat it as a failure. Setting Components.returnCode and
returning null seems to work.
I believe that this will actually return NS_OK with a null result, which
depending on the caller, is probably treated exactly the same way.
Personally I'd prefer if the JS component could just throw and not have
to use Components.returnCode at all, isn't there a way the caller can
catch the exception without it being logged?
When the caller is c++ there's no opportunity for the call site to
control that (and indeed, the c++ caller generally has no idea they are
calling into js). xpconnect tries to be helpful and logs most
exceptions in that case - which is generally the right thing to do.
IIUC, Components.returnCode is specifically designed for this case, but
I'm convinced it simply doesn't work any more.
Mark
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform