Bug 909889 - Add guards around drag property access in CrossSlide. r=mbrubeck

This commit is contained in:
Sam Foster 2013-09-09 19:35:33 -07:00
Родитель e63149fab0
Коммит bee1d7f75a
1 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -240,14 +240,20 @@ CrossSlideHandler.prototype = {
*/
_fireProgressEvent: function CrossSliding_fireEvent(aState, aEvent) {
if (!this.drag)
return;
return;
let event = this.node.ownerDocument.createEvent("Events");
let crossAxis = this.drag.crossAxis;
let crossAxisName = this.drag.crossAxis;
event.initEvent("MozCrossSliding", true, true);
event.crossSlidingState = aState;
event.position = this.drag.position;
event.direction = this.drag.crossAxis;
event.delta = this.drag.position[crossAxis] - this.drag.origin[crossAxis];
if ('position' in this.drag) {
event.position = this.drag.position;
if (crossAxisName) {
event.direction = crossAxisName;
if('origin' in this.drag) {
event.delta = this.drag.position[crossAxisName] - this.drag.origin[crossAxisName];
}
}
}
aEvent.target.dispatchEvent(event);
},