On 10/18/17 10:28 AM, Boris Zbarsky wrote:
On 10/18/17 11:54 AM, David Teller wrote:
Mmmh... I was looking at setPendingException at
http://searchfox.org/mozilla-central/source/js/src/jscntxtinlines.h#435

That will allow you to hook all exceptions, sure, including ones caught by try/catch.

My idea would be to do it even on caught errors. It is too easy to catch
errors accidentally, in particular in Promise.

OK.  Then you need to do this in the JS engine, indeed, because catch happens entirely inside the JS engine.

My gut feeling is that you'd only want uncaught errors, and AutoJSAPI::ReportException is a better place than setPendingException. I don't know how common things like

  if (eval('nightlyOnlyFeature()')) { ... }

are, but they certainly seem reasonable. And you'd have to do a bunch of work for every one to decide whether the catch was appropriate or not. It may be worth doing too, if you could come up with some robust whitelisting mechanisms, but at least starting with uncaught exceptions seems more fruitful.

As for the Promise case, I don't know enough to suggest anything, but surely there's a way to detect those particular issues separately? Is there any way to detect if a finalized Promise swallowed an exception without "handling" it in some way or other, even if very heuristically?


_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to