logo       

Eval Limitations in IE7: msg#00226

java.dwr.user

Subject: Eval Limitations in IE7

DWR uses a lot of evals to de-serialize data into _javascript_ data structures. After experiencing several odd errors in IE7 with DWR and large sets of data, I started to do some digging. It seems that IE7 limits the number of variables that can be assigned in a single eval to 327687 (the max value of a signed short). If you cross that threshold, it gives you a generic 'Syntax Error' message.

The following code demonstrates the problem:

        function StringBuffer() { this.buffer = []; }

        StringBuffer.prototype.append = function(string) {
            this.buffer.push(string);
            return this;
        }

        StringBuffer.prototype.toString = function() {
            return this.buffer.join("");
        }



        var max = 32768;
        testEval();

        function testEval() {
            var sb = new StringBuffer();

            for (var i=0; i < max; i++) {
                sb.append("s" + i + " = 'foo';");
            }
            eval(sb.toString());
        }

I've opened a support case with MS but I don't have high hopes of them changing the behavior (I'm assuming that it's intentional). The most I'm hoping for is a little better error message.

With that said, is there any hope of seeing DWR less reliant on large evals in the future?
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise