Bug 902539 - Make VariablesView ignore right clicks. r=vp
authorBrandon Benvie <bbenvie@mozilla.com>
Mon, 14 Oct 2013 14:40:05 -0700
changeset 164730 0cce3352d103bec12ef0f9e96a535de189d1538b
parent 164729 e8f0cc4920c1bf96e07ab9cf423aa61068b5d8e1
child 164731 4fd49e8f5577af143a40d223280c8829f2a584b2
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvp
bugs902539
milestone27.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 902539 - Make VariablesView ignore right clicks. r=vp
browser/devtools/debugger/test/browser_dbg_variables-view-01.js
browser/devtools/shared/widgets/VariablesView.jsm
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-01.js
@@ -95,25 +95,32 @@ function test() {
       "The testScope should remember it is collapsed even if it is hidden.");
 
     testScope.visible = true;
     ok(testScope.visible,
       "The testScope should be visible after reshowing.");
     ok(!testScope.expanded,
       "The testScope should remember it is collapsed after it is reshown.");
 
+    EventUtils.sendMouseEvent({ type: "mousedown", button: 1 },
+      testScope.target.querySelector(".title"),
+      aPanel.panelWin);
+
+    ok(!testScope.expanded,
+      "Clicking the testScope title with the right mouse button should't expand it.");
+
     EventUtils.sendMouseEvent({ type: "mousedown" },
       testScope.target.querySelector(".title"),
       aPanel.panelWin);
 
     ok(testScope.expanded,
-      "Clicking the testScope tilte should expand it.");
+      "Clicking the testScope title should expand it.");
 
     EventUtils.sendMouseEvent({ type: "mousedown" },
       testScope.target.querySelector(".title"),
       aPanel.panelWin);
 
     ok(!testScope.expanded,
-      "Clicking again the testScope tilte should collapse it.");
+      "Clicking again the testScope title should collapse it.");
 
     closeDebuggerAndFinish(aPanel);
   });
 }
--- a/browser/devtools/shared/widgets/VariablesView.jsm
+++ b/browser/devtools/shared/widgets/VariablesView.jsm
@@ -1646,17 +1646,18 @@ Scope.prototype = {
   _addEventListeners: function() {
     this._title.addEventListener("mousedown", this._onClick, false);
   },
 
   /**
    * The click listener for this scope's title.
    */
   _onClick: function(e) {
-    if (e.target == this._inputNode ||
+    if (e.button != 0 ||
+        e.target == this._inputNode ||
         e.target == this._editNode ||
         e.target == this._deleteNode) {
       return;
     }
     this.toggle();
     this.focus();
   },
 
@@ -2773,25 +2774,33 @@ Variable.prototype = Heritage.extend(Sco
         return;
     }
   },
 
   /**
    * The click listener for the edit button.
    */
   _onEdit: function(e) {
+    if (e.button != 0) {
+      return;
+    }
+
     e.preventDefault();
     e.stopPropagation();
     this._activateValueInput();
   },
 
   /**
    * The click listener for the delete button.
    */
   _onDelete: function(e) {
+    if ("button" in e && e.button != 0) {
+      return;
+    }
+
     e.preventDefault();
     e.stopPropagation();
 
     if (this.ownerView.delete) {
       if (!this.ownerView.delete(this)) {
         this.hide();
       }
     }