Closed
Bug 952890
Opened 11 years ago
Closed 11 years ago
Make sequence<> in WebIDL map to an iterable, not just something that quacks like an array
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla30
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(2 files, 2 obsolete files)
3.67 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
6.46 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
See proposal at http://lists.w3.org/Archives/Public/public-script-coord/2013OctDec/0370.html
I have a prototype implementation of this, but it's ... very slow. I'll file bugs blocking this for the JS engine bits we'll need to make this faster.
Assignee | ||
Comment 1•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Whiteboard: [need dependent bugs fixed]
Assignee | ||
Comment 3•11 years ago
|
||
Reuben, the patches in this bug cause dom/contacts/tests/test_contacts_basics2.html to fail. Specifically, this part of the test:
684 ok(true, "Test setting array properties to scalar values")
685 const FIELDS = ["email","url","adr","tel","impp"];
686 createResult1 = new mozContact();
687 for (var prop of FIELDS) {
688 createResult1[prop] = {type: ["foo"]};
689 ok(Array.isArray(createResult1[prop]), prop + " is array");
690 }
Before this patch, doing
contact.email = { type: ["foo"] }
just treats the right-hand side as a zero-length sequence; after this patch it throws an exception. Is there a compat need to support the "treat it as a zero-length sequence" behavior here?
Flags: needinfo?(reuben.bmo)
Assignee | ||
Comment 4•11 years ago
|
||
This is also blocked on bug 803106, because the idb tests assume (perfectly reasonably) that they can do db.transaction(db.objectStoreNames, {}) but db.objectStoreNames is a DOMStringList, which is not currently iterable, so it gets treated as a string, not a sequence.
Jonas, could we switch to using an actual array (possibly-frozen) for objectStoreNames? I seem to recall you wanting to do something like that...
Depends on: 803106
Flags: needinfo?(jonas)
Comment 5•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #3)
> 684 ok(true, "Test setting array properties to scalar values")
This should probably read "Test that after setting array properties to scalar values the property is not a non-Array".
> Before this patch, doing
>
> contact.email = { type: ["foo"] }
>
> just treats the right-hand side as a zero-length sequence; after this patch
> it throws an exception. Is there a compat need to support the "treat it as
> a zero-length sequence" behavior here?
The API was never specified to allow this type of stuff, and since we're already ignoring the RHS in this case today I don't think this has any compatibility problems.
Flags: needinfo?(reuben.bmo)
Assignee | ||
Comment 6•11 years ago
|
||
So it's OK to just wrap those assignments in try/catch?
Comment 7•11 years ago
|
||
Yeah.
(In reply to Boris Zbarsky [:bz] from comment #4)
> Jonas, could we switch to using an actual array (possibly-frozen) for
> objectStoreNames? I seem to recall you wanting to do something like that...
Yes. This property falls into category B from https://www.w3.org/Bugs/Public/show_bug.cgi?id=23682
So I think we should return a frozen JS Array which contains a list of plain strings. We can return the same Array instance as long as the list remains unchanged. Whenever the list changes (happens only in response to calls to createObjectStore and deleteObjectStore) we start returning a new instance.
Same thing for IDBObjectStore.indexNames (changes in response to createIndex/deleteIndex)
Flags: needinfo?(jonas)
(In reply to Jonas Sicking (:sicking) from comment #8)
> So I think we should return a frozen JS Array which contains a list of plain
> strings. We can return the same Array instance as long as the list remains
> unchanged. Whenever the list changes (happens only in response to calls to
> createObjectStore and deleteObjectStore) we start returning a new instance.
That's exactly what the old code did, isn't it?
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8365369 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Attachment #8351105 -
Attachment is obsolete: true
Assignee | ||
Comment 11•11 years ago
|
||
Attachment #8365370 -
Flags: review?(peterv)
Assignee | ||
Updated•11 years ago
|
Attachment #8351107 -
Attachment is obsolete: true
Updated•11 years ago
|
Attachment #8365369 -
Flags: review?(peterv) → review+
Updated•11 years ago
|
Attachment #8365370 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 12•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/d0b0dca8f792
https://hg.mozilla.org/integration/mozilla-inbound/rev/584e7a00ac79
Flags: in-testsuite?
Whiteboard: [need dependent bugs fixed]
Comment 13•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d0b0dca8f792
https://hg.mozilla.org/mozilla-central/rev/584e7a00ac79
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•