Latest CoreJS SVN (25) / Echo3 SVN (1356) fixes Firefox 2.0.0.17 bugs...

tliebeck's picture

Anyone running Firefox 2.0.0.17 is in for a bad surprise with Echo3 due to this bug:

https://bugzilla.mozilla.org/show_bug.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&id=457000

I've actually changed CoreJS to use the method closure style now. THe old way was slightly quicker, but haven't seen a measurable performance drop using Echo3's server-side performance test. Let me know if anyone sees otherwise.

Old code was:

    /**
     * Creates a duplicate copy of a function.
     * Per the ECMA-262 v3 specification, Function.toString() is required to return an (implementation specific)
     * string representation of the function.
     * Creating a copy of a constructor is more efficient than invoking Function.apply() in certain browsers
     * (a significant performance improvement was observed in Internet Explorer 6).
     *
     * @param f the function
     * @return an identical copy
     * @private
     */
    _copyFunction: function(f) {
        var fCopy;
        eval("fCopy = " + f.toString() + ";");
        return fCopy;
    },

New code is:


    /**
     * Creates a duplicate copy of a function by wrapping the original in a closure.
     *
     * @param f the function
     * @return an effectively identical copy
     * @private
     */
    _copyFunction: function(f) {
        return function() {
            f.apply(this, arguments);
        };
    },