Closed Bug 299642 Opened 19 years ago Closed 19 years ago

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

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla1.8beta3

People

(Reporter: mozilla, Assigned: brendan)

Details

(Keywords: js1.5)

Attachments

(2 files)

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
Attached file 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
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
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
Attached patch fixSplinter Review
Easy, no need for JSCLASS_NEW_ENUMERATE or replication of code from fun_resolve
-- just trigger fun_resolve via OBJ_LOOKUP_PROPERTY.

/be
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+
Fixed, thanks.

/be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
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
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?
Test cases for this are in ecma_3/Statements/regress-194364.js and
js1_5/Function/10.1.6-01.js.
Flags: testcase? → testcase+
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.

Attachment

General

Creator:
Created:
Updated:
Size: