Bug 909889 - Add guards around drag property access in CrossSlide. r=mbrubeck
authorSam Foster <sfoster@mozilla.com>
Mon, 09 Sep 2013 19:35:33 -0700
changeset 146327 87f7da1e96632d6099c127bf5859417dd6a59865
parent 146326 b8a5df4364044fc83529005d87e798b6c9e0392e
child 146328 67329f8dfe7a138a20dda21c931cb3d6fcd95ec2
push id25252
push usercbook@mozilla.com
push dateTue, 10 Sep 2013 08:27:30 +0000
treeherdermozilla-central@9f9733d4c20e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs909889
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 909889 - Add guards around drag property access in CrossSlide. r=mbrubeck
browser/metro/modules/CrossSlide.jsm
--- a/browser/metro/modules/CrossSlide.jsm
+++ b/browser/metro/modules/CrossSlide.jsm
@@ -235,24 +235,30 @@ CrossSlideHandler.prototype = {
 
   /**
    * Dispatches a custom Event on the drag node.
    * @param aEvent The source event.
    * @param aType The event type.
    */
   _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);
   },
 
   /**
    * Dispatches a custom Event on the given target node.
    * @param aEvent The source event.
    */
   _fireSelectEvent: function SelectTarget_fireEvent(aEvent) {