WebIDL attribute reflection

Boris Zbarsky bzbarsky at mozilla.com
Sun Dec 30 22:26:37 PST 2012


On 12/30/12 10:20 AM, David Bruant wrote:
> I would say that the difference lies in the fact that properties which
> usually materialize the object state clearly are a per-instance thing
> while object methods usually are stateless functions

The line is fuzzy (as usual).  Is the innerHTML getter more stateful 
than querySelector?  Why?  Is either one more or less stateful than the 
nodeType getter (which is sorta kinda per instance but in practice per 
"subclass")?

> There is the |this| check removal and Brandon Benvie made a couple of
> good points on the developer experience at
> https://mail.mozilla.org/pipermail/es-discuss/2012-December/027503.html
> The point about debuggers may be very annoying. It can be solved by
> devtools. It would be just more work ;-)

Arguably devtools that go through and grab the values of all properties 
are somewhat broken anyway, because that's an expensive thing to do and 
can have side-effects....

But in any case, last I checked the devtools I tried in Firefox would 
show property values on instances and show the getter/setter pair on the 
prototype.

> I don't understand your point. I didn't mention anything about origin.
> Can you develop?

If you don't want a script to be able to change your runtime 
environment, don't run it in a place where it can reach your global.  On 
the web, that means don't run it from your origin, in practice.

> Anyway, in a modern browser, the beforescriptexecute event [1] can be of
> great help to sandbox code from any origin apparently
> (e.preventDefault() then evaluate with a sandbox of your own recipe).

Building that sandbox is ... nontrivial.

> Unrelated, but it's making me realize that innerHTML may stay a
> getter/setter (not sure about inherited or not).

OK, so we're talking about having some attributes work one way and 
others work a different way, then?

> I guess the divide I'd like to put is between object state and what is
> conveniently put as an accessor

What is the distinction between the two, exactly?

-Boris


More information about the es-discuss mailing list