JS_ClearScope doesn't work on dense arrays because js_ArrayObjectOps.clear is NULL. I think it used to work, so this could maybe regress an embedder somewhere. It looks like all other JSObjectOps in js/src and js/src/xpconnect/src implement JSObjectOps.clear. Seems like a nice-to-have. The opposite fix would be to document that the function sometimes doesn't work... The API doc for JS_ClearScope currently says: JS_ClearScope removes all of obj's own properties, except the special __proto__ and __parent__ properties, in a single operation. http://developer.mozilla.org/en/docs/JS_ClearScope Give or take some rewording, that's been there for years.
It definitely will not work on all host objects, because it's not a required member of the ops -- I'd not be at all surprised to discover that it didn't work on XPConnect or LiveConnect objects, f.e. So that should be documented, but I also think we should implement ClearScope on fast arrays: it should be a matter of freeing dslots, setting length and count to 0, and returning.
JS_ClearNonGlobalObject, as it is now known, is only used for specific browser objects.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.