Javascript functions don't list their "prototype"-property in a "for ... in" statement.

VERIFIED FIXED in mozilla1.8beta3

Status

()

P3
normal
VERIFIED FIXED
14 years ago
13 years ago

People

(Reporter: mozilla, Assigned: brendan)

Tracking

({js1.5})

Trunk
mozilla1.8beta3
js1.5
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.0 (like Gecko)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) 

According to ECMAscript spec section 13.2 and 15.3.5.2 the 
"prototype"-property of Javascript functions is *not* "DontEnum", and 
should hence be visible when doing a "for .. in" of the function object. 

Reproducible: Always
(Reporter)

Comment 1

14 years ago
Created attachment 188203 [details]
test-case.

the given test-case should print "prototype".
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.7 Branch
(Assignee)

Comment 2

14 years ago
Ancient bug.  If f.prototype has been used already, it will be enumerated per
the spec.  Any time a JSClass has a non-stub resolve hook implementation, it
needs a non-stub enumerate hook impl too.

/be
Assignee: general → brendan
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: js1.5
Priority: -- → P3
Target Milestone: --- → mozilla1.8beta3
Version: 1.7 Branch → Trunk
(Assignee)

Updated

14 years ago
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
(Assignee)

Comment 3

14 years ago
Created attachment 188264 [details] [diff] [review]
fix

Easy, no need for JSCLASS_NEW_ENUMERATE or replication of code from fun_resolve
-- just trigger fun_resolve via OBJ_LOOKUP_PROPERTY.

/be
(Assignee)

Updated

14 years ago
Attachment #188264 - Flags: review?(shaver)
Attachment #188264 - Flags: approval1.8b3+
Comment on attachment 188264 [details] [diff] [review]
fix

And lo, it is righteous. r=shaver
Attachment #188264 - Flags: review?(shaver) → review+
(Assignee)

Comment 5

14 years ago
Fixed, thanks.

/be
Status: ASSIGNED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED

Comment 6

13 years ago
I failed to catch it at the time, but this appears to have caused 

ecma/GlobalObject/15.1.2.1-1.js
ecma/GlobalObject/15.1.2.2-1.js
ecma/GlobalObject/15.1.2.3-1.js
ecma/GlobalObject/15.1.2.4.js
ecma/GlobalObject/15.1.2.5-1.js
ecma/GlobalObject/15.1.2.6.js
ecma/GlobalObject/15.1.2.7.js

to fail since the existing tests expected prototype to not be enumerated.

Checking in 15.1.2.1-1.js;
/cvsroot/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-1.js,v  <--  15.1.2.1-1.js
new revision: 1.5; previous revision: 1.4
done
Checking in 15.1.2.2-1.js;
/cvsroot/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-1.js,v  <--  15.1.2.2-1.js
new revision: 1.5; previous revision: 1.4
done
Checking in 15.1.2.3-1.js;
/cvsroot/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-1.js,v  <--  15.1.2.3-1.js
new revision: 1.5; previous revision: 1.4
done
Checking in 15.1.2.4.js;
/cvsroot/mozilla/js/tests/ecma/GlobalObject/15.1.2.4.js,v  <--  15.1.2.4.js
new revision: 1.5; previous revision: 1.4
done
Checking in 15.1.2.5-1.js;
/cvsroot/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-1.js,v  <--  15.1.2.5-1.js
new revision: 1.5; previous revision: 1.4
done
Checking in 15.1.2.6.js;
/cvsroot/mozilla/js/tests/ecma/GlobalObject/15.1.2.6.js,v  <--  15.1.2.6.js
new revision: 1.5; previous revision: 1.4
done
Checking in 15.1.2.7.js;
/cvsroot/mozilla/js/tests/ecma/GlobalObject/15.1.2.7.js,v  <--  15.1.2.7.js
new revision: 1.5; previous revision: 1.4
done

Comment 7

13 years ago
Checking in 10.1.6-01.js;
/cvsroot/mozilla/js/tests/js1_5/Function/10.1.6-01.js,v  <--  10.1.6-01.js
new revision: 1.2; previous revision: 1.1
Flags: testcase?

Comment 8

13 years ago
Test cases for this are in ecma_3/Statements/regress-194364.js and
js1_5/Function/10.1.6-01.js.
Flags: testcase? → testcase+

Comment 9

13 years ago
verified fixed 200604-1 1.8.0.2, 1.8, 1.9a1 win/mac/linux
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.