Defined functions in extensions do not inherit Function.prototype
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.
// Just make sure everything is setup properly
alert("
// 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
PackageArchitec
SourcePackage: firefox
Uname: Linux server 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 2007 i686 GNU/Linux
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.