Opened 9 years ago

Closed 8 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:


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 9 years ago by Colin Snover

Component: DijitDijit - Form

comment:2 Changed 9 years ago by bill

Owner: set to Colin Snover
Status: newpending
Type: defectenhancement

Since store is defined as const 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 make new 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.

comment:3 Changed 9 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

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 8 years ago by dylan

Milestone: tbd1.10
Resolution: invalid
Status: closedreopened

comment:5 Changed 8 years ago by bill

Status: reopenedpending

My comment above still stands. According to the spec this isn't supposed to work.

comment:6 Changed 8 years ago by Bill Keese <[email protected]…>

Resolution: fixed
Status: pendingclosed

In 5133d9193c441d2bf3e160e058fe1a7a89c780b3/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 
Note: See TracTickets for help on using tickets.