Closed Bug 217159 Opened 21 years ago Closed 21 years ago

[FIX]Implement DOM L3 DOMStringList

Categories

(Core :: DOM: Core & HTML, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla1.6alpha

People

(Reporter: glazou, Assigned: bzbarsky)

References

()

Details

Attachments

(1 file, 3 obsolete files)

I would like to see DOM Level 3 DOMStringList implemented since I need it for
Composer++.
Why do you need it?  I don't know of anything that takes a DOMStringList off the
top of my head, and it's just a fancified Array.
IIRC there's only one use for DOMStringList and it's in DOM Level 3 Validation
(for enumeratedValues I think). I have an implementation in my DOM Level 3
Validation implementation, but that resides in webservices. Like caillon I
wonder why you'd need it.
I'm going to need this for some alternate stylesheet work I'm doing, so I'll
likely do this in the near future (like tonight).

I don't see an idl definition for this interface; where exactly in webservices
does this live?
It's not checked in yet. I'll see if I can dig it up.
Attached patch Implementation (obsolete) — Splinter Review
Attached patch IDL (obsolete) — Splinter Review
Note that you'll want to use NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO instead of
NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO. Also, this isn't useable
cross-module, since we'd need an interface for adding the strings. You may not
want to solve that now, but if you're putting this in content I'll probably have
to figure it out in the future when I want to use it in webservices :-). You'll
also need to add it to DOMCI here:

http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsDOMClassInfo.cpp#467
http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsDOMClassInfo.cpp#1455

and we'll probably need a new scriptable helper too for operator [] access from
JS (I have a patch to provide a generic array SH but it's not ready yet).
peterv, thanks!  I'll try to get that trunk-ready tonight, then.
Comment on attachment 132814 [details] [diff] [review]
IDL

r+sr=bzbarsky; the idl can be landed as-is, I would say.  Perhaps we also want
to add the interfaces to domstubs.idl?
Attachment #132814 - Flags: superreview+
Attachment #132814 - Flags: review+
Attached patch Complete patch (obsolete) — Splinter Review
This includes both patches peterv attached, plus the classinfo changes.  I
shamelessly stole Enumerate() from the content list implementation... we really
do need a generic array baseclass.

sr=bzbarsky on the actual implementation of both classes; looks good.
Attachment #132813 - Attachment is obsolete: true
Attachment #132814 - Attachment is obsolete: true
Comment on attachment 132908 [details] [diff] [review]
Complete patch

caillon, would you review?  peterv, would you check over the classinfo changes?
Attachment #132908 - Flags: superreview?(peterv)
Attachment #132908 - Flags: review?(caillon)
Taking.
Assignee: dom_bugs → bzbarsky
Blocks: 200930
Priority: -- → P1
Summary: Implement DOM L3 DOMStringList → [FIX]Implement DOM L3 DOMStringList
Target Milestone: --- → mozilla1.6alpha
Comment on attachment 132908 [details] [diff] [review]
Complete patch

Looks good to me, though I think we want put Enumerate on nsStringArraySH.
Could you check with jst if he's ok with that?
Attachment #132908 - Flags: superreview?(peterv) → superreview+
Comment on attachment 132908 [details] [diff] [review]
Complete patch

r=caillon if you fix the nsDOMLists files to use c-basic-offset: 2.

I also wonder whether nsStringArraySH should inherit from nsArraySH so you
don't even need to provide your own Enumerate() method, but I think there would
have to be some method over-riding, regardless so it may not gain anything. 
But if that doesn't fall through, how about a |static nsresult
DOMArrayEnumerator()| or something that gets called by both so as to save the
extra codesize?
Attachment #132908 - Flags: review?(caillon) → review+
The only difference is that I renamed nsArraySH to nsSupportsArraySH, added a
generic nsArraySH that just handles Enumerate, and made both nsSupportsArraySH
and nsStringArraySH inherit from it.

Thoughts?
Attachment #132908 - Attachment is obsolete: true
Comment on attachment 133307 [details] [diff] [review]
Move Enumerate() into a shared superclass

Give it a once-over?
Attachment #133307 - Flags: superreview?(peterv)
Attachment #133307 - Flags: review?(caillon)
Comment on attachment 133307 [details] [diff] [review]
Move Enumerate() into a shared superclass

sr=jst
Attachment #133307 - Flags: superreview?(peterv) → superreview+
Comment on attachment 133307 [details] [diff] [review]
Move Enumerate() into a shared superclass

Excellent, although I'm not sure I like the name nsSupportsArraySH since
nsISupportsArray is supposedly deprecated, and this sounds dastardly
similar....  How about leaving nsArraySH alone, and calling the superclass
nsGenericArraySH?

Oh, and when I said change the c-basic-offset, I meant not just for the
modelines, but for the actual file contents as well.  ;-)

r=caillon
Attachment #133307 - Flags: review?(caillon) → review+
Made the changes caillon asked for, and checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: