From:  Jan de Mooij <jdemooij@mozilla.com>
Date:  02 Jun 2016 01:03:00 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.tech.js-engine.internals
Subject:  

Error reporting changes

NNTP-Posting-Host:  63.245.214.181

Hi all,

Just a heads-up: we want to change how exceptions are reported to the
embedding [0].

The current/old behavior: the embedding sets an error reporter callback
(JS_SetErrorReporter), and the engine calls this when it throws an
exception and script doesn't catch it.

The new behavior: the callback will be renamed and will only be used for
warnings. Exceptions will be left on the JSContext and the embedding can
use JS_GetPendingException to get it. A RAII class is useful for this, for
instance see our code for the shell [1] and Gecko [2].

You can test this right now by setting the autoJSAPIOwnsErrorReporting
JSContext option. This option (and the dontReportUncaught option) will also
be removed though.

Please let us know if you have any questions or concerns.

Thanks,
Jan

[0] https://bugzilla.mozilla.org/show_bug.cgi?id=1277278
[1]
https://hg.mozilla.org/mozilla-central/file/111970c73823/js/src/shell/js.cpp#l5938
[2]
https://hg.mozilla.org/mozilla-central/file/111970c73823/dom/base/ScriptSettings.cpp#l319