Opened 7 years ago
Closed 7 years ago
#17542 closed enhancement (fixed)
dijit/form/_AutoCompleterMixin crashes if no store and no srcNodeRef is provided
Reported by: | Colin Snover | Owned by: | Colin Snover |
---|---|---|---|
Priority: | high | Milestone: | 1.10 |
Component: | Dijit - Form | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I will use FilteringSelect? as an example but the bug is in dijit/form/_AutoCompleterMixin:450
.
This code will crash:
var fs = new FilteringSelect({}); fs.set('store', store);
The crash occurs because if no store is provided by the time postMixInProperties is called, _AutoCompleteMixin unsafely assumes that there must be a srcNodeRef and there must be options within the srcNodeRef that dijit/form/DataList can build from.
The fix is to actually check that srcNodeRef exists and is not null before attempting to create a store if none is already set.
Change History (6)
comment:1 Changed 7 years ago by
Component: | Dijit → Dijit - Form |
---|
comment:2 Changed 7 years ago by
Owner: | set to Colin Snover |
---|---|
Status: | new → pending |
Type: | defect → enhancement |
comment:3 Changed 7 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
comment:4 Changed 7 years ago by
Milestone: | tbd → 1.10 |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
comment:5 Changed 7 years ago by
Status: | reopened → pending |
---|
My comment above still stands. According to the spec this isn't supposed to work.
comment:6 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | pending → closed |
Since
store
is defined asconst
you aren't supposed to be able to set it after creation. It's easy to add in a check for srcNodeRef being null, to makenew FilteringSelect({})
not crash, but being able to set the store after creation would be an enhancement. I don't think it works currently, see #11498. Maybe it works if you don't set the value until after you set the store (like in your example), but it would need to be well tested.Is there some reason you need to set the store afterwards? I know with DOMNodes you first create the node and then set the property, but Dijit's general architecture is to make lots of properties const, and I can't think of any compelling reason to change that before 2.0.