JS_ClearScope works on slow arrays but not dense arrays

RESOLVED WONTFIX

Status

()

RESOLVED WONTFIX
11 years ago
6 years ago

People

(Reporter: jorendorff, Unassigned)

Tracking

Other Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
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.

Comment 2

6 years ago
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.