[Harmony Proxies] Proposal: Property fixing

Cameron McCormack cam at mcc.id.au
Thu Jun 16 17:11:07 PDT 2011

Hi Mark.

Mark S. Miller:
> Can we gather a list of all magical host properties that WebIDL says are
> currently non-configurable but that proxies can't emulate unless they are
> made configurable?

Web IDL requires various properties to be non-configurable, but the ones
we care about here are just the ones that need to exist on objects that
will have to be implemented using proxies, right?  I believe that list
is only:

  1. the length own property on array host objects
  2. each array index own property on an array host object

Constants map to non-configurable properties, but they exist only on
interface objects and interface prototype objects, which are “normal”
objects that wouldn’t need to be implemented using proxies.

I will soon commit (probably today) a change to make indexed/named
properties be exposed using custom [[GetOwnProperty]] and
[[DefineOwnProperty]] handlers, which will mean objects that support
indexed/named properties need to be proxies.  The relevant issue with
these is that these objects must also expose non-configurable properties
that users set on them.  For example:

  <!DOCTYPE html>
  <form name=a></form>
    var forms = document.getElementsByTagName("form");
    Object.defineOwnProperty(forms, "z", { value: 1 });

forms needs to expose two properties, "0" and "a", whose values are the
HTMLFormElement.  In my upcoming change, [[GetOwnProperty]] will be
specified to return this property descriptor for property "0":

  { [[Writable]]:false, [[Enumerable]]:true, [[Configurable]]:true,
    [[Value]]:theHTMLFormElement }

but to refuse to allow the property to be reconfigured.

It would be nice if the z property could be allowed to be defined and
exposed as a non-configurable property, but this can’t be done without
the proxy proposal changes being discussed here.  But I don’t think it’s
a huge loss if we just disallow non-configurable properties from being
set on objects that support indexed/named properties.  My plan was to
silently make [[DefineOwnProperty]] for such objects assume
[[Configurable]] was true on the descriptor it receives.  Throwing would
also be acceptable.

We could do the same thing for the array host objects mentioend at the
top of the email, too: have the length and individual array index
properties be reported as configurable, but to have
[[DefineOwnProperty]] refuse to reconfigure them.

Cameron McCormack ≝ http://mcc.id.au/

More information about the es-discuss mailing list