Closed Bug 486106 Opened 17 years ago Closed 17 years ago

LookupResult from jsapi.cpp does not support fast arrays

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

(Keywords: fixed1.9.1, regression, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

LookupResult, http://hg.mozilla.org/tracemonkey/file/d16703358efc/js/src/jsapi.cpp#l3224 , contains the following code: if (OBJ_IS_NATIVE(obj2)) { /* Peek at the native property's slot value, without doing a Get. */ sprop = (JSScopeProperty *)prop; rval = SPROP_HAS_VALID_SLOT(sprop, OBJ_SCOPE(obj2)) ? LOCKED_OBJ_GET_SLOT(obj2, sprop->slot) : JSVAL_TRUE; } else { /* XXX bad API: no way to return "defined but value unknown" */ rval = JSVAL_TRUE; } Due to this OBJ_IS_NATIVE(obj2) check the code ignores fast arrays. It means hat any JS API that uses this helper function would return JS_TRUE instead of the real element in the array. I nominate this for 1.9.0 so the fix could be included in JS1.8 release. The bug was reported in http://groups.google.com/group/mozilla.dev.tech.js-engine/msg/1cbef3c6613572d1 .
Flags: wanted1.9.0.x?
Flags: blocking1.9.1?
Attached patch v1 (obsolete) — Splinter Review
The patch makes sure that from the point of various JS*Lookup API a fast array behaves as an ordinary native object to restore API compatibility.
Attachment #370221 - Flags: review?(shaver)
Flags: wanted1.9.1+
Flags: blocking1.9.1?
Flags: blocking1.9.1-
Comment on attachment 370221 [details] [diff] [review] v1 >+/* >+ * Utility to access the value from the id returned by array_lookupProperty. >+ */ >+jsval >+js_GetDenseArrayPropertyValue(JSObject *obj, JSProperty *prop); Wants to be called "ElementValue" I think, since it only works on int-indexed properties. Looks good otherwise.
Attachment #370221 - Flags: review?(shaver) → review+
I removed 1.9.0 nomination as patches for JS1.8 would go to a separated branch.
Flags: wanted1.9.0.x?
Attached patch v2Splinter Review
I the new version of the patch I renamed js_GetDenseArrayPropertyValue to js_GetDenseArrayElementValue.
Attachment #370221 - Attachment is obsolete: true
Attachment #370250 - Flags: review+
Whiteboard: fixed-in-tracemonkey
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Depends on: 487930
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: