Bug Tracker

Modify

Ticket #2178 (closed bug: wontfix)

Opened 5 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 5 years ago by john

  • Status changed from new to closed
  • Resolution set to wontfix

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.