Bugzilla – Bug 21069
[Unforgeable] attributes as data property
Last modified: 2013-02-21 13:55:13 UTC
Per bug 21068, event.isTrusted is now [Unforgeable], so the 'isTrusted' property is now own and not inherited.
One question which answer is not fully clear to me is:
should there be one getter per event instance or one getter shared by all event instances?
A way to not have to answer this question is just to make [Unforgeable] attributes data properties instead of getters.
Also, if all attributes that are unforgeable are readonly (and it looks like it) maybe we should support this is
unforgeable attribute ...;
(In reply to comment #1)
> Also, if all attributes that are unforgeable are readonly (and it looks like
> it) maybe we should support this is
> unforgeable attribute ...;
First line of the definition of [Unforgeable]:
"If the [Unforgeable] extended attribute appears on a read only attribute...", so I guess it means it can only happen to read only attributes...
The only places I know of unforgeable properties are:
* and now event.isTrusted
And indeed, it only applies to readonly.
So it probably is a nice refactoring.
In Gecko's implementation there is a separate getter per object instance for unforgeable attributes.
Making this a data property is not an option, imo: it needs to be non-configurable and readonly but the boolean returned can change.
Ah yeah, the value of isTrusted can change over time. (I should probably learn about data properties at some point.)
(In reply to comment #4)
> Ah yeah, the value of isTrusted can change over time.
In what circumstances?
> (I should probably
> learn about data properties at some point.)
I think this particular section will tell you all you need to know:
(I plan to move the property descriptor material to its own page eventually instead of having it explained in Object.defineProperty)
Put a trusted event object in a variable and then dispatch it. isTrusted will have changed per http://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent for hopefully obvious reasons.
(In reply to comment #6)
> Put a trusted event object in a variable and then dispatch it. isTrusted
> will have changed per
> http://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent for hopefully
> obvious reasons.
Yes, ok. Taking back the data property idea, then.