Closed Bug 924682 Opened 6 years ago Closed 6 years ago

Some more [Pure] getters for somewhat often used attributes

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch some_purity.diff (obsolete) — Splinter Review
Creating the JSObject for .all should be ok, since we create wrappers anyway for
normal C++ objects.
I think MOZ_CRASH() should be ok if the creation fails.
Attachment #814630 - Flags: review?(bzbarsky)
Depends on: 892687
Attachment #814630 - Flags: review?(bzbarsky)
Why not do the non-.all parts of this, then file a followup on .all?

>+  [Pure]
>   readonly attribute DOMString type;

This is not [Constant] because of initEvent?

>+  [Unforgeable,Pure]

I tend to prefer a space after comma there.

>+  [Constant]
>   readonly attribute HTMLCollection images;

I believe document.open() can in fact change that.  So needs to be [Pure] instead.  Same for the other HTMLCollections here...  Not sure whether mAll should be reset in that case too.
(In reply to Boris Zbarsky [:bz] (Vacation Oct 12 - Oct 27) from comment #1)

> >+  [Pure]
> >   readonly attribute DOMString type;
> 
> This is not [Constant] because of initEvent?
Right. All the attributes on Event may change

> >+  [Constant]
> >   readonly attribute HTMLCollection images;
> 
> I believe document.open() can in fact change that.  So needs to be [Pure]
> instead.
oh crap. How did I miss that.
Attached patch v2Splinter Review
Attachment #814630 - Attachment is obsolete: true
Attachment #815009 - Flags: review?(bzbarsky)
Comment on attachment 815009 [details] [diff] [review]
v2

r=me
Attachment #815009 - Flags: review?(bzbarsky) → review+
No longer depends on: 892687
Summary: Some more [Pure] and [Constant] getters for somewhat often used attributes → Some more [Pure] getters for somewhat often used attributes
https://hg.mozilla.org/mozilla-central/rev/7a7b028f0a02
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.