This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 21069 - [Unforgeable] attributes as data property
Summary: [Unforgeable] attributes as data property
Status: RESOLVED INVALID
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-21 11:23 UTC by David Bruant
Modified: 2013-02-21 13:55 UTC (History)
4 users (show)

See Also:


Attachments

Description David Bruant 2013-02-21 11:23:06 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.
Comment 1 Anne 2013-02-21 11:31:43 UTC
Also, if all attributes that are unforgeable are readonly (and it looks like it) maybe we should support this is

  unforgeable attribute ...;

instead?
Comment 2 David Bruant 2013-02-21 11:37:19 UTC
(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 ...;
> 
> instead?

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:
* http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-window-object
* http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#document
* and now event.isTrusted

And indeed, it only applies to readonly.
So it probably is a nice refactoring.
Comment 3 Boris Zbarsky 2013-02-21 13:33:27 UTC
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.
Comment 4 Anne 2013-02-21 13:41:12 UTC
Ah yeah, the value of isTrusted can change over time. (I should probably learn about data properties at some point.)
Comment 5 David Bruant 2013-02-21 13:46:43 UTC
(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:
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty#Description
(I plan to move the property descriptor material to its own page eventually instead of having it explained in Object.defineProperty)
Comment 6 Anne 2013-02-21 13:53:19 UTC
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.
Comment 7 David Bruant 2013-02-21 13:55:13 UTC
(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.