Open Bug 551856 Opened 10 years ago Updated 2 years ago

JavaScript type errors in JS components should be treated as errors inside the browser chrome test suite

Categories

(Testing :: Mochitest, defect, major)

defect
Not set
major

Tracking

(Not tracked)

People

(Reporter: ehsan, Unassigned)

Details

Currently, any JavaScript type errors which happen in JS components are not reported in browser chrome tests, which makes debugging things such as bug 518970 extremely difficult (took ~7 hours of my time today!).

The problem was very simple.  There was code like:

  this._window[i] = foo;

And there was a typo in it.  The correct version would have been:

  this._windows[i] = foo;

The original code would throw the following type error (which can for example be caught by wrapping a try/catch block around it):

TypeError: this._window is undefined

Seeing this error, the fix would be extremely trivial, but this was causing an intermittent orange which was extremely hard to debug.

I think these errors should be reported as test failures, just like XPCOM errors are right now.  It would help the robustness of our test suite and will enable us catch similar bugs in the future easily.
hm, the harness has already a listener on the console service that prints TEST-INFO... was that printed?
No, I don't think that JS errors in components are printed to the console (I may be wrong, I didn't have a GUI display when I was debugging that problem.)
(In reply to comment #2)
> No, I don't think that JS errors in components are printed to the console

If they're not, something's very wrong. The console listener will catch anything that shows up in the error console, and that includes all JS exceptions.
(In reply to comment #3)
> (In reply to comment #2)
> > No, I don't think that JS errors in components are printed to the console
> 
> If they're not, something's very wrong. The console listener will catch
> anything that shows up in the error console, and that includes all JS
> exceptions.

I agree, that was why I filed this bug! :-)
I discovered a bunch of JS errors hidden in some mochitests just now in bug 652494.  Is the fact that these errors and the one reported in this bug are not being reported as test failures a regression of bug 481406?
Component: BrowserTest → Mochitest
You need to log in before you can comment on or make changes to this bug.