Defined functions in extensions do not inherit Function.prototype

Bug #148661 reported by chippydip
2
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

Binary package hint: firefox

This problem occurs only with javascript code that is executed as part of a browser extension. Executing the same code as part of a webpage works just fine.

Functions created by standard function declarations (ie "var myfunc = function() { ...}") do not inherit the Function.prototype properties. Only functions created with the "new Function(...)" syntax seem to inherit these methods properly.

The following script demonstrates the problem:

// Add a new prototype property
Function.prototype.prop = "OK";

// Just make sure everything is setup properly
alert("Function.prototype.prop = " + Function.prototype.prop); // "OK"

// Test the Function.prototype with a newly defined function
var test1 = function(){};
alert("test1.prop = " + test1.prop); // "undefined" (should be "OK")

// Test the Function.prototype with a new Function object
var test2 = new Function();
alert("test2.prop = " + test2.prop); // "OK"

ProblemType: Bug
Architecture: i386
Date: Wed Oct 3 13:35:51 2007
DistroRelease: Ubuntu 7.04
Package: firefox 2.0.0.6+1-0ubuntu1
PackageArchitecture: i386
SourcePackage: firefox
Uname: Linux server 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 2007 i686 GNU/Linux

Revision history for this message
chippydip (cfbradford) wrote :
Revision history for this message
John Vivirito (gnomefreak) wrote :

Firefox-2 is getting near EOS and they wont be fixing anything but major issues security issues mainly. Please try to reproduce this with firefox-3.0 if you can reproduce this bug please click on Help> Report a problem and file the bug that way.

Changed in firefox:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.