Closed Bug 1114436 Opened 11 years ago Closed 3 years ago

JS_InitClass with JSPROP_INDEX does not work as expected

Categories

(Core :: JavaScript Engine, defect)

24 Branch
x86_64
Linux
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: holger.seelig, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0 Build ID: 20141127110442 Steps to reproduce: I create property specs as below with JSPROP_INDEX as descriped in https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_GetPropertyAttributes: MyClass::properties [ ] = { JS_PSGS ("x", getX, setX, 0), JS_PSGS ((char*) 0, getX, setX, JSPROP_INDEX), JS_PS_END }; and use it with JS_InitClass: JS_InitClass (cx, global, parent, &static_class, construct, 0, properties, functions, nullptr, nullptr); Actual results: The indexed property does not call the getter and setter functions. Expected results: The indexed property should call the getter and setter functions. The documentation says: JSPROP_INDEX: This flag has an additional special meaning when used with JS_DefineProperty, JS_FS, AND OTHER APIs THAT DEFINE PROPERTIES: it means that the name parameter is actually an integer unsafely cast to a pointer type, not a string. As I figured out JSPROP_INDEX works well with JS_DefineProperty.
Severity: normal → S3
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.