Strengthening Function.prototype.toString

liorean liorean at gmail.com
Fri Sep 26 18:58:32 PDT 2008


>> 2008/9/26 Erik Arvidsson <erik.arvidsson at gmail.com>:
>>> I know that Opera on mobile phones used to return a string
>>> representation that did not reflect the original.

> On Fri, 26 Sep 2008 19:58:27 +0200, liorean <liorean at gmail.com> wrote:
>> Yeah. Opera Mobile returned "[ECMAScript code]" or "[ecmascript
>> code]". This was contrary to the ES3 spec (must be parsable as a
>> function definition, IIRC) and also breaks the eval roundtripping by
>> throwing a parse error.
>> Anybody know if those issues have been fixed in more modern versions?

2008/9/26 Hallvord R. M. Steen <hallvord at opera.com>:
> No, not consistently across "modern versions". It's not likely to be
> properly "fixed" for a while yet. The reason is that on many platforms where
> memory is scarce, not enabling JS decompilation helps reduce memory
> requirements.

You can fix the ES3 spec compliancy by simply returning
"function(){/*decompilation disabled*/}" or something like that
instead of "[ecmascript code]". You could also fix the eval
roundtripping using for example
"function(){opera.getFunction('UniqueFunctionID').apply(this,arguments);}"
as a way to without decompiling allow roundtripping.
-- 
David "liorean" Andersson


More information about the Es-discuss mailing list