Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 14 years ago

#2178 closed bug (wontfix)

isFunction won't work correctly on Opera mobile

Reported by: hallvord @… Owned by:
Priority: major Milestone: 1.2.3
Component: core Version: 1.2.2
Keywords: Cc:
Blocked by: Blocking:

Description

As explained on http://my.opera.com/hallvors/blog/show.dml/1665828 : on limited platforms like mobiles, Opera's Function.prototype.toString does not return source code (due to the memory- and footprint cost of decompiling) so this part of the isFunction method will fail:

/function/i.test( fn + "" )

May I suggest adding the below workaround somewhere?

if( (function(){}).toString().match(/\[ecmascript/i) ) Function.prototype.toString = function(){return 'function'};

Change History (1)

comment:1 Changed 16 years ago by john

Resolution: wontfix
Status: newclosed

We don't extend native object prototypes - no matter the situation. As far as your suggestion from the blog post, that'll work just fine for us:

So we're actually wrong to output "[ecmascript code]" but we can output "function dontdecompileme(){}" and the spec is satisfied

Note: See TracTickets for help on using tickets.