according to 126.96.36.199 toExponential should verify the range only after it has verified that the number is neither NaN nor Infinity. that is: Infinity.toExponential(-3) should not throw a RangeError.
Created attachment 352565 [details] [diff] [review] Patch that fixes the bug in both toExponential and toPrecision
Reviewing the specification, it seems that in addition to toExponential, toPrecision would also need to allow for both NaN and the two infinities to skip range check, and toPrecision also needs to handle undefined value for precision specially. Attached patch fixes all these problems.
Created attachment 352573 [details] [diff] [review] Extensions to ECMA testcases for toExponential and toPrecision Added testcases
synced to mc: http://hg.mozilla.org/mozilla-central/rev/03d4e7eb5fcb please get a review before checking in js tests or modifications. also, for the time being, please keep in sync with mozilla-central. thanks.