From bee1d7f75aae8616777cc5cc70ae3ba75307d134 Mon Sep 17 00:00:00 2001 From: Sam Foster Date: Mon, 9 Sep 2013 19:35:33 -0700 Subject: [PATCH] Bug 909889 - Add guards around drag property access in CrossSlide. r=mbrubeck --- browser/metro/modules/CrossSlide.jsm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/browser/metro/modules/CrossSlide.jsm b/browser/metro/modules/CrossSlide.jsm index 6d70b3f8c304..b8d03ba9c041 100644 --- a/browser/metro/modules/CrossSlide.jsm +++ b/browser/metro/modules/CrossSlide.jsm @@ -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); },