Closed Bug 1205605 Opened 9 years ago Closed 9 years ago

InternalError: too much recursion

Categories

(Core :: JavaScript Engine, defect)

43 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: spandan.veggalam, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0
Build ID: 20150826185640

Steps to reproduce:

mozilla-central revision f61c3cc0eb8b (build with: --enable-optimize --enable-posix-nspr-emulation --enable-valgrind --enable-gczeal --enable-debug)

Shell options: --ion-eager --ion-offthread-compile=off --non-writable-jitcode --ion-check-range-analysis --ion-extra-checks --no-sse3 --no-threads -f


function g(i) {
    if (i == 0) return;
    var x = "";

    function f() {}
    eval('');
    g(i - ["this is a *&^%$# test"]);
}
g(100);



Actual results:

InternalError: too much recursion
Doesn't look like a bug to me.  |g9100)| does nothing of importance until calling |g(100 - array)|, and |100 - array| is NaN.  |g(NaN)| does nothing of importance until |g(NaN - array)|, and |NaN - array| is still |NaN|, so we recur infinitely.  What am I missing?
If input started with a number(here 100), and somehow input in next iteration becomes NaN, can't we handle this differently by throwing some exception? What is the necessity to recur infinitely for NaN.
The necessity is that this is the way the language works, no?  This is no different from:

  function g() { g(); }
  g();
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.