Skip to main content

Bug Tracker

Side navigation

#2178 closed bug (wontfix)

Opened January 16, 2008 03:18PM UTC

Closed January 16, 2008 04:20PM UTC

Last modified December 04, 2009 11:53AM UTC

isFunction won't work correctly on Opera mobile

Reported by: hallvord @ Opera 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'};

Attachments (0)
Change History (1)

Changed January 16, 2008 04:20PM UTC by john comment:1

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