There have been some improvements to the console API for chrome callers recently:
* The WebIDL implementation is available as a global in JSMs - no need to import Console.jsm (bug 1425574) * Chrome console API calls print to stdout if "browser.dom.window.dump.enabled" is true (bug 1439686) * `console.assert` prints the callstack (bug 1439677) After these changes, I don't see a benefit to using `NS_ASSERT` instead of `console.assert`. So I'd like to propose that we either: 1) Delete the debug.js module [0] and rewrite the ~100 callers of its `NS_ASSERT` function [1] to use `console.assert` instead. 2) Make the existing `NS_ASSERT` function an alias for `console.assert`. I’d like hear any feedback or objections before doing either, but my preference is (1) so that we can unify chrome JS on using the WebIDL console APIs. This is basically what we plan on doing with Console.jsm (bug 1430810). The main behavior difference I see is that in `NS_ASSERT` we early return based on the update channel [2] before dumping to stdout, but after doing `Cu.reportError`. So this means if the assertion runs in a release build then it won't attempt to dump the message + stack. But since "browser.dom.window.dump.enabled" will be false by default that case, `console.assert` should have the same behavior. The difference would be if you were running a release build with "browser.dom.window.dump.enabled" flipped - in this case with `NS_ASSERT` you would not get a message in stdout but with `console.assert` you would. Thanks, Brian [0]: https://searchfox.org/mozilla-central/source/toolkit/modules/debug.js [1]: https://searchfox.org/mozilla-central/search?q=NS_ASSERT&case=true&path=js* [2]: https://searchfox.org/mozilla-central/rev/ecb86060b4c5a9808798b81a57e79e821bb47082/toolkit/modules/debug.js#41 _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform