Open Bug 789779 Opened 12 years ago Updated 2 years ago

window.onerror only catches some JavaScript 'too much recursion' exceptions

Categories

(Core :: DOM: Core & HTML, defect, P5)

15 Branch
x86_64
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mail, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1

Steps to reproduce:

I was trying to log JavaScript-exceptions and realized that window.onerror doesn't seem to catch all 'too much recursion' exceptions. I wrote a small JavaScript that causes a 'too much recursion' exception.

window.onerror = errorHandler;

function errorHandler (msg) {
    alert(msg);        
}

setTimeout(function () {
    test.test = "test";
}, 1000);

setTimeout(function stackoverflow() {
    stackoverflow();
}, 2000);

A demo is on JSFiddle as well: http://jsfiddle.net/Mzvbk/1/


Actual results:

When reloading the page including this script, only perhaps one time out of ten, the alert for the 'too much recursion' exceptions is thrown.


Expected results:

Every time the page is reloaded, two alerts should be shown. One for the first exception, and then a second alert for the 'too much recursion' exception.
unsure if DOM or JS Engine, trying DOM

I always seem to get the "too much recursion" exception with 
Mozilla/5.0 (Windows NT 6.1; rv:18.0) Gecko/18.0 Firefox/18.0 SeaMonkey/2.15a1

but never with Firefox 15
Component: Untriaged → DOM
Product: Firefox → Core
It seems totally random. From my last try, reloading the jsfiddle referenced in the bug report, this is what I got.

* First two reloads i get the 'too much recursion' alert
* Five additional reloads without the alert
* Then two times with 'too much recursion'
* One time without the alert
* Then again one 'too much recursion'

Tested in: "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0"

(In reply to Matthias Versen (Matti) from comment #1)
> unsure if DOM or JS Engine, trying DOM
> 
> I always seem to get the "too much recursion" exception with 
> Mozilla/5.0 (Windows NT 6.1; rv:18.0) Gecko/18.0 Firefox/18.0
> SeaMonkey/2.15a1
> 
> but never with Firefox 15
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML

I came from bug 1667962
(I noticed a strange too much recursion error and I now have a suspicion something is amiss with alert-like error reporting in JS code.)

This works as expected when I visited
http://jsfiddle.net/Mzvbk/1/

I get exactly the expected behavior.

Every time the page is reloaded, two alerts should be shown. One for the first exception, and then a second alert for the 'too much recursion' exception.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.