Opened 12 years ago

Closed 12 years ago

#4440 closed defect (fixed)

dijit.popup.close() has invalid order of operations

Reported by: guest Owned by: bill
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: dijit popup popup.close Cc: mavrukin@…; ibolotin@…
Blocked By: Blocking:

Description

The "close" method inside of dijit.popup has an invalid order of operations:

var widget = stack[stack.length-1].widget;

if(widget.onClose){

widget.onClose();

}

if(!stack.length){

return;

}

The test for whether the stack is empty needs to take place before an access to it can be made. If the stack is indeed empty, then the first operation will result in a negative index. The required order needs to be:

if(!stack.length){

return;

}

var widget = stack[stack.length-1].widget;

if(widget.onClose){

widget.onClose();

}

Change History (5)

comment:1 Changed 12 years ago by bill

Milestone: 1.1
Owner: set to bill

comment:2 in reply to:  1 Changed 12 years ago by guest

Replying to bill:

I know this is set to be fixed in 1.1 and a severity of normal, but, in my case, this bug makes the dateTextBox unusable with an inlineEditBox in IE. I imagine it does the same for other developers, too. In my opinion, it ought to be considered a major issue and should go out in the next release.

comment:3 Changed 12 years ago by bill

Milestone: 1.11.0

Don't worry, nobody looks at the severity listings anyway. I didn't realize that InlineEditBox/DateTextBox? was broken; I think this bug indicates another problem with dijit, or otherwise close() wouldn't be called when nothing was open (somehow there's a recursion where the first close() call triggers an _onBlur event which triggers another close() call?)

OK, I'll fix for 1.0.

comment:4 Changed 12 years ago by Adam Peller

#4605 could be a dup?

comment:5 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

(In [10703]) Fix order of operations in close() (although this still leaves open the question of why close() is being called when nothing is open).

Fixes #4440.

Note: See TracTickets for help on using tickets.